I'm trying to create a camunda application with springboot, but i need to use Spin Json Node, and when i add the dependencies to the pom.xml it gives me this error when i run project as java application:
org.springframework.context.ApplicationContextException: Unable to
start embedded container; nested exception is
org.springframework.boot.context.embedded.EmbeddedServletContainerException:
Unable to start embedded Tomcat at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
br.com.ntconsult.camundaProject.app.CamundaSpringbootApplication.main(CamundaSpringbootApplication.java:9)
[classes/:na] Caused by:
org.springframework.boot.context.embedded.EmbeddedServletContainerException:
Unable to start embedded Tomcat at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:123)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.(TomcatEmbeddedServletContainer.java:84)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:554)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:179)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] ... 8 common frames
omitted Caused by: org.apache.catalina.LifecycleException: Failed to
start component [StandardServer[-1]] at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.apache.catalina.startup.Tomcat.start(Tomcat.java:367)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:99)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] ... 13 common frames
omitted Caused by: org.apache.catalina.LifecycleException: Failed to
start component [StandardService[Tomcat]] at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
~[tomcat-embed-core-8.5.20.jar:8.5.20] ... 15 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start
component [StandardEngine[Tomcat]] at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
~[tomcat-embed-core-8.5.20.jar:8.5.20] ... 17 common frames omitted
Caused by: org.apache.catalina.LifecycleException: A child container
failed during start at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
~[tomcat-embed-core-8.5.20.jar:8.5.20] at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
~[tomcat-embed-core-8.5.20.jar:8.5.20] ... 19 common frames omitted
If i remove the camunda-bom from the dependencyManagement in pom.xml everything works, but i can't use things like spin json node.
I created a simple project with this error in github: https://github.com/jradesenv/camunda-springboot
The project you provided on GitHub works perfectly fine on my end and runs as expected. You cut off part of the stacktrace, so I cannot see the root cause. Something stops Tomcat from starting - probably an already used port?
PS: We released a preview of the upcoming Spring Boot archetype yesterday: https://github.com/camunda/camunda-archetypes/tree/master/camunda-archetype-spring-boot/ - might be a good starting point too.
FYI my console (I just pulled the code and run it):
____ _ ____ ____ __ __
/ ___| __ _ _ __ ___ _ _ _ __ __| | __ _ | __ )| _ \| \/ |
| | / _` | '_ ` _ \| | | | '_ \ / _` |/ _` | | _ \| |_) | |\/| |
| |__| (_| | | | | | | |_| | | | | (_| | (_| | | |_) | __/| | | |
\____/\__,_|_| |_| |_|\__,_|_| |_|\__,_|\__,_| |____/|_| |_| |_|
Spring-Boot: (v1.5.7.RELEASE)
Camunda BPM: (v7.8.0-alpha6)
Camunda BPM Spring Boot Starter: (v2.3.0-alpha1)
2017-11-22 09:12:24.931 INFO 13404 --- [ main] b.c.n.c.a.CamundaSpringbootApplication : Starting CamundaSpringbootApplication on LAPTOP-LFHA6NM6 with PID 13404 (C:\Temp\camunda-springboot-support\target\classes started by ruecker in C:\Temp\camunda-springboot-support)
2017-11-22 09:12:24.954 INFO 13404 --- [ main] b.c.n.c.a.CamundaSpringbootApplication : No active profile set, falling back to default profiles: default
2017-11-22 09:12:25.052 INFO 13404 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#37918c79: startup date [Wed Nov 22 09:12:25 CET 2017]; root of context hierarchy
2017-11-22 09:12:26.624 INFO 13404 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-11-22 09:12:27.830 INFO 13404 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-11-22 09:12:27.854 INFO 13404 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-11-22 09:12:27.856 INFO 13404 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.20
2017-11-22 09:12:28.079 INFO 13404 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-11-22 09:12:28.080 INFO 13404 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3033 ms
2017-11-22 09:12:28.522 INFO 13404 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-11-22 09:12:28.567 INFO 13404 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-11-22 09:12:28.568 INFO 13404 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-11-22 09:12:28.568 INFO 13404 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-11-22 09:12:28.568 INFO 13404 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-11-22 09:12:29.118 INFO 13404 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#37918c79: startup date [Wed Nov 22 09:12:25 CET 2017]; root of context hierarchy
2017-11-22 09:12:29.232 INFO 13404 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-11-22 09:12:29.234 INFO 13404 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-11-22 09:12:29.264 INFO 13404 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2017-11-22 09:12:29.287 INFO 13404 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-22 09:12:29.288 INFO 13404 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-22 09:12:29.288 INFO 13404 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/lib/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-22 09:12:29.288 INFO 13404 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/api/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-22 09:12:29.289 INFO 13404 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/app/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-22 09:12:29.359 INFO 13404 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-22 09:12:29.870 INFO 13404 --- [ main] org.camunda.bpm.spring.boot : STARTER-SB040 Setting up jobExecutor with corePoolSize=3, maxPoolSize:10
2017-11-22 09:12:29.891 INFO 13404 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'camundaTaskExecutor'
2017-11-22 09:12:30.101 INFO 13404 --- [ main] org.camunda.bpm.engine.cfg : ENGINE-12003 Plugin 'CompositeProcessEnginePlugin[genericPropertiesConfiguration, camundaProcessEngineConfiguration, camundaDatasourceConfiguration, camundaJobConfiguration, camundaHistoryConfiguration, camundaMetricsConfiguration, camundaAuthorizationConfiguration, camundaDeploymentConfiguration, failedJobConfiguration]' activated on process engine 'default'
2017-11-22 09:12:32.841 INFO 13404 --- [ main] org.camunda.bpm.spring.boot : STARTER-SB021 Auto-Deploying resources: []
2017-11-22 09:12:36.911 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03016 Performing database operation 'create' on component 'engine' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql'
2017-11-22 09:12:36.965 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03016 Performing database operation 'create' on component 'history' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.history.sql'
2017-11-22 09:12:36.993 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03016 Performing database operation 'create' on component 'identity' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.identity.sql'
2017-11-22 09:12:37.024 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03016 Performing database operation 'create' on component 'case.engine' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.case.engine.sql'
2017-11-22 09:12:37.037 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03016 Performing database operation 'create' on component 'case.history' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.case.history.sql'
2017-11-22 09:12:37.045 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03016 Performing database operation 'create' on component 'decision.engine' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.decision.engine.sql'
2017-11-22 09:12:37.068 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03016 Performing database operation 'create' on component 'decision.history' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.decision.history.sql'
2017-11-22 09:12:37.159 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03067 No history level property found in database
2017-11-22 09:12:37.159 INFO 13404 --- [ main] org.camunda.bpm.engine.persistence : ENGINE-03065 Creating historyLevel property in database for level: HistoryLevelFull(name=full, id=3)
2017-11-22 09:12:37.171 INFO 13404 --- [ main] org.camunda.bpm.engine : ENGINE-00001 Process Engine default created.
2017-11-22 09:12:37.370 INFO 13404 --- [ main] o.c.b.s.b.s.w.f.LazyInitRegistration : lazy initialized org.camunda.bpm.spring.boot.starter.webapp.filter.LazyProcessEnginesFilter#4e25e00f
2017-11-22 09:12:37.470 INFO 13404 --- [ main] o.c.b.s.b.s.w.f.LazyInitRegistration : lazy initialized org.camunda.bpm.spring.boot.starter.webapp.filter.LazySecurityFilter#2097d719
2017-11-22 09:12:37.808 INFO 13404 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-11-22 09:12:37.934 INFO 13404 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-11-22 09:12:37.944 INFO 13404 --- [ main] org.camunda.bpm.engine.jobexecutor : ENGINE-14014 Starting up the JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor].
2017-11-22 09:12:37.947 INFO 13404 --- [ main] b.c.n.c.a.CamundaSpringbootApplication : Started CamundaSpringbootApplication in 13.493 seconds (JVM running for 14.344)
2017-11-22 09:12:37.949 INFO 13404 --- [ingJobExecutor]] org.camunda.bpm.engine.jobexecutor : ENGINE-14018 JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor] starting to acquire jobs
Related
I have a JUnit Test that starts my spring boot appcliation (Application.java).
#RunWith(SpringRunner.class)
#SpringBootTest(classes = Application.class)
public class AppclaitionTest {
#Test
public void contextLoads(){
Application.main(new String[]{});
}
}
If I run the JUnit test, Application is successfully starting up, but not accessible through url
Application Logs:
2017-06-16 12:18:07.918 INFO 207028 --- [ main] com.chandu.test.AppclaitionTest : Started AppclaitionTest in 1.927 seconds (JVM running for 2.458)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2017-06-16 12:18:08.012 INFO 207028 --- [ main] com.test.app.Application : Starting Application on IVL-WS39 with PID 207028 (started by Bhanuchandar.Challa in D:\Jars\SpringJDBCMySQL)
2017-06-16 12:18:08.012 INFO 207028 --- [ main] com.test.app.Application : No active profile set, falling back to default profiles: default
2017-06-16 12:18:08.012 INFO 207028 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3f1ddac2: startup date [Fri Jun 16 12:18:08 IST 2017]; root of context hierarchy
2017-06-16 12:18:08.402 INFO 207028 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-06-16 12:18:08.417 INFO 207028 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-06-16 12:18:08.417 INFO 207028 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.14
2017-06-16 12:18:08.526 INFO 207028 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-06-16 12:18:08.526 INFO 207028 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 514 ms
2017-06-16 12:18:08.636 INFO 207028 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-06-16 12:18:08.636 INFO 207028 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-06-16 12:18:08.636 INFO 207028 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-06-16 12:18:08.636 INFO 207028 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-06-16 12:18:08.636 INFO 207028 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-06-16 12:18:08.933 INFO 207028 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3f1ddac2: startup date [Fri Jun 16 12:18:08 IST 2017]; root of context hierarchy
2017-06-16 12:18:08.933 INFO 207028 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/getRowCount]}" onto public java.lang.Integer com.test.app.controller.TestController.getRowCount(java.lang.String)
2017-06-16 12:18:08.949 INFO 207028 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/process]}" onto public java.lang.String com.test.app.controller.TestController.processRequest()
2017-06-16 12:18:08.949 INFO 207028 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-06-16 12:18:08.949 INFO 207028 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-06-16 12:18:08.964 INFO 207028 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-16 12:18:08.964 INFO 207028 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-16 12:18:08.980 INFO 207028 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-16 12:18:09.105 INFO 207028 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-06-16 12:18:09.151 INFO 207028 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-06-16 12:18:09.151 INFO 207028 --- [ main] com.test.app.Application : Started Application in 1.186 seconds (JVM running for 3.689)
When I tried to access the application through url 'http://localhost:8080/process', It says Site can't be reached.
Why would you do such thing? This should be a unit test and the flow of the test should be the following:
Start the application -> Call your controller endpoint -> assert that a specific text/element on that page is present -> Shut down the application.
Start the application : #RunWith(SpringRunner.class) doing this for you, no need to start is manually.
Shut down the application : At the end of your test class Spring boot does this for you (That's why you cant access your app in the browser)
For further help please see my answer here: How to test (rest) enpoints
By default, in #SpringBootTest annotation the field webEnvironment is set to WebEnvironment.MOCK
Therefore, Tomcat does not start.
You can set this field to WebEnvironment.DEFINED_PORT/RANDOM_PORT.
After this, Tomcat will be running.
#SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class MyTestClass {
...
...
...
}
I have created a spring boot application. When I deploy the jar file in embedded tomcat and called the test API it gives 404 error. May I know why it is giving the error?
Main class
package com.telematics.fleet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
#SpringBootApplication
#ComponentScan(basePackages={"com.telematics.fleet.controller", "com.telematics.fleet.repository",
"com.telematics.fleet.service","com.telematics.fleet.utility"})
public class TelematicsFleetApplication
{
public static void main(String[] args)
{
SpringApplication.run(TelematicsFleetApplication.class, args);
}
}
Controller class
package com.telematics.fleet.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
#RestController
#RequestMapping("/app")
public class FleetAppController
{
#RequestMapping(value="/test", method=RequestMethod.GET)
public String test()
{
System.out.println("Called test API");
return "Success";
}
}
Console
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/dell/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/dell/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
The Class-Path manifest attribute in C:\Users\dell\.m2\repository\com\mchange\c3p0\0.9.5.2\c3p0-0.9.5.2.jar referenced one or more files that do not exist: file:/C:/Users/dell/.m2/repository/com/mchange/c3p0/0.9.5.2/mchange-commons-java-0.2.11.jar
08:22:29.726 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
08:22:29.738 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
08:22:29.739 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/Malya/Git_Homes/telematics-fleet/target/classes/]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.0.RELEASE)
2018-03-22 08:22:31.881 INFO 252 --- [ restartedMain] c.t.fleet.TelematicsFleetApplication : Starting TelematicsFleetApplication on admin with PID 252 (C:\Malya\Git_Homes\telematics-fleet\target\classes started by dell in C:\Malya\Git_Homes\telematics-fleet)
2018-03-22 08:22:31.889 INFO 252 --- [ restartedMain] c.t.fleet.TelematicsFleetApplication : No active profile set, falling back to default profiles: default
2018-03-22 08:22:32.280 INFO 252 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#795b4bba: startup date [Thu Mar 22 08:22:32 IST 2018]; root of context hierarchy
2018-03-22 08:22:47.336 INFO 252 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8c439cf8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-03-22 08:22:51.865 INFO 252 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-03-22 08:22:52.015 INFO 252 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-03-22 08:22:52.016 INFO 252 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.28
2018-03-22 08:22:52.076 INFO 252 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_162\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_162/bin/server;C:/Program Files/Java/jre1.8.0_162/bin;C:/Program Files/Java/jre1.8.0_162/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\bin\;C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\eclipse\jre\bin\;C:\Program Files (x86)\sbt\bin;C:\modeltech64_10.2c\win64;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\myrWork\ztex-160513\sp3anTest\aes220_win_files_160502-1\aes220_win_files\DLL;C:\myrWork\ztex-160513\sp3anTest\aes220_win_files_160502-1\aes220_win_files\libs\MS32;C:\myrWork\eMMCModel\ss_emmc\eMMC_vip\sdio\rlm\win_64;C:\workspace\eMMCModel\ss_emmc\eMMC_vip\sdio\sv\examples\sim;C:\Malya\tool\sts-bundle\sts-3.9.2.RELEASE;;.]
2018-03-22 08:22:52.790 INFO 252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-03-22 08:22:52.791 INFO 252 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 20525 ms
2018-03-22 08:23:00.377 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-03-22 08:23:00.407 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-03-22 08:23:00.408 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-03-22 08:23:00.409 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-03-22 08:23:00.410 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-03-22 08:23:00.411 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2018-03-22 08:23:00.412 INFO 252 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2018-03-22 08:23:01.619 INFO 252 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-03-22 08:23:03.674 INFO 252 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-03-22 08:23:04.327 INFO 252 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-03-22 08:23:04.469 INFO 252 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-03-22 08:23:05.269 INFO 252 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.14.Final}
2018-03-22 08:23:05.284 INFO 252 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-03-22 08:23:05.721 INFO 252 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-03-22 08:23:08.342 INFO 252 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2018-03-22 08:23:16.185 INFO 252 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-03-22 08:23:34.747 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#795b4bba: startup date [Thu Mar 22 08:22:32 IST 2018]; root of context hierarchy
2018-03-22 08:23:36.160 WARN 252 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2018-03-22 08:23:37.239 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/app/test],methods=[GET]}" onto public java.lang.String com.telematics.fleet.controller.FleetAppController.test()
2018-03-22 08:23:37.380 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-03-22 08:23:37.383 INFO 252 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-03-22 08:23:38.325 INFO 252 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-22 08:23:38.326 INFO 252 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-22 08:23:39.279 INFO 252 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-22 08:23:40.156 WARN 252 --- [ restartedMain] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2018-03-22 08:23:46.453 INFO 252 --- [ restartedMain] org.quartz.impl.StdSchedulerFactory : Using default implementation for ThreadExecutor
2018-03-22 08:23:46.581 INFO 252 --- [ restartedMain] org.quartz.core.SchedulerSignalerImpl : Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2018-03-22 08:23:46.582 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : Quartz Scheduler v.2.3.0 created.
2018-03-22 08:23:46.588 INFO 252 --- [ restartedMain] org.quartz.simpl.RAMJobStore : RAMJobStore initialized.
2018-03-22 08:23:46.593 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : Scheduler meta-data: Quartz Scheduler (v2.3.0) 'quartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
2018-03-22 08:23:46.595 INFO 252 --- [ restartedMain] org.quartz.impl.StdSchedulerFactory : Quartz scheduler 'quartzScheduler' initialized from an externally provided properties instance.
2018-03-22 08:23:46.595 INFO 252 --- [ restartedMain] org.quartz.impl.StdSchedulerFactory : Quartz scheduler version: 2.3.0
2018-03-22 08:23:46.596 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : JobFactory set to: org.springframework.boot.autoconfigure.quartz.AutowireCapableBeanJobFactory#629a27c7
2018-03-22 08:23:47.067 INFO 252 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-03-22 08:23:47.271 INFO 252 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-03-22 08:23:47.274 INFO 252 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-03-22 08:23:47.279 INFO 252 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-03-22 08:23:48.079 INFO 252 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-03-22 08:23:48.086 INFO 252 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-03-22 08:23:48.130 INFO 252 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-03-22 08:23:48.207 INFO 252 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2018-03-22 08:23:48.208 INFO 252 --- [ restartedMain] o.s.s.quartz.SchedulerFactoryBean : Starting Quartz Scheduler now
2018-03-22 08:23:48.209 INFO 252 --- [ restartedMain] org.quartz.core.QuartzScheduler : Scheduler quartzScheduler_$_NON_CLUSTERED started.
2018-03-22 08:23:48.464 INFO 252 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-03-22 08:23:48.488 INFO 252 --- [ restartedMain] c.t.fleet.TelematicsFleetApplication : Started TelematicsFleetApplication in 78.687 seconds (JVM running for 81.635)
2018-03-22 08:24:55.653 INFO 252 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-03-22 08:24:55.654 INFO 252 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-03-22 08:24:55.755 INFO 252 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 101 ms
POSTMAN Response
{
"timestamp": "2018-03-22T03:06:40.138+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/telematics-fleet/app/test"
}
Properties file
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
spring.datasource.url=jdbc:mysql://localhost:3306/db_example
spring.datasource.username=springuser
spring.datasource.password=ThePassword
In the console server is running fine but i am getting 404 error when trying to access the api's
There are two important points to keep in mind while deploying a SpringBoot application to a container :
1.Starting point of application: If you are deploying a SprinBoot application to any servlet container(like Tomcat) your starter class must extend SpringBootServletInitializer, so that the container can find the starting point of your application
#SpringBootApplication
public class TelematicsFleetApplication extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(TelematicsFleetApplication .class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(TelematicsFleetApplication .class, args);
}
}
After successful deployment on Tomcat you should prefix your application name before all resource URLs.
Example : localhost:8080/Application_Name/app/test
Extra tip: After Spring 4.3 you can replace #RequestMapping(method = RequestMethod.GET) by #GetMapping
Example : #Getmapping("/test")
You should change your controller to:
#RestController
#RequestMapping("/telematics-fleet/app")
public class FleetAppController
{
#RequestMapping(value="/test", method=RequestMethod.GET)
public String test()
{
System.out.println("Called test API");
return "Success";
}
}
The current call does not point to correct resource.
Note the log states that your server was started and pointing to / as root and not /telematics-fleet.
The other thing you could do is keep your controller as it is and add a new property in application.properties as:
server.contextPath=/telematics-fleet
Your postman requesting the path--- "path": "/telematics-fleet/app/test" but your controller the path should be "path": "/app/test" . So there is a missmatch.
Try removing context
http://localhost:8080/app/test
If you running it using spring boot plugin, and haven't configured context in meta file, spring boot run on default context
The project name is not automatically added to the context path in Spring Boot, it is / by default. If you do want to add it, set the following in your .properties file:
server.servlet.contextPath=/telematics-fleet
Or for pre-2.0 versions of Spring Boot:
server.contextPath=/telematics-fleet
If not, then just remove that part from your request, hitting /app/test directly.
In my project, it was because of the missing dependency in the pom.
spring-boot-starter-web
Look for Servlet dispatcherServlet mapped to [/] in the logs, if it is not there, it means the required dependencies are missing
Had a similar issue. For me, the project name in Eclipse was different from the one that was mentioned in the application.properties.
renaming the eclipse project to the same as the one in application.properties solved the issue
In my Spring-boot application, I was trying to use MongoDB which is in AWS instance. For that, I used the host and port number of the AWS Instance to connect it through Spring-boot
application.properties
server.port=8186
# MONGODB (MongoProperties)
#spring.data.mongodb.host=localhost
#spring.data.mongodb.port=27018
#spring.data.mongodb.database=educharge
spring.data.mongodb.uri=mongodb://52.15.64.17:27017/educharge
spring.data.mongodb.database=educharge
when I run the application the program connect to localhost instead of host( 52.15.64.17)
Console output
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.6.RELEASE)
2017-09-16 03:10:08.402 INFO 9536 --- [ restartedMain] c.E.E.EduchargeApiApplication : Starting EduchargeApiApplication on Sankar with PID 9536 (G:\EduchargeAPI\EduchargeAPI\bin started by R Dinesh Kumar in G:\EduchargeAPI\EduchargeAPI)
2017-09-16 03:10:08.402 INFO 9536 --- [ restartedMain] c.E.E.EduchargeApiApplication : No active profile set, falling back to default profiles: default
2017-09-16 03:10:08.408 INFO 9536 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#53b63b22: startup date [Sat Sep 16 03:10:08 IST 2017]; root of context hierarchy
2017-09-16 03:10:09.716 INFO 9536 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8186 (http)
2017-09-16 03:10:09.718 INFO 9536 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-09-16 03:10:09.718 INFO 9536 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.16
2017-09-16 03:10:09.750 INFO 9536 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-09-16 03:10:09.750 INFO 9536 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1342 ms
2017-09-16 03:10:09.816 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-09-16 03:10:09.826 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2017-09-16 03:10:09.827 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-09-16 03:10:09.827 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-09-16 03:10:09.827 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-09-16 03:10:09.827 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-09-16 03:10:09.827 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-09-16 03:10:09.827 INFO 9536 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-09-16 03:10:09.866 INFO 9536 --- [ restartedMain] org.mongodb.driver.cluster : Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=50}
2017-09-16 03:10:10.071 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#53b63b22: startup date [Sat Sep 16 03:10:08 IST 2017]; root of context hierarchy
2017-09-16 03:10:10.088 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Posts/showPost/{postid}],methods=[GET]}" onto public com.Educharge.EduchargeAPI.Model.Post com.Educharge.EduchargeAPI.Controller.PostController.showPost(int)
2017-09-16 03:10:10.089 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Posts/{postid}/like/{userid}],methods=[GET]}" onto public com.Educharge.EduchargeAPI.Model.Post com.Educharge.EduchargeAPI.Controller.PostController.likePost(int,int)
2017-09-16 03:10:10.090 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Posts/editPost],methods=[PUT]}" onto public com.Educharge.EduchargeAPI.Model.Post com.Educharge.EduchargeAPI.Controller.PostController.editPost(com.Educharge.EduchargeAPI.Model.Post)
2017-09-16 03:10:10.090 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Posts/{postid}/comment/{userid}],methods=[PUT]}" onto public com.Educharge.EduchargeAPI.Model.Post com.Educharge.EduchargeAPI.Controller.PostController.commentPost(java.lang.String,int,int)
2017-09-16 03:10:10.090 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Posts/createPost],methods=[POST]}" onto public com.Educharge.EduchargeAPI.Model.Post com.Educharge.EduchargeAPI.Controller.PostController.createPost(com.Educharge.EduchargeAPI.Model.Post)
2017-09-16 03:10:10.090 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Posts/deletePost/{postid}],methods=[DELETE]}" onto public com.Educharge.EduchargeAPI.Model.Post com.Educharge.EduchargeAPI.Controller.PostController.deletePost(int)
2017-09-16 03:10:10.091 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Posts/{postid}/dislike/{userid}],methods=[GET]}" onto public com.Educharge.EduchargeAPI.Model.Post com.Educharge.EduchargeAPI.Controller.PostController.dislikePost(int,int)
2017-09-16 03:10:10.096 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Profiles/showProfile/{userid}],methods=[GET]}" onto public com.Educharge.EduchargeAPI.Model.Profile com.Educharge.EduchargeAPI.Controller.ProfileController.showProfile(int)
2017-09-16 03:10:10.097 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Profiles/createProfile],methods=[POST]}" onto public com.Educharge.EduchargeAPI.Model.Profile com.Educharge.EduchargeAPI.Controller.ProfileController.addProfile(com.Educharge.EduchargeAPI.Model.Profile)
2017-09-16 03:10:10.097 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Profiles/editProfile],methods=[PUT]}" onto public com.Educharge.EduchargeAPI.Model.Profile com.Educharge.EduchargeAPI.Controller.ProfileController.editProfile(com.Educharge.EduchargeAPI.Model.Profile)
2017-09-16 03:10:10.097 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/Profiles/deleteProfile/{userid}],methods=[DELETE]}" onto public com.Educharge.EduchargeAPI.Model.Profile com.Educharge.EduchargeAPI.Controller.ProfileController.deleteProfile(int)
2017-09-16 03:10:10.101 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-09-16 03:10:10.102 INFO 9536 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-09-16 03:10:10.118 INFO 9536 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-09-16 03:10:10.118 INFO 9536 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-09-16 03:10:10.141 INFO 9536 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-09-16 03:10:10.319 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.321 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2017-09-16 03:10:10.322 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.323 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.324 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2017-09-16 03:10:10.324 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.325 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.325 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.326 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2017-09-16 03:10:10.329 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2017-09-16 03:10:10.330 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2017-09-16 03:10:10.330 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.332 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2017-09-16 03:10:10.333 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2017-09-16 03:10:10.333 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.334 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.336 INFO 9536 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-09-16 03:10:10.367 INFO 9536 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2017-09-16 03:10:10.434 INFO 9536 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-09-16 03:10:10.443 INFO 9536 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2017-09-16 03:10:10.499 INFO 9536 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8186 (http)
2017-09-16 03:10:10.501 INFO 9536 --- [ restartedMain] c.E.E.EduchargeApiApplication : Started EduchargeApiApplication in 2.166 seconds (JVM running for 4203.36)
2017-09-16 03:10:10.873 INFO 9536 --- [127.0.0.1:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 127.0.0.1:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.4.2.jar:na]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongodb-driver-core-3.4.2.jar:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.2.jar:na]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_144]
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_144]
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_144]
at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_144]
at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.8.0_144]
at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_144]
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongodb-driver-core-3.4.2.jar:na]
at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.4.2.jar:na]
... 3 common frames omitted
and prints the Exception opening socket
Is there any other way to connect the remote MongoDB host server ?
If you are connecting to your remote Mongodb instance, have you checked 52.15.64.17 is pingable for you?
Based on Connecting to a MongoDB database:
spring.data.mongodb.uri=mongodb://user:secret#mongo1.example.com:12345,mongo2.example.com:23456/test
Alternatively, You can mute the Springboot AutoConfiguration for mongoDB:
#SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})
I had a similar problem using MongoDB and Embedded MongoDB, each one configured in a different spring profile.
In my case, the Spring was ignoring the MongoDB URI from my "production" profile and it always started the embedded mongoDb.
The problem was the EmbeddedMongoAutoConfiguration enabled. So, you can disable the Embedded MongoDB in a specific profile using the properties:
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration
I have a spring boot app which is basically a soap server and publishing a web service.
When I am running the app on local it's publishing the wsdl at - http://localhost:9999/service/hello-world?wsdl, and as soon as I try to push it on Local Cloudfoundry, it fails at time of starting the app stating the reason:
Caused by: java.net.SocketException: Permission denied
manifest.yml of the app looks like:
---
applications:
- name: soap-server
memory: 1G
random-route: true
path: target/soap-server-0.0.1-SNAPSHOT.jar
And modified SoapServerApplication for Local Cloudfoundry deployment looks like:
#SpringBootApplication
public class SoapServerApplication implements CommandLineRunner {
#Override
public void run(String... args) throws Exception {
Endpoint.publish("http://soap-server.local.pcfdev.io"+ "/service/hello-world", new HelloWorldServiceImpl());
}
public static void main(String[] args) {
SpringApplication.run(SoapServerApplication.class, args);
}
}
Complete logs:
App instance exited with guid 7c476beb-6e16-4a25-bed3-51ce289a8180 payload: {"instance"=>"", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"2 error(s) occurred:\n\n* 2 error(s) occurred:\n\n* Exited with status 1\n* cancelled\n* cancelled", "crash_count"=>5, "crash_timestamp"=>1481326885385909754, "version"=>"dd0fa534-cc5b-4012-acff-3a23c390987c"}
Successfully destroyed container
Creating container
Successfully created container
Starting health monitoring of container
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
. ____ _ __ _ _
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.6.RELEASE)
2016-12-09 23:43:49.229 INFO 17 --- [ main] pertySourceApplicationContextInitializer : Adding 'cloud' PropertySource to ApplicationContext
2016-12-09 23:43:49.394 INFO 17 --- [ main] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
2016-12-09 23:43:49.427 INFO 17 --- [ main] c.a.s.server.main.SoapServerApplication : Starting SoapServerApplication on 3le7g13378f with PID 17 (/home/vcap/app started by vcap in /home/vcap/app)
2016-12-09 23:43:49.430 INFO 17 --- [ main] c.a.s.server.main.SoapServerApplication : The following profiles are active: cloud
2016-12-09 23:43:49.541 INFO 17 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#1f17ae12: startup date [Fri Dec 09 23:43:49 UTC 2016]; root of context hierarchy
2016-12-09 23:43:51.384 INFO 17 --- [ main] urceCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type javax.sql.DataSource
2016-12-09 23:43:51.386 INFO 17 --- [ main] edisCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.data.redis.connection.RedisConnectionFactory
2016-12-09 23:43:51.385 INFO 17 --- [ main] ongoCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.data.mongodb.MongoDbFactory
2016-12-09 23:43:51.385 INFO 17 --- [ main] bbitCloudServiceBeanFactoryPostProcessor : Skipping auto-reconfiguring beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory
2016-12-09 23:43:52.179 INFO 17 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-12-09 23:43:52.213 INFO 17 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-12-09 23:43:52.218 INFO 17 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.36
2016-12-09 23:43:52.417 INFO 17 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-12-09 23:43:52.419 INFO 17 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2881 ms
2016-12-09 23:43:53.003 INFO 17 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-12-09 23:43:53.013 INFO 17 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-12-09 23:43:53.014 INFO 17 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-12-09 23:43:53.014 INFO 17 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-12-09 23:43:53.015 INFO 17 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-12-09 23:43:53.467 INFO 17 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#1f17ae12: startup date [Fri Dec 09 23:43:49 UTC 2016]; root of context hierarchy
2016-12-09 23:43:53.584 INFO 17 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-12-09 23:43:53.596 INFO 17 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-12-09 23:43:53.649 INFO 17 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-12-09 23:43:53.649 INFO 17 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-12-09 23:43:53.706 INFO 17 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-12-09 23:43:53.886 INFO 17 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-12-09 23:43:54.041 INFO 17 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
Container became healthy
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:771) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
2016-12-09 23:43:54.550 ERROR 17 --- [ main] o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:803) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:784) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
at com.arpit.soap.server.main.SoapServerApplication.main(SoapServerApplication.java:24) [app/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54) [app/:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:104) [app/:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:61) [app/:na]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [app/:na]
Caused by: com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.net.SocketException: Permission denied
at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:117) ~[na:1.8.0_91]
at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:64) ~[na:1.8.0_91]
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:232) ~[na:1.8.0_91]
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:126) ~[na:1.8.0_91]
at javax.xml.ws.Endpoint.publish(Endpoint.java:240) ~[na:1.8.0_91]
at com.arpit.soap.server.main.SoapServerApplication.run(SoapServerApplication.java:20) [app/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
... 14 common frames omitted
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_91]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_91]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_91]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_91]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_91]
at sun.net.httpserver.ServerImpl.<init>(ServerImpl.java:100) ~[na:1.8.0_91]
at sun.net.httpserver.HttpServerImpl.<init>(HttpServerImpl.java:50) ~[na:1.8.0_91]
at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35) ~[na:1.8.0_91]
at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130) ~[na:1.8.0_91]
at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:86) ~[na:1.8.0_91]
... 20 common frames omitted
2016-12-09 23:43:54.564 INFO 17 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/home/vcap/app/, jar:file:/home/vcap/app/lib/spring-expression-4.2.7.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-webmvc-4.2.7.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-context-4.2.7.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-core-4.2.7.RELEASE.jar!/, jar:file:/home/vcap/app/lib/jboss-logging-3.3.0.Final.jar!/, jar:file:/home/vcap/app/lib/spring-aop-4.2.7.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-boot-1.3.6.RELEASE.jar!/, jar:file:/home/vcap/app/lib/jackson-annotations-2.6.7.jar!/, jar:file:/home/vcap/app/lib/spring-boot-starter-web-1.3.6.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-cloud-spring-service-connector-1.2.3.RELEASE.jar!/, jar:file:/home/vcap/app/lib/tomcat-embed-el-8.0.36.jar!/, jar:file:/home/vcap/app/lib/jul-to-slf4j-1.7.21.jar!/, jar:file:/home/vcap/app/lib/classmate-1.1.0.jar!/, jar:file:/home/vcap/app/lib/spring-web-4.2.7.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-boot-autoconfigure-1.3.6.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-cloud-core-1.2.3.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-beans-4.2.7.RELEASE.jar!/, jar:file:/home/vcap/app/lib/logback-core-1.1.7.jar!/, jar:file:/home/vcap/app/lib/spring-boot-starter-tomcat-1.3.6.RELEASE.jar!/, jar:file:/home/vcap/app/lib/logback-classic-1.1.7.jar!/, jar:file:/home/vcap/app/lib/spring_auto_reconfiguration-1.10.0_RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-boot-starter-logging-1.3.6.RELEASE.jar!/, jar:file:/home/vcap/app/lib/validation-api-1.1.0.Final.jar!/, jar:file:/home/vcap/app/lib/snakeyaml-1.16.jar!/, jar:file:/home/vcap/app/lib/log4j-over-slf4j-1.7.21.jar!/, jar:file:/home/vcap/app/lib/jcl-over-slf4j-1.7.21.jar!/, jar:file:/home/vcap/app/lib/tomcat-embed-logging-juli-8.0.36.jar!/, jar:file:/home/vcap/app/lib/jackson-databind-2.6.7.jar!/, jar:file:/home/vcap/app/lib/tomcat-embed-core-8.0.36.jar!/, jar:file:/home/vcap/app/lib/spring-boot-starter-1.3.6.RELEASE.jar!/, jar:file:/home/vcap/app/lib/slf4j-api-1.7.21.jar!/, jar:file:/home/vcap/app/lib/jackson-core-2.6.7.jar!/, jar:file:/home/vcap/app/lib/spring-cloud-cloudfoundry-connector-1.2.3.RELEASE.jar!/, jar:file:/home/vcap/app/lib/spring-boot-starter-validation-1.3.6.RELEASE.jar!/, jar:file:/home/vcap/app/lib/aopalliance-1.0.jar!/, jar:file:/home/vcap/app/lib/tomcat-embed-websocket-8.0.36.jar!/, jar:file:/home/vcap/app/lib/hibernate-validator-5.2.4.Final.jar!/]
Error starting ApplicationContext. To display the auto-configuration report enable debug logging (start with --debug)
2016-12-09 23:43:54.571 INFO 17 --- [ main] utoConfigurationReportLoggingInitializer :
2016-12-09 23:43:54.571 INFO 17 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#1f17ae12: startup date [Fri Dec 09 23:43:49 UTC 2016]; root of context hierarchy
2016-12-09 23:43:54.583 INFO 17 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:61)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:104)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:803)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:784)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
... 3 more
Caused by: java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:771)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
at com.arpit.soap.server.main.SoapServerApplication.main(SoapServerApplication.java:24)
... 8 more
Caused by: com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.net.SocketException: Permission denied
at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:117)
at com.arpit.soap.server.main.SoapServerApplication.run(SoapServerApplication.java:20)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800)
at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:64)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:232)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:126)
at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
... 14 more
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.net.httpserver.ServerImpl.<init>(ServerImpl.java:100)
at sun.net.httpserver.HttpServerImpl.<init>(HttpServerImpl.java:50)
at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35)
at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130)
at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:86)
... 20 more
Exit status 1
Exit status 0
Any idea how can I fix it?
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
My Spring Boot application is failing at startup, with the log below. What does this mean?
I'm using Hibernate Core v5.0.11.Final.
<pre>
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.1.RELEASE)
2016-09-27 02:55:31.899 INFO 5329 --- [ main] c.t.application.TaqnihomeApplication : Starting TaqnihomeApplication on Songlines-MacBook-Air.local with PID 5329 (/Users/songline/Downloads/assignment-2/target/classes started by songline in /Users/songline/Downloads/assignment-2)
2016-09-27 02:55:31.904 INFO 5329 --- [ main] c.t.application.TaqnihomeApplication : No active profile set, falling back to default profiles: default
2016-09-27 02:55:32.092 INFO 5329 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#7722c3c3: startup date [Tue Sep 27 02:55:32 IST 2016]; root of context hierarchy
2016-09-27 02:55:33.792 INFO 5329 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'dataSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Generic; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Generic.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]]
2016-09-27 02:55:34.412 INFO 5329 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8ec63a75] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-27 02:55:35.085 INFO 5329 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-09-27 02:55:35.103 INFO 5329 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-09-27 02:55:35.104 INFO 5329 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5
2016-09-27 02:55:35.280 INFO 5329 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-09-27 02:55:35.280 INFO 5329 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3192 ms
2016-09-27 02:55:35.492 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-09-27 02:55:35.497 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-09-27 02:55:35.498 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-09-27 02:55:35.498 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-09-27 02:55:35.498 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-09-27 02:55:35.798 INFO 5329 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-09-27 02:55:35.818 INFO 5329 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-09-27 02:55:35.917 INFO 5329 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final}
2016-09-27 02:55:35.919 INFO 5329 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-09-27 02:55:35.921 INFO 5329 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-09-27 02:55:35.990 INFO 5329 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2016-09-27 02:55:36.268 INFO 5329 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Started.
2016-09-27 02:55:36.528 INFO 5329 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2016-09-27 02:55:37.223 INFO 5329 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2016-09-27 02:55:37.266 INFO 5329 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: game_library
2016-09-27 02:55:37.363 WARN 5329 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2016-09-27 02:55:37.364 INFO 5329 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Close initiated...
2016-09-27 02:55:37.370 INFO 5329 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Closed.
2016-09-27 02:55:37.372 INFO 5329 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2016-09-27 02:55:37.390 INFO 5329 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2016-09-27 02:55:37.398 ERROR 5329 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at com.taqnihome.application.TaqnihomeApplication.main(TaqnihomeApplication.java:34) [classes/:na]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:373) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:362) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
... 16 common frames omitted
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to execute schema management to JDBC target [alter table game_library add column game_id varchar(255) not null]
at org.hibernate.tool.schema.internal.TargetDatabaseImpl.accept(TargetDatabaseImpl.java:59) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:431) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:449) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.migrateTable(SchemaMigratorImpl.java:253) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigrationToTargets(SchemaMigratorImpl.java:170) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:60) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:134) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:472) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
... 22 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: Table 'testingjpa.game_library' doesn't exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:686) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:663) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:653) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2041) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1608) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2630) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1534) ~[mysql-connector-java-6.0.3.jar:6.0.3]
at com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:120) ~[HikariCP-2.4.7.jar:na]
at com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java) ~[HikariCP-2.4.7.jar:na]
at org.hibernate.tool.schema.internal.TargetDatabaseImpl.accept(TargetDatabaseImpl.java:56) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
... 32 common frames omitted
</pre>
Log TLDR;
HHH000228: Running hbm2ddl schema update
HHH000262: Table not found: game_library
GameLibrary class:
#Entity
#Table(name = "game_library")
public class GameLibrary {
#Id
#Column(name = "game_id")
private String gameId;
#Column(name = "game_name")
private String gameName;
#Column(name = "game_genre")
private String gameGenre;
#ManyToOne
#JoinColumn(name = "game_category", nullable = false)
private GameCategory gameCategory;
#Column(name = "game_version")
private String gameVersion;
#Column(name = "game_publiher")
private String gamePublisher;
#Column(name = "game_studio")
private String gameStudio;
#Column(name = "game_release_date")
private Long gameReleaseDate;
#Column
private Double gameRating;
#Column
private String gamePlatform;
#Column
private Long creationDate;
#Column
private String googlePlayUrl;
#Column
private Long approvedDate;
#Column
private Boolean isApproved;
#Column
private String packageName;
#ManyToMany(mappedBy = "gameLibrary", cascade = CascadeType.ALL)
private List<GameProfile> gameProfiles;
// getters and setters
}
new log when update change with create field value ddl-auto
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.1.RELEASE)
2016-09-27 12:47:50.815 INFO 5812 --- [ main] c.t.application.TaqnihomeApplication : Starting TaqnihomeApplication on Songlines-MacBook-Air.local with PID 5812 (/Users/songline/Downloads/assignment-2/target/classes started by songline in /Users/songline/Downloads/assignment-2)
2016-09-27 12:47:50.818 INFO 5812 --- [ main] c.t.application.TaqnihomeApplication : No active profile set, falling back to default profiles: default
2016-09-27 12:47:50.939 INFO 5812 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#7722c3c3: startup date [Tue Sep 27 12:47:50 IST 2016]; root of context hierarchy
2016-09-27 12:47:52.624 INFO 5812 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'dataSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Generic; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Generic.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]]
2016-09-27 12:47:53.213 INFO 5812 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8ec63a75] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-27 12:47:53.853 INFO 5812 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-09-27 12:47:53.874 INFO 5812 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-09-27 12:47:53.876 INFO 5812 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5
2016-09-27 12:47:54.085 INFO 5812 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-09-27 12:47:54.085 INFO 5812 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3153 ms
2016-09-27 12:47:54.275 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-09-27 12:47:54.281 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-09-27 12:47:54.281 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-09-27 12:47:54.282 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-09-27 12:47:54.282 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-09-27 12:47:54.529 INFO 5812 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-09-27 12:47:54.552 INFO 5812 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-09-27 12:47:54.640 INFO 5812 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final}
2016-09-27 12:47:54.642 INFO 5812 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-09-27 12:47:54.644 INFO 5812 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-09-27 12:47:54.691 INFO 5812 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2016-09-27 12:47:54.965 INFO 5812 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Started.
2016-09-27 12:47:55.253 INFO 5812 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2016-09-27 12:47:56.049 INFO 5812 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2016-09-27 12:47:56.441 INFO 5812 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2016-09-27 12:47:56.489 INFO 5812 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2016-09-27 12:47:57.575 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/login],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.login(com.taqnihome.domain.User)
2016-09-27 12:47:57.577 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/signup],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.saveData(com.taqnihome.domain.User)
2016-09-27 12:47:57.577 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/search],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.checkMacAddress(com.taqnihome.domain.User)
2016-09-27 12:47:57.577 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addGameToProfile],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.addGameToProfile(com.taqnihome.domain.GameProfile)
2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/updateGameToProfile],methods=[PUT]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.updateGameToProfile(com.taqnihome.domain.GameProfile)
2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addGameRequestToLibrary],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.addGameRequestToLibrary(java.lang.String,java.lang.String)
2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/getAllLibraryGames],methods=[GET]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.getAllGames()
2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/getGameProfileByUser],methods=[GET]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.getAllProfileGames(com.taqnihome.domain.User)
2016-09-27 12:47:57.579 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v2/api-docs],methods=[GET],produces=[application/json || application/hal+json]}" onto public org.springframework.http.ResponseEntity springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)
2016-09-27 12:47:57.584 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/ui]}" onto org.springframework.http.ResponseEntity springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2016-09-27 12:47:57.590 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/security]}" onto org.springframework.http.ResponseEntity springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2016-09-27 12:47:57.591 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources]}" onto org.springframework.http.ResponseEntity> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
2016-09-27 12:47:57.595 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-09-27 12:47:57.595 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-09-27 12:47:57.914 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#7722c3c3: startup date [Tue Sep 27 12:47:50 IST 2016]; root of context hierarchy
2016-09-27 12:47:58.017 INFO 5812 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-27 12:47:58.017 INFO 5812 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-27 12:47:58.068 INFO 5812 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-27 12:47:58.430 INFO 5812 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-09-27 12:47:58.437 INFO 5812 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2016-09-27 12:47:58.443 INFO 5812 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2016-09-27 12:47:58.449 INFO 5812 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2016-09-27 12:47:58.449 INFO 5812 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2016-09-27 12:47:58.476 INFO 5812 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2016-09-27 12:47:58.487 INFO 5812 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2016-09-27 12:47:58.843 INFO 5812 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-09-27 12:47:58.850 INFO 5812 --- [ main] c.t.application.TaqnihomeApplication : Started TaqnihomeApplication in 8.563 seconds (JVM running for 8.995)
Hibernate is pitching a fit because you told it to do this (intentionally or not):
alter table game_library add column game_id varchar(255) not null
However, Table 'testingjpa.game_library' doesn't exist.
Either fix your DB or fix your game_library object definition or mapping.
It's probably gone from your DB, or you're pointing it at a wrong or older DB.
Have a look at the error message that Hibernate is providing you:
java.sql.SQLSyntaxErrorException: Table 'testingjpa.game_library' doesn't exist
You're referring to a table that doesn't yet exist in your database, or that your DB user does not have access to. This is causing Spring to fail when it's setting up your Entity Manager Factory, and ultimately the entire Spring context. The errant SQL statement seems to be:
alter table game_library add column game_id varchar(255) not null
If this is in a schema.sql file, or some other schema configuration file that you're running to setup your database, you'll have to ensure that the table is created correctly before you run this alter statement.
Have a look at the Spring Boot doc on Database initialization. If you're expecting the table to be auto-generated, ensure that you have the spring.jpa.generate-ddl flag set to true in your application.properties file.