I have this error launching my spring application:
java -jar target/gs-serving-web-content-0.1.0.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v0.5.0.M6)
2013-12-23 00:23:09.466 INFO 19252 --- [ main] hello.Application : Starting Application on mbp-de-antoine.home with PID 19252 (/Users/antoine/Documents/workspace-sts-3.4.0.RELEASE/springapp/target/gs-serving-web-content-0.1.0.jar started by antoine)
2013-12-23 00:23:09.511 INFO 19252 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#24024c39: startup date [Mon Dec 23 00:23:09 CET 2013]; root of context hierarchy
2013-12-23 00:23:10.910 INFO 19252 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2013-12-23 00:23:10.910 INFO 19252 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.42
2013-12-23 00:23:11.045 INFO 19252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2013-12-23 00:23:11.046 INFO 19252 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1537 ms
2013-12-23 00:23:11.274 INFO 19252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2013-12-23 00:23:11.274 INFO 19252 --- [ost-startStop-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2013-12-23 00:23:11.409 INFO 19252 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2013-12-23 00:23:11.634 INFO 19252 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String hello.GreetingController.greeting(java.lang.String,org.springframework.ui.Model)
2013-12-23 00:23:11.717 INFO 19252 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2013-12-23 00:23:11.717 INFO 19252 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2013-12-23 00:23:12.406 INFO 19252 --- [ost-startStop-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 1132 ms
2013-12-23 00:23:12.417 ERROR 19252 --- [ main] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler ["http-nio-8080"]
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
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:473)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:617)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:444)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1010)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:459)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:335)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:58)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:53)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:259)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:140)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:552)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:293)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:749)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:738)
at hello.Application.main(Application.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:744)
2013-12-23 00:23:12.419 ERROR 19252 --- [ main] o.apache.catalina.core.StandardService : Failed to start connector [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]
org.apache.catalina.LifecycleException: Failed to start component [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:459)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:335)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:58)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:53)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:259)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:140)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:552)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:293)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:749)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:738)
at hello.Application.main(Application.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1017)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 24 common frames omitted
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
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:473)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:617)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:444)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1010)
... 25 common frames omitted
2013-12-23 00:23:12.420 INFO 19252 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2013-12-23 00:23:12.430 INFO 19252 --- [ main] nitializer$AutoConfigurationReportLogger :
=========================
AUTO-CONFIGURATION REPORT
=========================
Positive matches:
-----------------
MessageSourceAutoConfiguration
- #ConditionalOnMissingBean (types: org.springframework.context.MessageSource; SearchStrategy: all) found no beans (OnBeanCondition)
PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer
- #ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) found no beans (OnBeanCondition)
ThymeleafAutoConfiguration
- #ConditionalOnClass classes found: org.thymeleaf.spring3.SpringTemplateEngine (OnClassCondition)
- #ConditionalOnClass classes found: org.thymeleaf.spring3.SpringTemplateEngine (OnClassCondition)
ThymeleafAutoConfiguration.DefaultTemplateResolverConfiguration
- #ConditionalOnMissingBean (names: defaultTemplateResolver; SearchStrategy: all) found no beans (OnBeanCondition)
ThymeleafAutoConfiguration.ThymeleafDefaultConfiguration
- #ConditionalOnMissingBean (types: org.thymeleaf.spring3.SpringTemplateEngine; SearchStrategy: all) found no beans (OnBeanCondition)
ThymeleafAutoConfiguration.ThymeleafViewResolverConfiguration
- #ConditionalOnClass classes found: javax.servlet.Servlet (OnClassCondition)
- #ConditionalOnClass classes found: javax.servlet.Servlet (OnClassCondition)
ThymeleafAutoConfiguration.ThymeleafViewResolverConfiguration#thymeleafViewResolver
- #ConditionalOnMissingBean (names: thymeleafViewResolver; SearchStrategy: all) found no beans (OnBeanCondition)
DispatcherServletAutoConfiguration
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- #ConditionalOnClass classes found: org.springframework.web.servlet.DispatcherServlet (OnClassCondition)
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- #ConditionalOnClass classes found: org.springframework.web.servlet.DispatcherServlet (OnClassCondition)
- #ConditionalOnBean (types: org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; SearchStrategy: all) found the following [tomcatEmbeddedServletContainerFactory] (OnBeanCondition)
DispatcherServletAutoConfiguration#dispatcherServlet
- no DispatcherServlet found (DispatcherServletAutoConfiguration.DefaultDispatcherServletCondition)
EmbeddedServletContainerAutoConfiguration
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- found web application StandardServletEnvironment (OnWebApplicationCondition)
EmbeddedServletContainerAutoConfiguration.EmbeddedTomcat
- #ConditionalOnClass classes found: javax.servlet.Servlet,org.apache.catalina.startup.Tomcat (OnClassCondition)
- #ConditionalOnClass classes found: javax.servlet.Servlet,org.apache.catalina.startup.Tomcat (OnClassCondition)
- #ConditionalOnMissingBean (types: org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; SearchStrategy: current) found no beans (OnBeanCondition)
ServerPropertiesAutoConfiguration#serverProperties
- #ConditionalOnMissingBean (types: org.springframework.boot.context.embedded.properties.ServerProperties; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- #ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet,org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter (OnClassCondition)
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- #ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet,org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter (OnClassCondition)
- #ConditionalOnMissingBean (types: org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration#hiddenHttpMethodFilter
- #ConditionalOnMissingBean (types: org.springframework.web.filter.HiddenHttpMethodFilter; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#defaultViewResolver
- #ConditionalOnMissingBean (types: org.springframework.web.servlet.view.InternalResourceViewResolver; SearchStrategy: all) found no beans (OnBeanCondition)
Negative matches:
-----------------
RabbitAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.amqp.rabbit.core.RabbitTemplate,com.rabbitmq.client.Channel (OnClassCondition)
AopAutoConfiguration
- required #ConditionalOnClass classes not found: org.aspectj.lang.annotation.Aspect,org.aspectj.lang.reflect.Advice (OnClassCondition)
BatchAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.batch.core.launch.JobLauncher (OnClassCondition)
JpaRepositoriesAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.data.jpa.repository.JpaRepository (OnClassCondition)
MongoRepositoriesAutoConfiguration
- required #ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.repository.MongoRepository (OnClassCondition)
DataSourceAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType (OnClassCondition)
DataSourceTransactionManagerAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionManager (OnClassCondition)
JmsTemplateAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.jms.core.JmsTemplate,javax.jms.ConnectionFactory (OnClassCondition)
DeviceResolverAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.mobile.device.DeviceResolverHandlerInterceptor,org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver (OnClassCondition)
HibernateJpaAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean,org.springframework.transaction.annotation.EnableTransactionManagement,javax.persistence.EntityManager,org.hibernate.ejb.HibernateEntityManager (OnClassCondition)
ReactorAutoConfiguration
- required #ConditionalOnClass classes not found: reactor.spring.context.config.EnableReactor (OnClassCondition)
ThymeleafAutoConfiguration.ThymeleafSecurityDialectConfiguration
- required #ConditionalOnClass classes not found: org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect (OnClassCondition)
ThymeleafAutoConfiguration.ThymeleafWebLayoutConfiguration
- required #ConditionalOnClass classes not found: nz.net.ultraq.thymeleaf.LayoutDialect (OnClassCondition)
EmbeddedServletContainerAutoConfiguration.EmbeddedJetty
- required #ConditionalOnClass classes not found: org.eclipse.jetty.server.Server,org.eclipse.jetty.util.Loader (OnClassCondition)
MultipartAutoConfiguration
- #ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.multipart.support.StandardServletMultipartResolver (OnClassCondition)
- #ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.multipart.support.StandardServletMultipartResolver (OnClassCondition)
- #ConditionalOnBean (types: javax.servlet.MultipartConfigElement; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver
- #ConditionalOnBean (types: org.springframework.web.servlet.View; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#viewResolver
- #ConditionalOnBean (types: org.springframework.web.servlet.View; SearchStrategy: all) found no beans (OnBeanCondition)
WebSocketAutoConfiguration
- required #ConditionalOnClass classes not found: org.springframework.web.socket.WebSocketHandler (OnClassCondition)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embdedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:138)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:552)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:293)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:749)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:738)
at hello.Application.main(Application.java:12)
... 6 more
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embdedded Tomcat
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:85)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:53)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:259)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:140)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:135)
... 13 more
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:81)
... 18 more
I think this is because my port is used. My port 8080 is used so I try the port 8181
I have no application on the port 8181
in the tomcat server.xml I set the port to 8181 but the problem persist
I find this post:
Alternate port for Tomcat (not 8080) when starting with Maven?
But I have the same problem after launching mvn -Dmaven.tomcat.port=8181 tomcat:run-war
I don't realy understand how to maven is linked to the tomcat server
This is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-serving-web-content</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>0.5.0.M6</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring3</artifactId>
</dependency>
</dependencies>
<properties>
<start-class>hello.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Thanks for your help
Spring Boot uses embedded Tomcat by default, but it handles it differently without using tomcat-maven-plugin. To change the port use --server.port parameter for example:
java -jar target/gs-serving-web-content-0.1.0.jar --server.port=8181
Update. Alternatively put server.port=8181 into application.properties (or application.yml).
Run the following command to search for the process that is using the port
lsof -i :<portNumber> | grep LISTEN
in your case this will be -->
lsof -i :8080 | grep LISTEN
java 78960 xyxss 119u IPv6 0x6c20d372bc88c27d 0t0 TCP *:8092 (LISTEN)
The 78960 is the process id, use the following command to kill the process
kill -9 78960
Launch the application again.
Configure another port number(eg:8181) in /src/main/resources/application.properties
server.port=8181
You need to stop the server before re-launching. Look for the red box icon or server view.
In my case looking in the servers window only showed a tomcat server that I had never used for this project. My SpringBoot project used an embedded tomcat server and it did not stop when my application finished. This button which I indicate with a red arrow will stop the application and the Tomcat server so next time I run the application I will not get the error that an Instance of Tomcat is already running on port 8080.
actual error messages:
Verify the connector's configuration, identify and stop any process
that's listening on port 8080, or configure this application to listen
on another port.
Caused by: java.net.BindException: Address already in use Caused by:
org.apache.catalina.LifecycleException: service.getName(): "Tomcat";
Protocol handler start failed
I will now be looking into a way to shut down all services on completion of my SpringBoot Consuming Rest application in this tutorial https://spring.io/guides/gs/consuming-rest/
spring-boot
This error basically happens when the specific port is not free. So there are two solutions, you can free that port by killing or closing the service which is using it or you can run your application (tomcat) on a different port.
Solution 1: Free the port
On a Linux machine you can find the process-id of port's consumer and then kill it. Use the following command (it is assume that the default port is 8080)
netstat -pnltu | grep -i "8080"
The output of the above-mentioned command would be something like:
tcp6 0 0 :::8080 :::* LISTEN 20674/java
Then you can easily kill the process with its processid:
kill 20674
On a windows machine to find a processid use netstat -ano -p tcp |find "8080". To kill the process use taskkill /F /PID 1234 (instead of 1234 enter the founded processid).
Solution 2: Change the default port
In the development process developers use the port 8080 that you can change it easily. You need to specify your desired port number in the application.properties file of your project (/src/main/resources/application.properties) by using the following specification:
server.port=8081
You can also set an alternative port number while executing the .jar file
- java -jar spring-boot-application.jar --server.port=8081
Please notice that sometimes (not necessarily) you have to change other ports too like:
management.port=
tomcat.jvmroute=
tomcat.ajp.port=
tomcat.ajp.redirectPort=
etc...
Using IntelliJ, I got this error when I tried to run a Spring app while there was one app already running. I had to stop the first one. After that, running the second app didn't return any errors.
first, check that who uses port 8080.
telnet localhost 8080
use browser to open http://localhost:8080
if the port 8080 is in use, change the listening port to 8181.
if you use IDEA, modify start configuration,
Run-> Edit Configuration
enter image description here
if you use mvn spring-boot, then use the command:
mvn spring-boot:run -Dserver.port=8181
if you use java -jar, then use the command:
java -jar xxxx.jar --server.port=8181
This only worked for me by setting additional properties and using available arbitrary port numbers, like this:
YML
/src/main/resources/application.yml
server:
port: 18181
management:
port: 9191
tomcat:
jvmroute: 5478
ajp:
port: 4512
redirectPort: 1236
Properties
/src/main/resources/application.properties
server.port=18181
management.port=9191
tomcat.jvmroute=5478
tomcat.ajp.port=4512
tomcat.ajp.redirectPort=1236
I would suggest to kill the port number. It worked for me
netstat -ano | findstr :yourPortNumber taskkill /PID typeyourPIDhere /F
In your application.properties file -
/src/main/resources/application.properties
Change the port number to something like this -
server.port=8181
Or alternatively you can provide alternative port number while executing your jar file -
java -jar resource-server/build/libs/resource-server.jar --server.port=8888
you can configure another port number in your IDE
/src/main/resources/application.properties
server.port=8081
otherwise right click on the IDE console tab and select Terminate/Disconnect All
Right click in console and click Terminate/Disconnect All option.
OR
Click on 'Display selected console' icon on top right corner of the console window and, choose and terminate the console which holds the port still.
In my case, Oracle TNS Service was using port 8080, found that using running the command "netstat - anob" as an administrator. Simply used Shutdown Database from the Windows start menu to stop that service and was able to start the SpringBoot app without any issue.
Also if you cannot find out which app is using the 8080 port and just want to run the SprintBoot app, you can click on Run As... and in the VM arguments enter:
-Dserver.port=0 (this will pick any random available port) or you can be specific like: -Dserver.port=8081
Hope it helps.
You can resolve this following these steps:
Right click on the project you are running.
Click on Run as and Run Configurations from the option.
A new run configuration will open. Under Spring Boot Tab see for Override properties.
Add the property-value pair as server.port=8181, or any other port of your choice. This will override the default port which is 8080
It is really old question. Maybe this is usefull. Focusing in your title problem, it is how I start my applications and then I can easily shutdown them. Change the port number for each application you want to start as mentioned above.
application.properties
#using curl -X POST localhost:8080/actuator/shutdown to avoid:
#netstat -ano | find "8080"
#taskkill /F /PID xxxx (xxxx stands for PID)
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
endpoints.shutdown.enabled=true
add this dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Now you can shotdown easily by
curl -X POST localhost:8080/actuator/shutdown
I was looking for a solution for Windows but didn't found any.
Finally, figured out that that there is a dangling java application using the port. Maybe it's the earlier instance of the spring application and ended the process.
I used tcpview from Microsoft. It shows services/applications using which port on your computer.
You can end the process. And Done!
This is because the port is already running in the background.So you can restart the eclipse and try again.
OR
open the file application.properties and change the value of 'server.port' to some other value like ex:- 8000/8181
I resolved this problem, by stop the application (red square in Eclipse) before run again.
If you don't stop it , the application stay in run mode , so port still used .
You have another process that’s listening on port 8080 which is the default port that’s used by Spring Boot’s web support. You either need to stop that process or configure your app to listen on another port.
You can change the port configuration by adding server.port=4040 (for example) to src/main/resources/application.properties
Basically the default server usually run on the background at port 8080.
Open services.msc and stop tomcat server and try running the spring boot application again.
In Eclipse, if Spring Tool Suite is installed, you can go to Boot Dashboard and expand local in explorer and right click on the application that is running on port 8080 and stop it before you re run your application.
I try to change port number in the following file - /src/main/resources/application-prod.yml
And inside this file I made this change:
server:
port: 8100 (or whatever you want)
I hope that this will works good for you
Just met same problem.
Finally I found the process running on 8080 was owned by other user, such as root. which caused I (user dev) can't find it by lsof -i :8080 or lsof -t -i :8080 -s TCP:LISTEN.
Close the application, then restart it after changing to a new port:
${port:8181}
You can use any new unused port. Here, I used port 8181.
I was getting same issue, i.e. protocol handler start failed. Cause was port is already in use. I found whether the port was in use or not. It was. So I killed the process that was running on that port and restarted my spring boot application. And it worked. :)
Related
After a discussion with #RasmusFaber, the author of the most upvoted answer to
How to prevent logback from outputting its own status at the start of every log when using a layout, I decided to create a new question as the solution in that question is not applicable to my problem.
I am building a Spring Boot application by Maven.
I'd like to get rid of the log output from ch.qos.logback when I run mvn clean install. I want to disable the Logback's own status messages as shown below.
I believe I applied all the hints given here in StackOverflow (including the above mentioned question) and everywhere else. Still I cannot make my build silent.
Please notice that all the log lines are INFO, not even WARN. So it is not a problem of missing logback-access.xml file. The logback framework show an INFO message even when if does find the file - see the 3rd line. Furthermore there are other INFO messages which are just a garbage.
Logback's own status messages I want to disable
10:51:16,066 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [C:\Users\xxxx\AppData\Local\Temp\tomcat.6036202080949559352.0\logback-access.xml] using property "catalina.base"
10:51:16,066 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [C:\Users\xxxx\AppData\Local\Temp\tomcat.6036202080949559352.0\logback-access.xml] using property "catalina.home"
10:51:16,066 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Found [logback-access.xml] as a resource.
10:51:16,081 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - debug attribute not set
10:51:16,081 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - End of configuration.
10:51:16,081 |-INFO in ch.qos.logback.access.joran.JoranConfigurator#2831c178 - Registering current configuration as safe fallback point
10:51:16,081 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Done configuring
Wider context
(when I temporarily set all the log levels to DEBUG)
...
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # my-application ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.xxxx.MyUnitTest
...
2020-11-27 14:06:33.590 DEBUG 2656 --- [ main] .c.l.ClasspathLoggingApplicationListener : Application started with classpath: unknown
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.4.RELEASE)
2020-11-27 14:06:33.675 INFO 2656 --- [ main] c.xxxx.MyUnitTest : No active profile set, falling back to default profiles: default
2020-11-27 14:06:33.676 DEBUG 2656 --- [ main] o.s.boot.SpringApplication : Loading source class com.xxxx.MyApplication,class org.springframework.cloud.bootstrap.BootstrapApplicationListener$BootstrapMarkerConfiguration
2020-11-27 14:06:33.694 DEBUG 2656 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'file:/C:/workspace/my-application/target/test-classes/application.properties' (classpath:/application.properties)
2020-11-27 14:06:33.695 DEBUG 2656 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#280d4882
...
2020-11-27 14:06:41.791 DEBUG 2656 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Starting filters
...
2020-11-27 14:06:41.803 DEBUG 2656 --- [ main] o.apache.catalina.core.StandardContext : Starting completed
############## START OF THE UNWANTED LOG ##############
14:06:41,811 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [C:\Users\xxxx\AppData\Local\Temp\tomcat.4629575738537063162.0\logback-access.xml] using property "catalina.base"
14:06:41,811 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Could NOT configuration file [C:\Users\xxxx\AppData\Local\Temp\tomcat.4629575738537063162.0\logback-access.xml] using property "catalina.home"
14:06:41,812 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Found [logback-access.xml] as a resource.
14:06:41,869 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - debug attribute not set
14:06:41,869 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - End of configuration.
14:06:41,869 |-INFO in ch.qos.logback.access.joran.JoranConfigurator#62732be7 - Registering current configuration as safe fallback point
14:06:41,869 |-INFO in ch.qos.logback.access.tomcat.LogbackValve[null] - Done configuring
############## END OF THE UNWANTED LOG ##############
2020-11-27 14:06:41.876 DEBUG 2656 --- [ main] org.apache.catalina.mapper.Mapper : Registered host [localhost]
2020-11-27 14:06:41.877 DEBUG 2656 --- [ main] o.apache.catalina.mapper.MapperListener : Register Wrapper [default] in Context [] for service [StandardService[Tomcat]]
2020-11-27 14:06:41.878 DEBUG 2656 --- [ main] o.apache.catalina.mapper.MapperListener : Register Wrapper [dispatcherServlet] in Context [] for service [StandardService[Tomcat]]
2020-11-27 14:06:41.878 DEBUG 2656 --- [ main] o.apache.catalina.mapper.MapperListener : Register Context [] for service [StandardService[Tomcat]]
2020-11-27 14:06:41.879 DEBUG 2656 --- [ main] o.apache.catalina.mapper.MapperListener : Register host [localhost] at domain [null] for service [StandardService[Tomcat]]
...
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 54.705 s - in com.xxxx.MyUnitTest
Directory structure:
\---src
\---test
+---java
| ...
\---resources
| application.properties
| logback-access.xml
| logback-test.xml
application.properties
logging.level.root=ERROR
logging.level.org.springframework=ERROR
logging.level.ch.qos.logback=ERROR
logback-test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="org.springframework" level="ERROR"/>
<logger name="ch.qos" level="ERROR"/>
<root level="OFF">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
logback-access.xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration />
POM.XML (only relevant lines left)
<project ...>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I have a spring boot app using a component (jar) that got some annotations and an aspectj advice (.aj). Both are maven projects and the component (jar) build runs all fine, but with the spring app I'm not been able to build it successfully.
Basically my aspect is used to log some info. It looks for a trigger annotation (#GetMapping in this case) and when the thread finishes it's processing, some collected data will be displayed. For that, my spring app may have some methods annotated with #Loggable to determine which ones will have their data collected or not.
Please notice that I need more than Spring AOP offers and just for example I simplified the things to reproduce my error.
The classes are apparently woven successfully, but when maven is running tests (app starting) I get the following error:
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.673 s <<< FAILURE! - in com.rct.aspectj.myaspectjapp.MyaspectjAppApplicationTests
[ERROR] contextLoads Time elapsed: 0.002 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAspectResource' defined in file [C:\workspace\myaspectj-app\target\test-classes\com\rct\aspectj\myaspectjapp\resource\MyAspectResource.class]: BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.IllegalArgumentException: Class 'com.rct.aspectj.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
Caused by: java.lang.IllegalArgumentException: Class 'com.rct.aspectj.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
Here are my spring app pom and some classes snippets. Example code can be found here: https://github.com/rctbatista/myaspectj-project
Controller:
#RestController
#RequestMapping(path = "/aspect")
public class MyAspectResource {
#Autowired
private SomeService service;
#GetMapping(path = "/sayhello/{name}") //#GetMapping annotation that triggers my aspect
public ResponseEntity<String> teste(#PathVariable String name){
return ResponseEntity.ok(service.sayHello(name));
}
}
Service
#Service
public class SomeServiceImpl implements SomeService {
#Loggable
#Override
public String sayHello(String name) {
try {
long timeToSleep = new Random().nextInt(1000) + 1000;
Thread.sleep(timeToSleep);
} catch (Exception e) {
e.printStackTrace();
}
return "Hello " + name;
}
}
Spring app POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.rct.aspectj</groupId>
<artifactId>myaspectj-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>myaspectj-app</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<aspectj.version>1.9.5</aspectj.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.rct.aspectj</groupId>
<artifactId>myaspectj-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11</version>
<dependencies>
<!-- updagrading the aspectjtools version for aspectj-maven-plugin -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<configuration>
<complianceLevel>${java.version}</complianceLevel>
<source>${java.version}</source>
<target>${java.version}</target>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<encoding>UTF-8</encoding>
<weaveDirectories>
<weaveDirectory>${project.build.directory}/classes
</weaveDirectory>
</weaveDirectories>
<aspectLibraries>
<aspectLibrary>
<groupId>com.rct.aspectj</groupId>
<artifactId>myaspectj-lib</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<id>weaving-classes</id>
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
</project>
More details of the error:
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.rct.aspectj:myaspectj-app >--------------------
[INFO] Building myaspectj-app 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
...
[INFO]
[INFO] --- aspectj-maven-plugin:1.11:compile (weaving-classes) # myaspectj-app ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[INFO] Join point 'method-execution(org.springframework.http.ResponseEntity c.r.a.myaspectjapp.resource.MyAspectResource.teste(java.lang.String))' in Type 'c.r.a.myaspectjapp.resource.MyAspectResource' (MyAspectResource.java:22) advised by before advice from 'c.r.a.core.aspect.LoggableAspect' (myaspectj-lib-0.0.1-SNAPSHOT.jar!LoggableAspect.class:20(from LoggableAspect.aj)) [with runtime test]
[INFO] Join point 'method-execution(org.springframework.http.ResponseEntity c.r.a.myaspectjapp.resource.MyAspectResource.teste(java.lang.String))' in Type 'c.r.a.myaspectjapp.resource.MyAspectResource' (MyAspectResource.java:22) advised by afterReturning advice from 'c.r.a.core.aspect.LoggableAspect' (myaspectj-lib-0.0.1-SNAPSHOT.jar!LoggableAspect.class:26(from LoggableAspect.aj)) [with runtime test]
[INFO] Join point 'method-execution(java.lang.String c.r.a.myaspectjapp.service.SomeServiceImpl.sayHello(java.lang.String))' in Type 'c.r.a.myaspectjapp.service.SomeServiceImpl' (SomeServiceImpl.java:14) advised by around advice from 'c.r.a.core.aspect.LoggableAspect' (myaspectj-lib-0.0.1-SNAPSHOT.jar!LoggableAspect.class:36(from LoggableAspect.aj)) [with runtime test]
[INFO]
[INFO] --- aspectj-maven-plugin:1.11:test-compile (weaving-classes) # myaspectj-app ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[INFO] Join point 'method-execution(java.lang.String c.r.a.myaspectjapp.service.SomeServiceImpl.sayHello(java.lang.String))' in Type 'c.r.a.myaspectjapp.service.SomeServiceImpl' (SomeServiceImpl.java:14) advised by around advice from 'c.r.a.core.aspect.LoggableAspect' (myaspectj-lib-0.0.1-SNAPSHOT.jar!LoggableAspect.class:36(from LoggableAspect.aj)) [with runtime test]
[INFO] Join point 'method-execution(org.springframework.http.ResponseEntity c.r.a.myaspectjapp.resource.MyAspectResource.teste(java.lang.String))' in Type 'c.r.a.myaspectjapp.resource.MyAspectResource' (MyAspectResource.java:22) advised by before advice from 'c.r.a.core.aspect.LoggableAspect' (myaspectj-lib-0.0.1-SNAPSHOT.jar!LoggableAspect.class:20(from LoggableAspect.aj)) [with runtime test]
[INFO] Join point 'method-execution(org.springframework.http.ResponseEntity c.r.a.myaspectjapp.resource.MyAspectResource.teste(java.lang.String))' in Type 'c.r.a.myaspectjapp.resource.MyAspectResource' (MyAspectResource.java:22) advised by afterReturning advice from 'c.r.a.core.aspect.LoggableAspect' (myaspectj-lib-0.0.1-SNAPSHOT.jar!LoggableAspect.class:26(from LoggableAspect.aj)) [with runtime test]
[INFO]
...
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # myaspectj-app ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running c.r.a.myaspectjapp.MyaspectjAppApplicationTests
18:02:54.568 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
18:02:54.587 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
18:02:54.638 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
18:02:54.668 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither #ContextConfiguration nor #ContextHierarchy found for test class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests], using SpringBootContextLoader
18:02:54.676 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests]: class path resource [com/rct/aspectj/myaspectjapp/MyaspectjAppApplicationTests-context.xml] does not exist
18:02:54.695 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests]: class path resource [com/rct/aspectj/myaspectjapp/MyaspectjAppApplicationTestsContext.groovy] does not exist
18:02:54.702 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
18:02:54.705 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests]: MyaspectjAppApplicationTests does not declare any static, non-private, non-final, nested classes annotated with #Configuration.
18:02:54.814 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests]
18:02:54.954 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\workspace\myaspectj-app\target\test-classes\com\rct\aspectj\myaspectjapp\MyaspectjAppApplication.class]
18:02:54.962 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\workspace\myaspectj-app\target\classes\com\rct\aspectj\myaspectjapp\MyaspectjAppApplication.class]
18:02:54.974 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found #SpringBootConfiguration c.r.a.myaspectjapp.MyaspectjAppApplication for test class c.r.a.myaspectjapp.MyaspectjAppApplicationTests
18:02:55.155 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - #TestExecutionListeners is not present for class [c.r.a.myaspectjapp.MyaspectjAppApplicationTests]: using defaults.
18:02:55.156 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
18:02:55.192 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
18:02:55.195 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
18:02:55.195 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener#4310d43, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener#54a7079e, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener#26e356f0, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener#47d9a273, org.springframework.test.context.support.DirtiesContextTestExecutionListener#4b8ee4de, org.springframework.test.context.event.EventPublishingTestExecutionListener#27f981c6, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener#1b11171f, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener#1151e434, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener#2dc54ad4, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener#4659191b, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener#55634720, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener#4b0d79fc]
18:02:55.222 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext#273e7444 testClass = MyaspectjAppApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration#7db12bb6 testClass = MyaspectjAppApplicationTests, locations = '{}', classes = '{class c.r.a.myaspectjapp.MyaspectjAppApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer#76908cc0, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer#49b0b76, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer#0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer#e056f20, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer#0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer#6ca8564a, org.springframework.boot.test.context.SpringBootTestArgs#1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with #DirtiesContext [false] with mode [null].
18:02:55.294 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.1.RELEASE)
2020-06-15 18:02:55.848 INFO 11328 --- [ main] c.r.a.m.MyaspectjAppApplicationTests : Starting MyaspectjAppApplicationTests on d4253s000n186 with PID 11328 (started by F929362 in C:\workspace\myaspectj-app)
2020-06-15 18:02:55.852 INFO 11328 --- [ main] c.r.a.m.MyaspectjAppApplicationTests : No active profile set, falling back to default profiles: default
2020-06-15 18:02:56.908 WARN 11328 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAspectResource' defined in file [C:\workspace\myaspectj-app\target\test-classes\com\rct\aspectj\myaspectjapp\resource\MyAspectResource.class]: BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.IllegalArgumentException: Class 'c.r.a.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
2020-06-15 18:02:56.937 INFO 11328 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-15 18:02:56.947 ERROR 11328 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAspectResource' defined in file [C:\workspace\myaspectj-app\target\test-classes\com\rct\aspectj\myaspectjapp\resource\MyAspectResource.class]: BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.IllegalArgumentException: Class 'c.r.a.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
...
2020-06-15 18:02:56.953 ERROR 11328 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener#4310d43] to prepare test instance [c.r.a.myaspectjapp.MyaspectjAppApplicationTests#437ebf59]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132) ~[spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:123) ~[spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:244) ~[spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:98) [spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$5(ClassBasedTestDescriptor.java:341) [junit-jupiter-engine-5.6.2.jar:5.6.2]
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:346) [junit-jupiter-engine-5.6.2.jar:5.6.2]
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$6(ClassBasedTestDescriptor.java:341) [junit-jupiter-engine-5.6.2.jar:5.6.2]
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAspectResource' defined in file [C:\workspace\myaspectj-app\target\test-classes\com\rct\aspectj\myaspectjapp\resource\MyAspectResource.class]: BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.IllegalArgumentException: Class 'c.r.a.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:512) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:893) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) ~[spring-boot-test-2.3.1.RELEASE.jar:2.3.1.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~[spring-test-5.2.7.RELEASE.jar:5.2.7.RELEASE]
... 65 common frames omitted
Caused by: java.lang.IllegalArgumentException: Class 'c.r.a.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
at org.springframework.aop.aspectj.annotation.AspectMetadata.<init>(AspectMetadata.java:95) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.aop.aspectj.annotation.BeanFactoryAspectJAdvisorsBuilder.buildAspectJAdvisors(BeanFactoryAspectJAdvisorsBuilder.java:106) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors(AnnotationAwareAspectJAutoProxyCreator.java:95) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:101) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:251) ~[spring-aop-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1141) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1114) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:506) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
... 79 common frames omitted
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.673 s <<< FAILURE! - in c.r.a.myaspectjapp.MyaspectjAppApplicationTests
[ERROR] contextLoads Time elapsed: 0.002 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAspectResource' defined in file [C:\workspace\myaspectj-app\target\test-classes\com\rct\aspectj\myaspectjapp\resource\MyAspectResource.class]: BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.IllegalArgumentException: Class 'c.r.a.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
Caused by: java.lang.IllegalArgumentException: Class 'c.r.a.myaspectjapp.MyaspectjAppApplication$$EnhancerBySpringCGLIB$$12a7b207' is not an #AspectJ aspect
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] MyaspectjAppApplicationTests.contextLoads » IllegalState Failed to load Applic...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.149 s
[INFO] Finished at: 2020-06-15T18:02:57-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project myaspectj-app: There are test failures.
[ERROR]
[ERROR] Please refer to C:\workspace\myaspectj-app\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Anybody seeing anything wrong or missing that might be the cause of the exception?
You can fix this adding spring.aop.auto=false on your application.properties
I found this at
https://howtodoinjava.com/spring-boot2/aop-aspectj/
I am starting to learn springboot and already encountered an error. I tried searching for this error, but i wasn't able to find it. I have inserted the pictures of the entire error as well as my code for the pom.xml and the main class.
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
</project>
Main
package io.java.springbootstarter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class CourseApiApp {
public static void main(String[] args) {
SpringApplication.run(CourseApiApp.class, args);
}
}
This was the description for the error:
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
2018-03-21 22:47:48.794 INFO 9412 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#f75083: startup date [Wed Mar 21 22:47:46 EDT 2018]; root of context hierarchy
2018-03-21 22:47:48.794 INFO 9412 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
Error,
Error Continued
Thank you in advance.
If you are using linux/mac, u can try this command :
lsof -i :8080
This will return the process id along with other information, then use the following command to kill the process :
kill -9 your_process_id
This way, you need not to change the port anymore.
In case the other process is a java process as well, you could also just do jps which shows all running java processes and kill it accordingly.
The port 8080 in using, you should use another port. You can config in application.properties by setting server.port
For me just restarting my computer worked. As the error message says some application was already using the specified port.
I've recently managed to upgrade a jhipster generated app (Spring Boot + Angular)
Issue comes after cleaning code and adapting a few annotations, now I get success when doing a maven clean - install skipping tests but when I try to start the app I get the error mentioned in the title
I've checked pom for duplicated dependencies and had a clean out of the properties file, to no result
This is the full error:
2017-11-30 10:12:57.821 INFO 4320 --- [ restartedMain] o.w.d.DrugQualityDataManagerApp : Starting DrugQualityDataManagerApp on steven-OptiPlex-7040 with PID 4320 (/home/steven/Desktop/Upgraded_MQ/target/classes started by steven in /home/steven/Desktop/Upgraded_MQ)
2017-11-30 10:12:57.821 INFO 4320 --- [ restartedMain] o.w.d.DrugQualityDataManagerApp : The following profiles are active: swagger,dev
2017-11-30 10:12:57.874 ERROR 4320 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/EmbeddedValueResolver
at org.springframework.context.support.ApplicationContextAwareProcessor.<init>(ApplicationContextAwareProcessor.java:72)
at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:634)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.wwarn.drugquality.DrugQualityDataManagerApp.main(DrugQualityDataManagerApp.java:66)
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:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.config.EmbeddedValueResolver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 common frames omitted
2017-11-30 10:12:58.127 WARN 4320 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#350e9339: startup date [Thu Nov 30 10:12:57 GMT 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:427)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:999)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.wwarn.drugquality.DrugQualityDataManagerApp.main(DrugQualityDataManagerApp.java:66)
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:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Disconnected from the target VM, address: '127.0.0.1:43599', transport: 'socket'
Process finished with exit code 1
My pom.xml (I had to embed it in a jsFiddle as it's too long for the body of an SO post)
Properties file:
spring:
profiles:
active: dev
include: swagger
devtools:
restart:
enabled: true
livereload:
enabled: false # we use gulp + BrowserSync for livereload
jackson:
serialization.indent_output: true
datasource:
url: jdbc:mysql://localhost:3306/myDB?useUnicode=true&characterEncoding=utf8
username: myDB
password: myDB
h2:
console:
enabled: false
jpa:
database-platform: org.hibernate.dialect.MySQLDialect
database: MYSQL
show_sql: false
generate-ddl: true
hibernate:
ddl-auto: update
naming:
physical-strategy: org.wwarn.drugquality.config.HibernateAuditTablesNamingStrategy
properties:
hibernate.id.new_generator_mappings: true
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: true
hibernate.cache.region.factory_class: org.hibernate.cache.jcache.JCacheRegionFactory
data:
elasticsearch:
cluster-name:
cluster-nodes:
properties:
path:
logs: target/elasticsearch/log
data: target/elasticsearch/data
mail:
host: localhost
port: 25
username:
password:
messages:
cache-seconds: 1
thymeleaf:
cache: false
liquibase:
contexts: dev
server:
port: 8080
jhipster:
http:
version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration)
cache: # Cache configuration
ehcache: # Ehcache configuration
time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
max-entries: 100 # Number of objects in each cache entry
# CORS is only enabled by default with the "dev" profile, so BrowserSync can access the API
cors:
allowed-origins: "*"
allowed-methods: "*"
allowed-headers: "*"
allow-credentials: true
max-age: 1800
security:
remember-me:
# security key (this key should be unique for your application, and kept secret)
key: daKey
mail: # specific JHipster mail property, for standard properties see MailProperties
from: DrugQualityDataManager#localhost
base-url: http://127.0.0.1:8080
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
jmx.enabled: true
graphite: # Use the "graphite" Maven profile to have the Graphite dependencies
enabled: false
host: localhost
port: 2003
prefix: DrugQualityDataManager
prometheus: # Use the "prometheus" Maven profile to have the Prometheus dependencies
enabled: false
endpoint: /prometheusMetrics
logs: # Reports Dropwizard metrics in the logs
enabled: false
report-frequency: 60 # in seconds
logging:
logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
enabled: false
host: localhost
port: 5000
queue-size: 512
# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JHipsterProperties above
#
# More documentation is available at:
# http://www.jhipster.tech/common-application-properties/
# ===================================================================
application:
In your fiddled pom there is this dep:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.2.9.RELEASE</version>
</dependency>
The EmbeddedValueResolver was introduced in Spring 4.3
You might want to clean up your dependencies. Perhaps it's sufficient to pull spring-beans up to 4.3
There are two project I have build( more than two indeed),the 1st one is DataCollector which do data service built with Spring and Hibernate, the 2nd is CoreProcessor which do analysis to these data built with Drools. The CoreProcessor need call some methods supported by DataCollector to return data for itself, these methods will first find application context .xml file, and then create session and do queries.When I test there method in DataCollector project, they are run smoothly, However it returns Error when CoreProcessor project calls them.
Here is the Error Message:
21:14:57.332 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
21:14:57.336 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
21:14:57.336 [main] DEBUG o.s.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
21:14:57.340 [main] INFO o.s.c.s.ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#6108b2d7: startup date [Mon Apr 11 21:14:57 CST 2016]; root of context hierarchy
21:14:57.378 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
21:14:57.379 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
21:14:57.379 [main] DEBUG o.s.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
21:14:57.390 [main] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [ConnectToLocalDataBase.xml]
21:14:57.402 [main] DEBUG o.s.b.f.xml.DefaultDocumentLoader - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
21:14:57.422 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Loading schema mappings from [META-INF/spring.schemas]
21:14:57.428 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Loaded schema mappings: {http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/cache/spring-cache-4.2.xsd=org/springframework/cache/config/spring-cache-4.2.xsd, http://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd=org/springframework/jdbc/config/spring-jdbc-4.1.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.2.xsd=org/springframework/aop/config/spring-aop-3.2.xsd, http://www.springframework.org/schema/lang/spring-lang-4.1.xsd=org/springframework/scripting/config/spring-lang-4.1.xsd, http://www.springframework.org/schema/context/spring-context-4.0.xsd=org/springframework/context/config/spring-context-4.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd=org/springframework/web/servlet/config/spring-mvc-3.2.xsd, http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd=org/springframework/oxm/config/spring-oxm-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-3.2.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd, http://www.springframework.org/schema/cache/spring-cache-3.2.xsd=org/springframework/cache/config/spring-cache-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee-4.1.xsd=org/springframework/ejb/config/spring-jee-4.1.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd=org/springframework/jdbc/config/spring-jdbc-3.1.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/task/spring-task-4.2.xsd=org/springframework/scheduling/config/spring-task-4.2.xsd, http://www.springframework.org/schema/tool/spring-tool-3.2.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-4.2.xsd, http://www.springframework.org/schema/tx/spring-tx-4.2.xsd=org/springframework/transaction/config/spring-tx-4.2.xsd, http://www.springframework.org/schema/cache/spring-cache-4.1.xsd=org/springframework/cache/config/spring-cache-4.1.xsd, http://www.springframework.org/schema/aop/spring-aop-4.0.xsd=org/springframework/aop/config/spring-aop-4.0.xsd, http://www.springframework.org/schema/jee/spring-jee-3.2.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd=org/springframework/jdbc/config/spring-jdbc-4.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd=org/springframework/web/servlet/config/spring-mvc-4.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd, http://www.springframework.org/schema/aop/spring-aop-3.1.xsd=org/springframework/aop/config/spring-aop-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-4.0.xsd=org/springframework/scripting/config/spring-lang-4.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc.xsd=org/springframework/web/servlet/config/spring-mvc-4.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd=org/springframework/web/servlet/config/spring-mvc-3.1.xsd, http://www.springframework.org/schema/tool/spring-tool-4.0.xsd=org/springframework/beans/factory/xml/spring-tool-4.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.2.xsd=org/springframework/transaction/config/spring-tx-3.2.xsd, http://www.springframework.org/schema/lang/spring-lang-3.1.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd, http://www.springframework.org/schema/cache/spring-cache-3.1.xsd=org/springframework/cache/config/spring-cache-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-4.0.xsd=org/springframework/ejb/config/spring-jee-4.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/task/spring-task-4.1.xsd=org/springframework/scheduling/config/spring-task-4.1.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc.xsd=org/springframework/jdbc/config/spring-jdbc-4.2.xsd, http://www.springframework.org/schema/tool/spring-tool-3.1.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd, http://www.springframework.org/schema/tx/spring-tx-4.1.xsd=org/springframework/transaction/config/spring-tx-4.1.xsd, http://www.springframework.org/schema/cache/spring-cache-4.0.xsd=org/springframework/cache/config/spring-cache-4.0.xsd, http://www.springframework.org/schema/jee/spring-jee-3.1.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd, http://www.springframework.org/schema/task/spring-task-3.2.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd, http://www.springframework.org/schema/beans/spring-beans-4.0.xsd=org/springframework/beans/factory/xml/spring-beans-4.0.xsd, http://www.springframework.org/schema/oxm/spring-oxm-4.2.xsd=org/springframework/oxm/config/spring-oxm-4.2.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-4.0.xsd, http://www.springframework.org/schema/web-services/web-services.xsd=/org/springframework/ws/config/web-services-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.1.xsd=org/springframework/transaction/config/spring-tx-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/task/spring-task-4.0.xsd=org/springframework/scheduling/config/spring-task-4.0.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-4.0.xsd=org/springframework/transaction/config/spring-tx-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-4.2.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/oxm/spring-oxm.xsd=org/springframework/oxm/config/spring-oxm-4.2.xsd, http://www.springframework.org/schema/util/spring-util-3.2.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd, http://www.springframework.org/schema/oxm/spring-oxm-4.1.xsd=org/springframework/oxm/config/spring-oxm-4.1.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-4.2.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/context/spring-context-4.2.xsd=org/springframework/context/config/spring-context-4.2.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd=org/springframework/oxm/config/spring-oxm-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/web-services/web-services-2.0.xsd=/org/springframework/ws/config/web-services-2.0.xsd, http://www.springframework.org/schema/util/spring-util-4.0.xsd=org/springframework/beans/factory/xml/spring-util-4.0.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-4.2.xsd, http://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd=org/springframework/jdbc/config/spring-jdbc-4.2.xsd, http://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/oxm/spring-oxm-4.0.xsd=org/springframework/oxm/config/spring-oxm-4.0.xsd, http://www.springframework.org/schema/cache/spring-cache.xsd=org/springframework/cache/config/spring-cache-4.2.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-4.2.xsd, http://www.springframework.org/schema/lang/spring-lang-4.2.xsd=org/springframework/scripting/config/spring-lang-4.2.xsd, http://www.springframework.org/schema/context/spring-context-4.1.xsd=org/springframework/context/config/spring-context-4.1.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd=org/springframework/oxm/config/spring-oxm-3.1.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/jee/spring-jee-4.2.xsd=org/springframework/ejb/config/spring-jee-4.2.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd=org/springframework/jdbc/config/spring-jdbc-3.2.xsd, http://www.springframework.org/schema/web-services/web-services-1.5.xsd=/org/springframework/ws/config/web-services-1.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-4.0.xsd}
21:14:57.429 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Found XML schema [http://www.springframework.org/schema/beans/spring-beans.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-4.0.xsd
21:14:57.466 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Found XML schema [http://www.springframework.org/schema/context/spring-context.xsd] in classpath: org/springframework/context/config/spring-context-4.2.xsd
21:14:59.078 [main] DEBUG o.s.b.f.x.DefaultBeanDefinitionDocumentReader - Loading bean definitions
21:14:59.090 [main] DEBUG o.s.b.f.x.DefaultNamespaceHandlerResolver - Loaded NamespaceHandler mappings: {http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/mvc=org.springframework.web.servlet.config.MvcNamespaceHandler, http://www.springframework.org/schema/web-services=org.springframework.ws.config.WebServicesNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/jdbc=org.springframework.jdbc.config.JdbcNamespaceHandler, http://www.springframework.org/schema/oxm=org.springframework.oxm.config.OxmNamespaceHandler, http://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler, http://www.springframework.org/schema/c=org.springframework.beans.factory.xml.SimpleConstructorNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler}
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [ConnectToLocalDataBase.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment;
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:251)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at Testcase.TestDataSource.getTestBill(TestDataSource.java:20)
at testCases.DataRequestTest.main(DataRequestTest.java:14)
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment;
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:81)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1426)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1416)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:103)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:510)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
... 15 more
Check the below link. It mentions the same error. You need to add an extra dependency
NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment; With zkoss
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>