Start Spring RESTful webservice through Vaadin application - java

I've implemented a Sping Boot Maven project using one class with #RestController. I configured this application to use port 9000 as the normal Vaadin application uses port 8082. What I want to achieve is, to start the REST-Application project through a class of the Vaadin application project. The main class for the Spring application is called RestServiceApplication containing the annotation #SpringBootApplication. No I just call
SpringApplication sa = new SpringApplication(SenAalRestServiceApplication.class);
sa.run(args);
to run the RESTful webservice.
Now my problem is, that I can't call any method in the REST service. The log output of Spring startup just says:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.1.RELEASE)
2016-01-15 14:10:30.907 INFO 7900 --- [nio-8082-exec-1] o.s.boot.SpringApplication : Starting application on Kampfkeks with PID 7900 (C:\Users\Marcel\Desktop\ENTWICKLUNG_JAVA\java\workspaces\RaspAAL\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SenAAL\WEB-INF\lib\spring-boot-1.3.1.RELEASE.jar started by Marcel in C:\Users\Marcel\Desktop\ENTWICKLUNG_JAVA\java\eclipse)
2016-01-15 14:10:30.913 INFO 7900 --- [nio-8082-exec-1] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2016-01-15 14:10:31.020 INFO 7900 --- [nio-8082-exec-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#1c9710d: startup date [Fri Jan 15 14:10:31 CET 2016]; root of context hierarchy
2016-01-15 14:10:34.320 INFO 7900 --- [nio-8082-exec-1] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-01-15 14:10:34.340 INFO 7900 --- [nio-8082-exec-1] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2016-01-15 14:10:34.540 INFO 7900 --- [nio-8082-exec-1] o.s.boot.SpringApplication : Started application in 4.126 seconds (JVM running for 18.913)
EDIT:
Okay, I explain this in more detail:
I've got two applications:
1. Vaadin application NOT Spring powered, just running in a NORMAL Tomcat container (server).
2. Spring Boot Application containing a main class and a RestController.
In projec 1. I've got a class which just calls the above mentioned
SpringApplication sa = new SpringApplication(SenAalRestServiceApplication.class);
sa.run(args);
After launching the Vaadin app and calling this code fragment, the Spring Boot application will startup, but it will never show any REST service available. I think there is too little log output at the moment for a Spring Boot application. I played around with the log level, but it is still the same.
Now what I've done is, removed the dependency to project 2. ind project 1. and copied all sources of project 2. into project 1. and tried to run the Spring Boot application directly in project 1. My problem here is, that the embedded Tomcat server/container couldn't be started. I get the following error. What's the problem here??? I am starting the Spring Boot application within the Vaadin application with the same mentioned code fragment.
2016-01-16 11:59:29.025 WARN 1060 --- [nio-8080-exec-1] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "org/apache/catalina/Service"
2016-01-16 11:59:29.039 ERROR 1060 --- [nio-8080-exec-1] o.s.boot.SpringApplication : Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "org/apache/catalina/Service"
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[EmbeddedWebApplicationContext.class:1.3.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[AbstractApplicationContext.class:4.2.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[EmbeddedWebApplicationContext.class:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) ~[SpringApplication.class:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) ~[SpringApplication.class:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) ~[SpringApplication.class:1.3.1.RELEASE]
at de.hska.iwi.senaal.service.rest.SenAALRestCallback.<init>(SenAALRestCallback.java:24) [SenAALRestCallback.class:na]
at de.hska.iwi.senaal.service.SenAALService.<init>(SenAALService.java:117) [SenAALService.class:na]
at de.hska.iwi.senaal.factory.SenAALFactoryImpl.getSenAALService(SenAALFactoryImpl.java:56) [SenAALFactoryImpl.class:na]
at de.hska.iwi.senaal.servlet.MainServlet.servletInitialized(MainServlet.java:43) [MainServlet.class:na]
at com.vaadin.server.VaadinServlet.init(VaadinServlet.java:216) [VaadinServlet.class:7.6.0.alpha2]
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1241) [catalina.jar:8.0.14]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154) [catalina.jar:8.0.14]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827) [catalina.jar:8.0.14]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) [catalina.jar:8.0.14]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.14]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) [catalina.jar:8.0.14]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.14]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.14]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) [catalina.jar:8.0.14]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.14]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) [catalina.jar:8.0.14]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081) [tomcat-coyote.jar:8.0.14]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) [tomcat-coyote.jar:8.0.14]
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) [tomcat-coyote.jar:8.0.14]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566) [tomcat-coyote.jar:8.0.14]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523) [tomcat-coyote.jar:8.0.14]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_31]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.14]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_31]

