I am a novice with Spring and Hibernate and have tried everything I could find to fix this with no luck. Any assistance would be greatly appreciated. I am currently following a sample project in a book, and am getting an error that says "GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement." I am using a MariaDB database, and my hibernate dialect is org.hibernate.dialect.MySQL5InnoDBDialect.
The query causing this issue is
alter table car drop foreign key FK2mqqwvxtowv4vddvtsmvtiqa2;
If I try to run this query directly in the database it works fine. I have the ddl-auto property set to create-drop, so maybe it is trying to execute this query when the car table has been dropped and is not there? I'm not sure why it would do that or how to turn off this behavior if that is the problem.
If I change ddl-auto to validate or update, the application fails to run at all. If I change it to create, it works fine and I get no errors.
With create-drop, the application does connect to the database and all my tables are created. The tables are still defined as they should be, but the error remains.
Console output:
2018-07-25 16:56:24.229 INFO 12414 --- [ restartedMain] c.p.cardatabase.CardatabaseApplication : Starting CardatabaseApplication on Northstar-2.local with PID 12414 2018-07-25 16:56:24.230 INFO 12414 --- [ restartedMain] c.p.cardatabase.CardatabaseApplication : No active profile set, falling back to default profiles: default
2018-07-25 16:56:24.278 INFO 12414 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#42e3f007: startup date [Wed Jul 25 16:56:24 AKDT 2018]; root of context hierarchy
2018-07-25 16:56:25.134 INFO 12414 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'httpRequestHandlerAdapter' 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.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]]
2018-07-25 16:56:25.535 INFO 12414 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$e5303d26] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-07-25 16:56:25.850 INFO 12414 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-07-25 16:56:25.875 INFO 12414 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-07-25 16:56:25.875 INFO 12414 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.29
2018-07-25 16:56:25.883 INFO 12414 --- [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: [/Users/tatiana/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-07-25 16:56:26.025 INFO 12414 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-07-25 16:56:26.025 INFO 12414 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1750 ms
2018-07-25 16:56:26.155 INFO 12414 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-07-25 16:56:26.156 INFO 12414 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-07-25 16:56:26.156 INFO 12414 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-07-25 16:56:26.156 INFO 12414 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-07-25 16:56:26.156 INFO 12414 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-07-25 16:56:26.156 INFO 12414 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-07-25 16:56:26.288 INFO 12414 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-07-25 16:56:26.354 INFO 12414 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-07-25 16:56:26.385 INFO 12414 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-07-25 16:56:26.401 INFO 12414 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-07-25 16:56:26.467 INFO 12414 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.16.Final}
2018-07-25 16:56:26.469 INFO 12414 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-07-25 16:56:26.504 INFO 12414 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-07-25 16:56:26.602 INFO 12414 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2018-07-25 16:56:27.062 WARN 12414 --- [ restartedMain] o.h.t.s.i.ExceptionHandlerLoggedImpl : GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:375) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:144) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:312) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:460) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892) [hibernate-core-5.2.16.Final.jar:5.2.16.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) [spring-orm-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) [spring-orm-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) [spring-orm-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) [spring-orm-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) [spring-orm-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698) [spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) [spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) [spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) [spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) [spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at com.packt.cardatabase.CardatabaseApplication.main(CardatabaseApplication.java:28) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.0.1.RELEASE.jar:2.0.1.RELEASE]
Caused by: java.sql.SQLSyntaxErrorException: (conn=342) Table 'cardb.car' doesn't exist
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:177) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:110) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:228) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:334) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:386) ~[mariadb-java-client-2.2.3.jar:na]
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) ~[HikariCP-2.7.8.jar:na]
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-2.7.8.jar:na]
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) ~[hibernate-core-5.2.16.Final.jar:5.2.16.Final]
... 40 common frames omitted
Caused by: java.sql.SQLException: Table 'cardb.car' doesn't exist
Query is: alter table car drop foreign key FK2mqqwvxtowv4vddvtsmvtiqa2
at org.mariadb.jdbc.internal.util.LogQueryTool.exceptionWithQuery(LogQueryTool.java:119) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:199) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:328) ~[mariadb-java-client-2.2.3.jar:na]
... 44 common frames omitted
[ . . . Mapping details here, omitted]
2018-07-25 16:56:27.118 INFO 12414 --- [ restartedMain] o.h.t.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl#23352c6f'
2018-07-25 16:56:27.121 INFO 12414 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-07-25 16:56:28.047 INFO 12414 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#7ec73b7e, org.springframework.security.web.context.SecurityContextPersistenceFilter#6f233313, org.springframework.security.web.header.HeaderWriterFilter#1e641fa3, org.springframework.security.web.csrf.CsrfFilter#7c5a0312, org.springframework.security.web.authentication.logout.LogoutFilter#176619be, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#26add7c1, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#4030f929, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#2ea06fad, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#6ce594ae, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#6159e3c1, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#51157300, org.springframework.security.web.session.SessionManagementFilter#5be9c504, org.springframework.security.web.access.ExceptionTranslationFilter#4506e3d3, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#1f44843c]
org.springframework.http.HttpEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.ProfileController.listAllFormsOfMetadata()
2018-07-25 16:56:28.632 INFO 12414 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-07-25 16:56:28.668 INFO 12414 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-07-25 16:56:28.670 INFO 12414 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-07-25 16:56:28.676 INFO 12414 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-07-25 16:56:28.712 INFO 12414 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-07-25 16:56:28.715 INFO 12414 --- [ restartedMain] c.p.cardatabase.CardatabaseApplication : Started CardatabaseApplication in 4.726 seconds (JVM running for 5.165)
Here is the code on my repo:
https://github.com/Kallaste/spring_login_server_example_so
I wouldn’t worry about it if your application still runs. Hibernate throws a lot of ‘informative’ errors on startup. It just tries to figure out what it has to do to get the database in a state where your application can run.
If the app runs fine if you use create-drop or just create, then try running it with create just once so everything is generated and then change it to validate so the next time it only validates your database schema.
In a production environment you would generally not let Hibernate update the database schema by itself but manually apply changes and migrate data anyway, unless you’re very sure the changes would be applied correctly.
You should use create the first time you run your application, but the next runs have to have update.
When you use create you create the schema and destroy the previous data.
And create-drop destroy the schema in the end of the session. update only update you schema.
update should still be valid. If tables don't exist, it will behave as create.
Are you sure your DB and DBDialect match?
Add #Table annotation like below
#Table(name="car") in car entity. Always give name to table .
Note:
1) When ddl-auto=create-drop and if you don't have #Table(name="car") always you will get this exception.
2) When ddl-auto=create-drop and if you have #Table(name="car") the first time alone you will get this exception.
So try to change the ddl-auto value to other than create-drop . May be you can use "create" or "update"
Hope this helps.
Need to change spring.jpa.hibernate.ddl-auto =update instead of create-drop in application.properties file. Because It is dropping the database at the start of the application and so it won't find the required events table to alter anything.
The problem is because you don't have permissions on the database user.
I packed my Spring Boot application into jar like others same applications that works correctly. It's almost same apps. But this app failed with errors:
2018-01-28 23:43:57.661 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'servletConfigInitParams' with lowest search precedence
2018-01-28 23:43:57.670 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'servletContextInitParams' with lowest search precedence
2018-01-28 23:43:57.671 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'systemProperties' with lowest search precedence
2018-01-28 23:43:57.672 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'systemEnvironment' with lowest search precedence
2018-01-28 23:43:57.673 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Initialized StandardServletEnvironment with PropertySources [StubPropertySource {name='servletConfigInitParams'}, StubPropertySource {name='servletContextInitParams'}, MapPropertySource {name='systemProperties'}, SystemEnvironmentPropertySource {name='systemEnvironment'}]
2018-01-28 23:43:57.780 INFO 14109 --- [ main] com.contedevel.virto.Application : Starting Application on CONTEDEVEL with PID 14109 (/home/ghostman/Projects/Virto/out/virto.jar started by ghostman in /home/ghostman/Projects/Virto/out)
2018-01-28 23:43:57.781 INFO 14109 --- [ main] com.contedevel.virto.Application : No active profile set, falling back to default profiles: default
2018-01-28 23:43:57.925 INFO 14109 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#928763c: startup date [Sun Jan 28 23:43:57 MSK 2018]; root of context hierarchy
2018-01-28 23:43:59.766 INFO 14109 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'httpRequestHandlerAdapter' 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.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/home/ghostman/Projects/Virto/out/spring-core-4.3.13.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2018-01-28 23:44:00.354 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'applicationConfig: [classpath:/application.properties]' with search precedence immediately lower than 'applicationConfigurationProperties'
2018-01-28 23:44:00.355 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Removing PropertySource 'applicationConfigurationProperties'
2018-01-28 23:44:00.355 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Removing PropertySource 'defaultProperties'
2018-01-28 23:44:00.695 INFO 14109 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$430fc63b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-28 23:44:01.549 INFO 14109 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-01-28 23:44:01.574 INFO 14109 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-01-28 23:44:01.576 INFO 14109 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23
2018-01-28 23:44:01.733 INFO 14109 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-01-28 23:44:01.734 DEBUG 14109 --- [ost-startStop-1] o.s.web.context.ContextLoader : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
2018-01-28 23:44:01.734 INFO 14109 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3819 ms
2018-01-28 23:44:01.979 INFO 14109 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-01-28 23:44:01.988 INFO 14109 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-01-28 23:44:01.989 INFO 14109 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestLoggingFilter' to: [/*]
2018-01-28 23:44:02.062 DEBUG 14109 --- [ost-startStop-1] o.s.w.f.CommonsRequestLoggingFilter : Initializing filter 'requestLoggingFilter'
2018-01-28 23:44:02.069 DEBUG 14109 --- [ost-startStop-1] o.s.w.f.CommonsRequestLoggingFilter : Filter 'requestLoggingFilter' configured successfully
2018-01-28 23:44:02.099 DEBUG 14109 --- [ main] o.s.w.c.s.StandardServletEnvironment : Replacing PropertySource 'servletContextInitParams' with 'servletContextInitParams'
2018-01-28 23:44:02.838 WARN 14109 --- [ 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: Unable to resolve persistence unit root URL
2018-01-28 23:44:02.860 INFO 14109 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-01-28 23:44:02.919 INFO 14109 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-01-28 23:44:02.936 ERROR 14109 --- [ 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: Unable to resolve persistence unit root URL
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at com.contedevel.virto.Application.main(Application.java:17) [virto.jar:na]
Caused by: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:605) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:445) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:426) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:325) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
... 16 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:601) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
... 21 common frames omitted
I can't get where is my error. I used java --add-modules java.xml.bind -jar virto.jar command to run app. Jar contains MANIFEST.MF and .properties files like in other my apps that works perfectly.
Has someone any ideas where should I search an error? Below my build.gradle:
buildscript {
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.contedevel'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.9
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.json:json')
runtime('org.postgresql:postgresql')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
My MANIFEST.MF:
Manifest-Version: 1.0
Class-Path: jackson-core-2.8.10.jar jackson-annotations-2.8.0.jar logb
ack-classic-1.1.11.jar tomcat-annotations-api-8.5.23.jar logback-core
-1.1.11.jar slf4j-api-1.7.25.jar spring-data-commons-1.13.9.RELEASE.j
ar antlr-2.7.7.jar spring-data-rest-core-2.6.9.RELEASE.jar spring-hat
eoas-0.23.0.RELEASE.jar spring-boot-starter-logging-1.5.9.RELEASE.jar
hibernate-validator-5.3.6.Final.jar spring-boot-starter-web-1.5.9.RE
LEASE.jar snakeyaml-1.17.jar hibernate-core-5.0.12.Final.jar jcl-over
-slf4j-1.7.25.jar spring-boot-autoconfigure-1.5.9.RELEASE.jar dom4j-1
.6.1.jar spring-beans-4.3.13.RELEASE.jar spring-core-4.3.13.RELEASE.j
ar jackson-databind-2.8.10.jar tomcat-embed-el-8.5.23.jar spring-boot
-starter-data-jpa-1.5.9.RELEASE.jar spring-web-4.3.13.RELEASE.jar evo
-inflector-1.2.2.jar hibernate-commons-annotations-5.0.1.Final.jar js
on-20140107.jar spring-aop-4.3.13.RELEASE.jar log4j-over-slf4j-1.7.25
.jar tomcat-jdbc-8.5.23.jar hibernate-jpa-2.1-api-1.0.0.Final.jar spr
ing-data-rest-webmvc-2.6.9.RELEASE.jar jul-to-slf4j-1.7.25.jar spring
-boot-starter-1.5.9.RELEASE.jar spring-expression-4.3.13.RELEASE.jar
spring-boot-1.5.9.RELEASE.jar spring-orm-4.3.13.RELEASE.jar classmate
-1.3.4.jar hibernate-entitymanager-5.0.12.Final.jar tomcat-juli-8.5.2
3.jar spring-boot-starter-aop-1.5.9.RELEASE.jar spring-data-jpa-1.11.
9.RELEASE.jar spring-boot-starter-tomcat-1.5.9.RELEASE.jar validation
-api-1.1.0.Final.jar spring-tx-4.3.13.RELEASE.jar spring-aspects-4.3.
13.RELEASE.jar tomcat-embed-core-8.5.23.jar jandex-2.0.0.Final.jar jb
oss-logging-3.3.1.Final.jar javax.transaction-api-1.2.jar spring-boot
-starter-jdbc-1.5.9.RELEASE.jar spring-jdbc-4.3.13.RELEASE.jar spring
-context-4.3.13.RELEASE.jar aspectjweaver-1.8.13.jar postgresql-9.4.1
212.jre7.jar spring-webmvc-4.3.13.RELEASE.jar spring-boot-starter-dat
a-rest-1.5.9.RELEASE.jar javassist-3.21.0-GA.jar spring-plugin-core-1
.2.0.RELEASE.jar tomcat-embed-websocket-8.5.23.jar
Main-Class: com.contedevel.virto.Application
application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/virto
spring.datasource.username=virto_user
spring.datasource.password=****
#spring.datasource.driver-class-name=xxx
spring.jpa.hibernate.ddl-auto=create-drop
#show sql statement
logging.level.org.hibernate.SQL=error
#show sql values
logging.level.org.hibernate.type.descriptor.sql=trace
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
logging.file=${user.home}/Logs/virto.log
#server
server.port = 8080
Looks like this is a bug in the spring project. You are not the first to encounter it. There are a few places it seems to be reported as a bug:
github.com/spring-projects/spring-boot/issues/6635
github.com/spring-projects/spring-boot/issues/6314
stackoverflow.com/questions/38686708/spring-boot-1-4-class-path-resource-cannot-be-resolved-to-url-because-it-do
Since it's a bug, probably not worth the time to understand it exactly, just use one of the listed solutions or workarounds.
if you are running it in Linux or EC2 AWS Linux use nohup command to run the jar filr as below.
nohup java -jar /web/server.jar > /var/log/yourservice.log 2>&1
I am trying to run my spring boot application with following properties set and I am expecting it to keep retrying to load properties from config server for 50 times with wait of 6 seconds between any two attempts and even after that it cannot connect to config server, it should either resume the startup or exit (I am indifferent on whatever spring boot is capable of doing after retries). But it doesn't seem like its behaving as expected.
My startup command -
java -jar -Dspring.application.name=maas-gateway -Dspring.cloud.config.uri=http://localhost:8888 -Dspring.cloud.config.failFast=false -Dspring.cloud.config.retry.initialInterval=5000 -Dspring.cloud.config.retry.maxInterval=7000 -Dspring.cloud.config.retry.maxAttempts=50 maas-gateway-1.0-SNAPSHOT.jar
But I am getting following errors, as it resumes the startup after one try.
2017-10-06 09:55:05.881 INFO [] 3598 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#53e25b76: startup date [Fri Oct 06 09:55:05 EDT 2017]; root of context hierarchy
2017-10-06 09:55:06.136 INFO [] 3598 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-10-06 09:55:06.166 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$bbc9d7cf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
__ __ _____ _____ _
| \/ | / ____| / ____| | |
| \ / | __ _ __ _| (___ ______| | __ __ _| |_ _____ ____ _ _ _
| |\/| |/ _` |/ _` |\___ \______| | |_ |/ _` | __/ _ \ \ /\ / / _` | | | |
| | | | (_| | (_| |____) | | |__| | (_| | || __/\ V V / (_| | |_| |
|_| |_|\__,_|\__,_|_____/ \_____|\__,_|\__\___| \_/\_/ \__,_|\__, |
__/ |
|___/
2017-10-06 09:55:06.494 INFO [] 3598 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2017-10-06 09:55:06.579 WARN [] 3598 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/maas-gateway/default": Connection refused; nested exception is java.net.ConnectException: Connection refused
2017-10-06 09:55:06.580 INFO [] 3598 --- [ main] com.solace.maas.Application : No active profile set, falling back to default profiles: default
2017-10-06 09:55:06.601 INFO [] 3598 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2ed94a8b: startup date [Fri Oct 06 09:55:06 EDT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#53e25b76
2017-10-06 09:55:08.889 INFO [] 3598 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'getManagerExecutorService' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=gatewayServiceConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/gateway/configuration/GatewayServiceConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=iamServiceConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/iam/configuration/IamServiceConfiguration.class]]
2017-10-06 09:55:08.890 INFO [] 3598 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'getMaasProperties' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=gatewayServiceConfiguration; factoryMethodName=getMaasProperties; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/gateway/configuration/GatewayServiceConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=iamServiceConfiguration; factoryMethodName=getMaasProperties; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/iam/configuration/IamServiceConfiguration.class]]
2017-10-06 09:55:08.898 INFO [] 3598 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'getManagerExecutorService' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=iamServiceConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/iam/configuration/IamServiceConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=signupManagerConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/signupManager/configuration/SignupManagerConfiguration.class]]
2017-10-06 09:55:09.126 INFO [] 3598 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'managementServletContext' 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.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]
2017-10-06 09:55:09.750 WARN [] 3598 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance #Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static #Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2017-10-06 09:55:09.992 INFO [] 3598 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=27bcc9d7-c3a9-3801-b696-3f3650ee7946
2017-10-06 09:55:10.038 INFO [] 3598 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-10-06 09:55:10.137 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport' of type [class org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport$$EnhancerBySpringCGLIB$$dcf17295] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.237 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$9fafd4d2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.467 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [class org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$385d9d0c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.486 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'objectPostProcessor' of type [class org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.494 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#736d6a5c' of type [class org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.506 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [class org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$5d323fbe] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.571 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [class org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.606 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration' of type [class org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration$$EnhancerBySpringCGLIB$$d1dc7b13] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:10.659 INFO [] 3598 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$bbc9d7cf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-06 09:55:11.342 INFO [] 3598 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-10-06 09:55:11.353 INFO [] 3598 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-10-06 09:55:11.354 INFO [] 3598 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6
2017-10-06 09:55:11.429 INFO [] 3598 --- [ocalhost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-10-06 09:55:11.429 INFO [] 3598 --- [ocalhost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4828 ms
2017-10-06 09:55:12.903 ERROR [] 3598 --- [ocalhost-startStop-1] o.s.b.c.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'iamServiceConfiguration': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter': Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$$EnhancerBySpringCGLIB$$3067f332]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jacksonHttpMessageConverter' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter]: Factory method 'jacksonHttpMessageConverter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repositories' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.repository.support.Repositories]: Factory method 'repositories' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAttributeDAO': Cannot create inner bean '(inner bean)#60b53b0c' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#60b53b0c': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2017-10-06 09:55:12.932 WARN [] 3598 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
2017-10-06 09:55:12.940 ERROR [] 3598 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Add spring-retry as a dependency.
I have defined Camel routes in 2 XML files, and would like to run the application using Spring Boot component.
Here is the main code:
Object[] sources = {
"META-INF/spring/propertiesContext.xml",
"META-INF/spring/concurrent-route-context.xml"
};
ApplicationContext applicationContext = new SpringApplication(sources).run(args);
CamelSpringBootApplicationController applicationController = applicationContext
.getBean(CamelSpringBootApplicationController.class);
applicationController.blockMainThread();
However, I got the following error during startup
2015-08-19 14:54:04.203 ERROR 13812 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at com.oocl.b2b.camel.spring.boot.test.ConcurrencyTest.testSpringBoot(ConcurrencyTest.java:44)
at com.oocl.b2b.camel.spring.boot.test.ConcurrencyTest.main(ConcurrencyTest.java:29)
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 6 common frames omitted
If I update my pom.xml by using "spring-boot-starter" instead of "spring-boot-starter-web", I got another exception
2015-08-19 15:02:06.930 INFO 4528 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.15.2 (CamelContext: concurrent-route-context) started in 1.320 seconds
2015-08-19 15:02:06.932 INFO 4528 --- [ main] c.o.b.c.s.boot.test.ConcurrencyTest : Started ConcurrencyTest in 2.615 seconds (JVM running for 2.867)
Exception in thread "main" 2015-08-19 15:02:06.933 INFO 4528 --- [ Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#142f024: startup date [Wed Aug 19 15:02:05 CST 2015]; root of context hierarchy
2015-08-19 15:02:06.934 INFO 4528 --- [ Thread-1] o.a.camel.spring.SpringCamelContext : Apache Camel 2.15.2 (CamelContext: concurrent-route-context) is shutting down
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.camel.spring.boot.CamelSpringBootApplicationController] is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:371)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968)
at com.oocl.b2b.camel.spring.boot.test.ConcurrencyTest.testSpringBoot(ConcurrencyTest.java:47)
at com.oocl.b2b.camel.spring.boot.test.ConcurrencyTest.main(ConcurrencyTest.java:30)
2015-08-19 15:02:06.937 INFO 4528 --- [ Thread-1] o.a.camel.impl.DefaultShutdownStrategy : Starting to graceful shutdown 4 routes (timeout 300 seconds)
Would anyone please advice if I have made any mis-config?
I don't know if you've found a solution for this yet, but try this for your application class:
#Configuration
#EnableAutoConfiguration
public class TestSpringBootApplication
{
public static void main(String... args)
{
(new SpringApplication("META-INF/spring/propertiesContext.xml",
"META-INF/spring/concurrent-route-context.xml")).run(args);
}
}
I have a Spring Boot app, which ran fine on my Windows machine, but is now failing to start on my xUbuntu VM running on Virtual Box.
I call it using following command:
java -Djava.net.preferIPv4Stack=true -jar -Xmx1500m highlighter-0.0.1.jar
I added -Djava.net.preferIPv4Stack=true after reading these multiple answers, but it did not solve the issue.
I get following error:
2015-01-28 17:20:02.844 DEBUG 18612 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Looking for resource handler mappings
2015-01-28 17:20:02.845 DEBUG 18612 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'viewControllerHandlerMapping'
2015-01-28 17:20:02.845 DEBUG 18612 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'resourceHandlerMapping'
2015-01-28 17:20:02.845 DEBUG 18612 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'faviconHandlerMapping'
2015-01-28 17:20:02.845 DEBUG 18612 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**/favicon.ico", locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#2e9e8b52]
2015-01-28 17:20:02.845 DEBUG 18612 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/webjars/**", locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#6a90f803]
2015-01-28 17:20:02.846 DEBUG 18612 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**", locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#c09fd55]
2015-01-28 17:20:02.847 DEBUG 18612 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [servletConfigInitParams]
2015-01-28 17:20:02.847 DEBUG 18612 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [servletContextInitParams]
2015-01-28 17:20:02.847 DEBUG 18612 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
2015-01-28 17:20:02.847 DEBUG 18612 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
2015-01-28 17:20:02.847 DEBUG 18612 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [random]
2015-01-28 17:20:02.847 DEBUG 18612 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [applicationConfig: [file:./application.properties]]
2015-01-28 17:20:02.847 DEBUG 18612 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
2015-01-28 17:20:02.870 ERROR 18612 --- [ main] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler ["http-nio-80"]
java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.Net.bind(Net.java:428)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:343)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:737)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:471)
at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:80)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:237)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
at com.dash.nlpHighlight.web.App.main(App.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
2015-01-28 17:20:02.872 ERROR 18612 --- [ main] o.apache.catalina.core.StandardService : Failed to start connector [Connector[HTTP/1.1-80]]
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-80]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:237)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
at com.dash.nlpHighlight.web.App.main(App.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:993)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 18 common frames omitted
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.Net.bind(Net.java:428)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:343)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:737)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:471)
at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:80)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
... 19 common frames omitted
2015-01-28 17:20:02.886 INFO 18612 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2015-01-28 17:20:02.911 INFO 18612 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-web-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/stanford-corenlp-3.5.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/stanford-corenlp-3.5.0-models.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/junit-4.12.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-tomcat-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jackson-databind-2.4.4.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/hibernate-validator-5.1.3.Final.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-core-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-web-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-webmvc-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xom-1.2.10.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/joda-time-2.1.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jollyday-0.4.7.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/ejml-0.23.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/javax.json-api-1.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/hamcrest-core-1.3.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-autoconfigure-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-boot-starter-logging-1.2.1.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/snakeyaml-1.14.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-core-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-el-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-logging-juli-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/tomcat-embed-websocket-8.0.15.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jackson-annotations-2.4.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jackson-core-2.4.4.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/validation-api-1.1.0.Final.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jboss-logging-3.1.3.GA.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/classmate-1.0.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-aop-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-beans-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-context-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/spring-expression-4.1.4.RELEASE.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xercesImpl-2.8.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xalan-2.7.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jaxb-api-2.2.7.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jcl-over-slf4j-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/jul-to-slf4j-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/log4j-over-slf4j-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/logback-classic-1.1.2.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/aopalliance-1.0.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/slf4j-api-1.7.8.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/logback-core-1.1.2.jar!/, jar:file:/home/dash/Dropbox/Projects/NLP/highlighter/build/libs/highlighter-0.0.1.jar!/lib/xml-apis-2.0.2.jar!/]
2015-01-28 17:20:02.913 DEBUG 18612 --- [ main] utoConfigurationReportLoggingInitializer :
=========================
AUTO-CONFIGURATION REPORT
=========================
...
2015-01-28 17:20:02.918 ERROR 18612 --- [ main] o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
at com.dash.nlpHighlight.web.App.main(App.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
2015-01-28 17:20:02.919 INFO 18612 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#5b5ba2dc: startup date [Wed Jan 28 17:19:37 EST 2015]; root of context hierarchy
2015-01-28 17:20:02.919 DEBUG 18612 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'lifecycleProcessor'
2015-01-28 17:20:02.920 DEBUG 18612 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#3e1057f5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,sampleController,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,org.springframework.boot.autoconfigure.AutoConfigurationPackages,org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration,org.springframework.boot.autoconfigure.condition.BeanTypeRegistry,propertySourcesPlaceholderConfigurer,org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat,tomcatEmbeddedServletContainerFactory,org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,embeddedServletContainerCustomizerBeanPostProcessor,org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration,dispatcherServlet,dispatcherServletRegistration,org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration,org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration,error,beanNameViewResolver,org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration,errorAttributes,basicErrorController,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration,requestMappingHandlerAdapter,requestMappingHandlerMapping,mvcContentNegotiationManager,viewControllerHandlerMapping,beanNameHandlerMapping,resourceHandlerMapping,mvcResourceUrlProvider,defaultServletHandlerMapping,mvcConversionService,mvcValidator,mvcPathMatcher,mvcUrlPathHelper,mvcUriComponentsContributor,httpRequestHandlerAdapter,simpleControllerHandlerAdapter,handlerExceptionResolver,mvcViewResolver,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration,faviconHandlerMapping,faviconRequestHandler,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter,defaultViewResolver,requestContextListener,viewResolver,spring.mvc.CONFIGURATION_PROPERTIES,spring.resources.CONFIGURATION_PROPERTIES,org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor,org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration,hiddenHttpMethodFilter,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration,jacksonObjectMapperBuilder,http.mappers.CONFIGURATION_PROPERTIES,spring.jackson.CONFIGURATION_PROPERTIES,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration,jacksonObjectMapper,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration,stringHttpMessageConverter,spring.http.encoding.CONFIGURATION_PROPERTIES,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$MappingJackson2HttpMessageConverterConfiguration,mappingJackson2HttpMessageConverter,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration,messageConverters,org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,mbeanExporter,objectNamingStrategy,mbeanServer,org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration,characterEncodingFilter,org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration,multipartConfigElement,multipartResolver,multipart.CONFIGURATION_PROPERTIES,org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,serverProperties]; root of factory hierarchy
2015-01-28 17:20:02.922 DEBUG 18612 --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'mbeanExporter'
2015-01-28 17:20:02.922 INFO 18612 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2015-01-28 17:20:02.923 DEBUG 18612 --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'mvcValidator'
2015-01-28 17:20:02.924 DEBUG 18612 --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'characterEncodingFilter'
2015-01-28 17:20:02.924 DEBUG 18612 --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'hiddenHttpMethodFilter'
2015-01-28 17:20:02.924 DEBUG 18612 --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor'
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:287)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
at com.dash.nlpHighlight.web.App.main(App.java:16)
... 6 more
I found the answer here:
According to w3.org doc ports below 1024 are priviledged on Linux. Only root can bind to such ports.
You should either use ports >1024 or run under root account (not recommended).
The solution is to set different port in "application.properties" file, e.g. server.port=${port:8181} or to run as root using sudo (not recommended).
sometimes you can get same error on cloud env like openshift, cause localhost is not allowed there, you need also specify IP while starting app with param
--server.address=$OPENSHIFT_DIY_IP
In java API Class to add
System.setProperty("java.net.preferIPv4Stack", "true");
this line.
Change the listening port to 8181
java -Djava.net.preferIPv4Stack=true -jar -Xmx1500m highlighter-0.0.1.jar -Dserver.port=8181
Port numbers have a range of 0..65535 (although often 0 has special meaning). In the original BSD TCP implementation, only root can bind to ports 1..1023, and dynamically assigned ports were assigned from the range 1024..5000.