While Deploying More Than One Spring Boot Application in a Single Tomcat Server Means Showing Exception. How to Solve This

While deploying more than one Spring Boot application in a single Tomcat server means showing exception. How to solve this?

I think what happens when you deploy multiple Spring Boot applications is those apps try to register to jmx on the same jvm using the same name.

  1. Check this issue for the solution https://github.com/spring-cloud/spring-cloud-config/issues/118

  2. Copy-paste from DavidBiesack's solution
    (regarding application.properties or application.yaml)

I was able to solve this by defining the following in my application.properties

spring.application.name=my-app-name
spring.jmx.default-domain=my-app-name

Or for application.yaml:

spring:
application:
name: my-app-name
jmx:
default-domain: my-app-name

Multiple Spring-boot applications running on one Tomcat

As Spring Boot Reference says:

If your application contains more than one Spring ApplicationContext you may find that names clash. To solve this problem you can set the endpoints.jmx.uniqueNames property to true so that MBean names are always unique.

endpoints.jmx.domain=myapp
endpoints.jmx.uniqueNames=true

Deployed Spring Boot war to Tomcat server and received Unable to start embedded Tomcat org.springframework.context.ApplicationContextException

As stated in the comments, the problem comes from a jackson-dataformat-smile library that your system administrator put in Tomcat's classpath.

If you really can't get rid of it you can use one of three solutions:

  1. Add the library to your project dependencies (it will override the one in Tomcat's classpath),

  2. Disable the MappingJackson2SmileHttpMessageConverter: unlike previously stated the SmileFactory is not detected by the ServiceLoader, but called explicitly by Spring if it detects the factory on its classpath (cf. WebMvcConfigurationSupport #addDefaultMessageConverters). This is the price of features "magically" appearing by adding a library to the classpath.

    Fortunately you can override the default message converters: just add a WebMvcConfigurer and override its configureMessageConverters. You can even do it in your @SpringBootApplication class:

    @SpringBootApplication
    public class YourSpringApplication implements WebMvcConfigurer {

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    // add configuration here
    }

    ...
    }

    You can copy parts of the aforementioned addDefaultMessageConverters.

  3. Change the classloader's search order by adding to your context file (cf. Documentation on the ways to do it and change the delegate attribute of your loader:

    <Context>
    <Loader delegate="true" />
    ...
    </Context>

Spring Boot : java.lang.IllegalArgumentException: More than one fragment with the name [spring_web] was found

Finally i found some solution, it looks like there was some spring dependency conflicts was there.So what i was done is simple recreated the project with another name, then it started to work and the error also gone.
Another possible solution is to clean your server in the right way(I haven't tried that, but i think it will work).

Use below command in your intelliJ terminal.

  1. Gradle clean and build command inside project folder :

    gradlew clean build

2.To refresh dependencies :

gradlew --refresh-dependencies

Also check your tomcat/webapps/Project/WEB-INF/lib/
folder for dependency conflict during library upgrade.

ERROR The requested URL could not be retrieved after deploying in external tomcat server

I found the issue. I accidentally forgot to mention the war file/application name which must be added.

Error while deploying spring boot restfull api on tomcat external server

I just solved my problem by adding these two dependencies :

    <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>

but i don't understand why i need "spring-boot-starter-web" dependency   :(

Cannot deploy a spring boot app on tomcat

The solution in my case was the spring-boot-starter-version in pom.xml. This one had to be 2.3.12.RELEASE (https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent).



Related Topics



Leave a reply



Submit