Related

Not able to start Klov Server for extent reports from a jar file

I try to install klov-0.2.5.jar locally, my settings are as below:
Mongodb 3.2 running and listening on port 27017
klov application.properties file reside in the same folder as klov-0.2.5.jar
Have tried different ports for Klov (80, 90, 2571,1100), but all giving the same error as in description
Have tried it on mongoDB 5.0 with same result
Running it on windows 10, with application.properties settings as below:
# klov
application.name=Klov
server.host=localhost
server.port=1100
# data.mongodb
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=klov
# data.rest
spring.data.rest.basePath=/rest
spring.data.rest.default-page-size=6
# redis, session
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.session.SessionAutoConfiguration
spring.data.redis.repositories.enabled=false
spring.data.elasticsearch.repositories.enabled=false
spring.data.jpa.repositories.enabled=false
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext.enabled=false
# use.redis.session.store=false
# spring.redis.host=localhost
# spring.redis.port=6379
# spring.redis.ssl=false
# spring.redis.database=0
# spring.session.store-type=redis
# server.session.timeout=-1
# users
server.admin.name=klovadmin
server.admin.key=$2a$10$I/5TFi6BrHChUghTZEZfCO82txzu8L5brcK0CxhS3m.V6glfj2vZe
# storage
file.storage.location=./upload/reports/
# schedulers
scheduler.jobs.enabled=false
# automatically delete older builds
# default is -1 (keep all)
# this count must be greater than 0 for this scheduler to work
# scheduled to run daily at 12:00AM
scheduler.job.builds.retain.count=-1
# mail
#spring.mail.host=
#spring.mail.port=
#spring.mail.username=
#spring.mail.password=
#spring.mail.properties.mail.smtp.ssl.enable=true
#spring.mail.properties.mail.smtp.starttls.enable=true
#spring.mail.properties.mail.smtp.starttls.required=true
#spring.mail.properties.mail.smtp.auth=true
#spring.mail.properties.mail.smtp.connectiontimeout=5000
#spring.mail.properties.mail.smtp.timeout=5000
#spring.mail.properties.mail.smtp.writetimeout=5000
spring.mail.test-connection=false
Once i try to execute jar file in my powershell i get:
poerwshell outcome
PS D:\klov\0.2.5> java -jar .\klov-0.2.5.jar
. ____ _ __ _ _ /\ / ' __ _ () __ __
_ \ \ \ \ ( ( )__ | '_ | '| | ' / ` | \ \ \ \ \/ __)| |)| | | | | || (| | ) ) ) ) ' || .__|| ||| |_, | / / / /
=========||==============|/=//// :: Spring Boot :: (v2.0.4.RELEASE)
2022-07-13 14:34:42.138 INFO 2796 --- [ main]
com.aventstack.klov.Application : Starting Application v0.2.5
on fedoruk with PID 2796 (D:\klov\0.2.5\klov-0.2.5.jar started by
mfedoruk in D:\klov\0.2.5) 2022-07-13 14:34:42.141 INFO 2796 --- [
main] com.aventstack.klov.Application : No active profile
set, falling back to default profiles: default 2022-07-13 14:34:42.215
INFO 2796 --- [ main]
ConfigServletWebServerApplicationContext : Refreshing
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#7a3d45bd:
startup date [Wed Jul 13 14:34:42 CEST 2022]; root of context
hierarchy 2022-07-13 14:34:42.984 INFO 2796 --- [ main]
.s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data
modules found, entering strict repository configuration mode!
2022-07-13 14:34:43.356 ERROR 2796 --- [ main]
o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Cannot load configuration class:
com.aventstack.klov.Application
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:414)
~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254)
~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:282)
~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)
~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)
~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398)
~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:330)
~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258)
~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
at com.aventstack.klov.Application.main(Application.java:61) ~[classes!/:0.2.5]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:577) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
~[klov-0.2.5.jar:0.2.5]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
~[klov-0.2.5.jar:0.2.5]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
~[klov-0.2.5.jar:0.2.5]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
~[klov-0.2.5.jar:0.2.5] Caused by:
java.lang.ExceptionInInitializerError: null
at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:122)
~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
I dealt with it by:
running the newest ver of klov in docker container
then I copied the klov.jar file from container to my local path
same properties, mongoDB 5.0.9
typed java -jar -klov.jar
all started with no issues

