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.
Check this issue for the solution https://github.com/spring-cloud/spring-cloud-config/issues/118
Copy-paste from DavidBiesack's solution
(regardingapplication.properties
orapplication.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:
Add the library to your project dependencies (it will override the one in Tomcat's classpath),
Disable the
MappingJackson2SmileHttpMessageConverter
: unlike previously stated theSmileFactory
is not detected by theServiceLoader
, 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 itsconfigureMessageConverters
. 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
.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.
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
Erlang: Unix Domain Socket Support
Open O_Creat | O_Excl on Nfs in Linux
How Does Ancillary Data in Sendmsg() Work
How to Combine Two Variable Column-By-Column in Bash
Installing G++ on Windows Subsystem for Linux
Newbie on Debian and Trying to Make Java 7 the Default Java Version Used
Extract Date from a File Name in Unix Using Shell Scripting
Redirect Process Stdin and Stdout to Netcat
Shell Script Password Security of Command-Line Parameters
Linux Assembly: How to Call Syscall
Source Code of Pthread Library
How to Diff Top Lines of Two Files Without Intermediate File