Exception using DB2 Wirelistener (NoSQL) from a Spring Boot application

I have set up DB2 as NoSQL storage (following https://www.ibm.com/developerworks/data/library/techarticle/dm-1306nosqlforjson4/index.html). The premise by IBM is that any application talking to MongoDB can switch to DB2 if we add the Wire Listener in between.
The layout is: Client app ----> Wire listener ----> DB2
Wire listener is started with the following command:
wlpListener -start -mongoPort 27017 -userid <user> -password <password> -dbName jsondb -logPath c:/temp/logs -host 10.0.0.6:50000
The solution works fine with a simple Python client:
from pymongo import MongoClient
client = MongoClient('10.0.0.6', 27017)
database = client['jsondb']
coll = database.mycollection
coll.insert_one({"name":"Jerry","age":5})
print(coll.find_one({"name": "Jerry"}))
However, when I use a Spring Boot application designed for MongoDB (using Spring Data JPA) I get the following exception during initialization:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.2)
2021-02-14 11:13:28.629 INFO 11820 --- [ main] c.i.a.n.generator.gen.MainGenerator : Starting MainGenerator using Java 1.8.0 on SP-NIT09160021 with PID 11820 (C:\Users\user\Documents\Workspaces\nosql-poc-db2-wirednosql\target\classes started by user in C:\Users\user\Documents\Workspaces\nosql-poc-db2-wirednosql)
2021-02-14 11:13:28.635 INFO 11820 --- [ main] c.i.a.n.generator.gen.MainGenerator : No active profile set, falling back to default profiles: default
2021-02-14 11:13:29.375 INFO 11820 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
2021-02-14 11:13:29.450 INFO 11820 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 69 ms. Found 3 MongoDB repository interfaces.
2021-02-14 11:13:30.006 INFO 11820 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-02-14 11:13:30.016 INFO 11820 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-02-14 11:13:30.016 INFO 11820 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-02-14 11:13:30.132 INFO 11820 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-02-14 11:13:30.132 INFO 11820 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1414 ms
2021-02-14 11:13:30.304 INFO 11820 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[10.0.0.6:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
2021-02-14 11:13:30.380 INFO 11820 --- [-10.0.0.6:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 10.0.0.6:27017
com.mongodb.MongoException: org.bson.BsonInvalidOperationException: Value expected to be of type INT32 is of unexpected type DOUBLE
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:157) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144) ~[mongodb-driver-core-4.1.1.jar:na]
at java.lang.Thread.run(Thread.java:785) [na:1.8.0-internal]
Caused by: org.bson.BsonInvalidOperationException: Value expected to be of type INT32 is of unexpected type DOUBLE
at org.bson.BsonValue.throwIfInvalidType(BsonValue.java:419) ~[bson-4.1.1.jar:na]
at org.bson.BsonValue.asInt32(BsonValue.java:94) ~[bson-4.1.1.jar:na]
at org.bson.BsonDocument.getInt32(BsonDocument.java:555) ~[bson-4.1.1.jar:na]
at com.mongodb.internal.connection.DescriptionHelper.getMaxWireVersion(DescriptionHelper.java:104) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.DescriptionHelper.createConnectionDescription(DescriptionHelper.java:63) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:117) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:62) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:144) ~[mongodb-driver-core-4.1.1.jar:na]
... 3 common frames omitted
As if there was an incompatibility between the Mongo driver and what the Wire Listener expects.
Versions:
Host system: Windows 10
Database server: DB2/LINUXX8664 11.5.5.0 (using the Docker container from https://hub.docker.com/r/ibmcom/db2 )
IBM DB2 NoSQL WireListener 1.4.0.0 build 1.4.118
IBM DB2 NoSQL JSON 1.1.0.0 build 1.4.249
Java application (1.8 jdk), Spring Boot 2.4.2, [Mongodb.bson, mongodb-driver-core, mongodb-driver-sync] 4.1.1.
This is a bug in the Wire Listener.
The MongoDB driver expects an Int:
private static int getMinWireVersion(final BsonDocument isMasterResult) {
return isMasterResult.getInt32("minWireVersion", new BsonInt32(getDefaultMinWireVersion())).getValue();
}
private static int getMaxWireVersion(final BsonDocument isMasterResult) {
return isMasterResult.getInt32("maxWireVersion", new BsonInt32(getDefaultMaxWireVersion())).getValue();
}
But the Wire Listener is reporting a Double.
I would suggest to get latest IBM DB2 NoSQL WireListener from IBM Support that contains fix of this issue.
If you have no issue in downloading quick fix from github, you can download and use this file: https://github.com/ibmdb/db2drivers/blob/main/db2NoSQLWireListener1.4.119.zip
it contains fix of this issue. Thanks.

Unable to load Spring Boot application running in Docker

I have created a simple Spring Boot v2.1.10 application with Gradle v5.6.4 and trying to run it in Docker v18.09.9, build 1752eb3. The application is working locally, but when I run it in Docker, the webpage doesn't load in the browser. Though, it is starting in the Docker console properly without any error.
Dockerfile content
FROM java:8
EXPOSE 9090:8181
ADD /build/libs/docker-app-0.0.1-SNAPSHOT.jar docker-app-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java","-jar","docker-app-0.0.1-SNAPSHOT.jar"]
Springboot app controller
#RestController
public class Resource {
#GetMapping(value = "/home")
public String home() {
return "<h1>up!!!.....running from docker!!!</h1>";
}
}
Docker run command
:~/java-project/docker-app$ sudo docker run -p 9090:8181 springboot
Docker console output
:~/java-project/docker-app$ sudo docker run -p 9090:8181 springboot
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.10.RELEASE)
2019-11-19 20:38:03.870 INFO 1 --- [ main] com.DockerAppApplication : Starting DockerAppApplication on 93febc16ff7d with PID 1 (/docker-app-0.0.1-SNAPSHOT.jar started by root in /)
2019-11-19 20:38:03.877 INFO 1 --- [ main] com.DockerAppApplication : No active profile set, falling back to default profiles: default
2019-11-19 20:38:06.459 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9090 (http)
2019-11-19 20:38:06.528 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-11-19 20:38:06.528 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-19 20:38:06.669 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-11-19 20:38:06.669 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2642 ms
2019-11-19 20:38:07.012 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-19 20:38:07.333 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9090 (http) with context path ''
2019-11-19 20:38:07.339 INFO 1 --- [ main] com.DockerAppApplication : Started DockerAppApplication in 4.276 seconds (JVM running for 5.029)
NOTE: When I give the same port number(sudo docker run -p 9090:9090 springboot) in run command and in Dockerfile, then it's working properly.
What's different in case of different port numbers in the docker run command?
TL;DR
Change your mapping to -p 8181:9090
You got that the wrong way. The -p 9090:8181 setting will expose the container's port 8181 on the host's port 9090 — assuming that port is not in use. You can effectively use the port 9090 on the host, but the Spring Boot application in the container is not listening on 8181, so you won't get any response back from it.
When you do -p 9090:9090 you are correctly exposing 9090 on the host and the container; again, the Spring Boot application is effectively listening on port 9090, so you are able hit the Spring Boot application and get something back.
In any case, what you are looking for is -p 8181:9090. That will let you use the application on port 8181 in the browser/host, while the Spring Boot application uses 9090.

Can I create a SpringBootApplication in src/test/java?

We want to run some remote tests in Docker. Our idea was to create a SpringBootApplication that will run the tests and report the results and we will have this Application deployed in it's own Docker with it's own JAR.
To make sure that it does not ship with the main code (src/main/java) we want to have this code in src/test/java..
From the documentation this does not appear possible from the Spring-boot-maven-plugin.
So now I am trying to create a test-jar but when I run the Application class I get
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::
2019-01-24 10:38:56.736 INFO 5082 --- [ main] c.h.i.smoketest.SmokeTestApplication : Starting SmokeTestApplication on 1usmfkelly.ad.here.com with PID 5082 (/usr/local/aaa/identity-client/target/identity-client-0.1.0-SNAPSHOT-tests.jar started by fkelly in /usr/local/aaa/identity-client/target)
2019-01-24 10:38:56.738 INFO 5082 --- [ main] c.h.i.smoketest.SmokeTestApplication : No active profile set, falling back to default profiles: default
2019-01-24 10:38:56.777 INFO 5082 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3aeaafa6: startup date [Thu Jan 24 10:38:56 EST 2019]; root of context hierarchy
2019-01-24 10:38:56.852 WARN 5082 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.here.identity.smoketest.SmokeTestApplication]; nested exception is java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
2019-01-24 10:38:56.860 ERROR 5082 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.here.identity.smoketest.SmokeTestApplication]; nested exception is java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:558) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:187) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:92) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at com.here.identity.smoketest.SmokeTestApplication.main(SmokeTestApplication.java:12) [identity-client-0.1.0-SNAPSHOT-tests.jar:na]
Caused by: java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
at org.springframework.util.Assert.notEmpty(Assert.java:277) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getCandidateConfigurations(AutoConfigurationImportSelector.java:153) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:95) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:549) ~[identity-client-0.1.0-SNAPSHOT-jar-with-dependencies.jar:na]
... 14 common frames omitted
Is there any documentation on how to package a SpringBoot Application without the maven plugin?
It turns out all I needed to do as add a file to my source repo
src/main/resources/META-INF/spring.factories
You can grab a copy from here
All thanks to the answer from another post related the question

Spring Boot war fails to deploy properly on Resin server

My projects relies on Spring Boot to build standalone executable jar files. It works great for internal testing. However, once we are ready to deployment it to our development environment, applications need to be in a war file so it can be deployed to our Resin server.
So I followed the guide (http://spring.io/guides/gs/convert-jar-to-war/) and did the conversion. Then I deployed the war application to a local Resin server and a long series of exceptions occurred.
Long story short, I ended up creating a simple hello world REST service using Spring Boot that builds as war and deployed it to Resin. The test application is at (https://github.com/ChrisZhong/spring-boot-war-sample). Similar problems occurred with the test application. But, the same test war deployed to Tomcat 7 without any problems and worked as intended. The following log is from Resin.
[14-03-12 17:06:25.414] {resin-34} WebApp[production/webapp/default/spring-boot-war-sample-1.1.1,STARTING] Spring WebApplicationInitializers detected on classpath: [hello.WebXml#62da57c9]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.0.RC4)
2014-03-12 17:06:26.765 INFO 4024 --- [ resin-34] o.s.boot.SpringApplication : Starting application on CHRIS-DESKTOP with PID 4024 (C:\resin-4.0.38\webapps\spring-boot-war-sample-
1.1.1\WEB-INF\lib\spring-boot-1.0.0.RC4.jar started by czhong)
2014-03-12 17:06:26.919 INFO 4024 --- [ resin-34] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3
93d3e1d: startup date [Wed Mar 12 17:06:26 CDT 2014]; root of context hierarchy
2014-03-12 17:06:29.034 INFO 4024 --- [ resin-34] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[14-03-12 17:06:29.135] {resin-34} HV000001: Hibernate Validator 4.3.0.Final
2014-03-12 17:06:29.414 INFO 4024 --- [ resin-34] com.caucho.server.webapp.WebApp : WebApp[production/webapp/default/spring-boot-war-sample-1.1.1,STARTING] Initializing Spring embedded
WebApplicationContext
[14-03-12 17:06:29.415] {resin-34} WebApp[production/webapp/default/spring-boot-war-sample-1.1.1,STARTING] Initializing Spring embedded WebApplicationContext
2014-03-12 17:06:29.416 INFO 4024 --- [ resin-34] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2497 ms
2014-03-12 17:06:31.500 INFO 4024 --- [ resin-34] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
com.caucho.config.ConfigException: Custom bean class 'org.springframework.boot.context.web.ErrorPageFilter' is not public. Bean classes must be public, concrete, and have a zero-argument constructor.
at com.caucho.config.Config.checkCanInstantiate(Config.java:532)
at com.caucho.config.Config.validate(Config.java:561)
at com.caucho.server.dispatch.FilterConfigImpl.setFilterClass(FilterConfigImpl.java:105)
at com.caucho.server.webapp.WebApp.addFilter(WebApp.java:1457)
at com.caucho.server.webapp.WebApp.addFilter(WebApp.java:1439)
at org.springframework.boot.context.embedded.FilterRegistrationBean.onStartup(FilterRegistrationBean.java:233)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:214)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:619)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:130)
at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89)
at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at com.caucho.server.webapp.WebApp.callInitializer(WebApp.java:3494)
at com.caucho.server.webapp.WebApp.callInitializers(WebApp.java:3462)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java:3687)
at com.caucho.server.webapp.WebApp.access$400(WebApp.java:207)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebApp.java:5231)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
2014-03-12 17:06:31.518 INFO 4024 --- [ resin-34] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.
1.1/WEB-INF/classes/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/aopalliance-1.0.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/commo
ns-logging-1.1.3.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/jackson-annotations-2.3.0.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-I
NF/lib/jackson-core-2.3.1.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/jackson-databind-2.3.1.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1
/WEB-INF/lib/jcl-over-slf4j-1.7.6.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/jul-to-slf4j-1.7.6.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1
.1.1/WEB-INF/lib/log4j-over-slf4j-1.7.6.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/logback-classic-1.1.1.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war
-sample-1.1.1/WEB-INF/lib/logback-core-1.1.1.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/slf4j-api-1.7.6.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-
sample-1.1.1/WEB-INF/lib/snakeyaml-1.13.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-aop-4.0.2.RELEASE.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-
war-sample-1.1.1/WEB-INF/lib/spring-beans-4.0.2.RELEASE.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-boot-1.0.0.RC4.jar!/, jar:file:/C:/resin-4.0.38/webapps
/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-boot-autoconfigure-1.0.0.RC4.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-boot-starter-1.0.0.RC4.jar!/, jar
:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-boot-starter-logging-1.0.0.RC4.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-b
oot-starter-tomcat-1.0.0.RC4.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-boot-starter-web-1.0.0.RC4.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-wa
r-sample-1.1.1/WEB-INF/lib/spring-context-4.0.2.RELEASE.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-core-4.0.2.RELEASE.jar!/, jar:file:/C:/resin-4.0.38/web
apps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-expression-4.0.2.RELEASE.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-web-4.0.2.RELEASE.jar!/, jar:file
:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/spring-webmvc-4.0.2.RELEASE.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/tomcat-embed-core-7.0.5
2.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/tomcat-embed-el-7.0.52.jar!/, jar:file:/C:/resin-4.0.38/webapps/spring-boot-war-sample-1.1.1/WEB-INF/lib/tomcat-embe
d-logging-juli-7.0.52.jar!/]
2014-03-12 17:06:31.523 INFO 4024 --- [ resin-34] com.caucho.server.webapp.WebApp : WebApp[production/webapp/default/spring-boot-war-sample-1.1.1] fail
[14-03-12 17:06:31.523] {resin-34} WebApp[production/webapp/default/spring-boot-war-sample-1.1.1] fail
2014-03-12 17:06:31.535 WARN 4024 --- [ main] com.caucho.server.webapp.WebApp : java.lang.IllegalStateException: Registration is null. Was something already registered for name=[er
rorPageFilter]?
java.lang.IllegalStateException: Registration is null. Was something already registered for name=[errorPageFilter]?
at org.springframework.util.Assert.state(Assert.java:385)
at org.springframework.boot.context.embedded.RegistrationBean.configure(RegistrationBean.java:107)
at org.springframework.boot.context.embedded.FilterRegistrationBean.configure(FilterRegistrationBean.java:241)
at org.springframework.boot.context.embedded.FilterRegistrationBean.onStartup(FilterRegistrationBean.java:233)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:214)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:619)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:130)
at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89)
at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at com.caucho.server.webapp.WebApp.callInitializer(WebApp.java:3494)
at com.caucho.server.webapp.WebApp.callInitializers(WebApp.java:3462)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java:3687)
at com.caucho.server.webapp.WebApp.access$400(WebApp.java:207)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebApp.java:5231)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
[14-03-12 17:06:31.541] {main} java.lang.IllegalStateException: Registration is null. Was something already registered for name=[errorPageFilter]?
at org.springframework.util.Assert.state(Assert.java:385)
at org.springframework.boot.context.embedded.RegistrationBean.configure(RegistrationBean.java:107)
at org.springframework.boot.context.embedded.FilterRegistrationBean.configure(FilterRegistrationBean.java:241)
at org.springframework.boot.context.embedded.FilterRegistrationBean.onStartup(FilterRegistrationBean.java:233)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:214)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:619)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:130)
at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89)
at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at com.caucho.server.webapp.WebApp.callInitializer(WebApp.java:3494)
at com.caucho.server.webapp.WebApp.callInitializers(WebApp.java:3462)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java:3687)
at com.caucho.server.webapp.WebApp.access$400(WebApp.java:207)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebApp.java:5231)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
[14-03-12 17:06:31.543] {main} Host[production/host/default] active
[14-03-12 17:06:31.543] {main} ServletService[id=app-0,cluster=app] active
[14-03-12 17:06:31.543] {main}
[14-03-12 17:06:31.544] {main} http listening to *:8080
[14-03-12 17:06:32.294] {main} https listening to *:8443
[14-03-12 17:06:32.313] {main}
[14-03-12 17:06:32.327] {main} Resin[id=app-0] started in 17193ms
2014-03-12 17:08:31.542 INFO 4024 --- [ resin-29] com.caucho.server.webapp.WebApp : WebApp[production/webapp/default/spring-boot-war-sample-1.1.1] stopping
I am told by a colleague who has some experience with Resin that there is a problem with loading the jar files as indicated by the ! at the end of each jar file.
Please see bug reference: http://bugs.caucho.com/view.php?id=5701
You can add yourself as a 'watch' on this bug to be notified on progress.
For some reason Resin enforces that filters (programmatically?) added to the context must have a public modifier. The ErrorPageFilter in Spring Boot is package protected and as such fails that check (check the sources for both Resin and Spring Boot).
I can imagine this check for Filters that are added through the ServletContext.addFilter(String, Class) method. Not for the method ServletContext.addFilter(String, Filter). The latter is used by Spring Boot to register the filters.
I would consider this a bug in Resin.
Looks like this was fixed in Resin 4.0.42, on 2014-11-03.
I had a similar problem and was able to solve it by removing the following jars that are part of the resin distribution:
/webapp-jars/hibernate-validator-4.*.jar
/lib/validation-api-1.*.jar
There is also: /webapp-jars/jboss-logging-3.*.jar that may cause problems.
Those files are not used by resin itself, according to Caucho. So you can remove them and rely on the libraries on your WAR.

Categories