I would like to use the Specs2 test framework for testing, but I am getting an java.lang.reflect.MalformedParameterizedTypeException when I try to integrate it with Spring.
There is a specs2-spring library, but that is using 2.10 and an old version of specs2. I looked at this question about scalaTest and it got me to this code:
#ContextConfiguration(Array("classpath:applicationContext.xml"))
class TryItTest extends SpecificationWithJUnit{
#Autowired val db:DriverManagerDataSource = null
new TestContextManager(this.getClass()).prepareTestInstance(this)
"this thing should" should{
"run ok" in {
db.getConnection
success
}
}
}
but when I try to run the test I get:
Nov 09, 2015 2:11:31 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Nov 09, 2015 2:11:31 PM org.springframework.context.support.GenericApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.GenericApplicationContext#243d315f: startup date [Mon Nov 09 14:11:31 EST 2015]; root of context hierarchy
Nov 09, 2015 2:11:31 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
Nov 09, 2015 2:11:31 PM org.springframework.test.context.TestContextManager prepareTestInstance
SEVERE: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener#131746d9] to prepare test instance [my.package.TryItTest#12474a03]
java.lang.reflect.MalformedParameterizedTypeException
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:51)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92)
at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:94)
at java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:284)
at java.lang.reflect.Method.getGenericParameterTypes(Method.java:282)
at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:387)
at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:116)
If I switch from SpecificationWithJUnit to SpecWithJUnit it runs the test without error, but I do not want to have in include all those traits by hand. I think (at least) one of the traits in Matchers is causing the problem. Has anyone else tried to do this with Specs2? Am I missing something important?
(I am using Spring V4.1.0.RELEASE)
Got it. I was not using the latest version of scalaz and specs2. Everything works perfectly now.
Related
HelloWorld obj = (HelloWorld) context.getBean("helloWorld");
obj.getMessage();
context.registerShutdownHook();
below the output:
Feb 03, 2017 11:46:12 AM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#799f7e29: startup date [Fri Feb 03 11:46:12 IST 2017]; root of context hierarchy
Feb 03, 2017 11:46:12 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [Beans.xml]
Bean is going through init.
Your Message : Hello World!
Bean will destroy now.
Whereas using context.close() gives
Feb 03, 2017 11:53:57 AM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#799f7e29: startup date [Fri Feb 03 11:53:57 IST 2017]; root of context hierarchy
Feb 03, 2017 11:53:57 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [Beans.xml]
Bean is going through init.
Your Message : Hello World!
Feb 03, 2017 11:53:57 AM org.springframework.context.support.ClassPathXmlApplicationContext doClose
INFO: Closing org.springframework.context.support.ClassPathXmlApplicationContext#799f7e29: startup date [Fri Feb 03 11:53:57 IST 2017]; root of context hierarchy
Bean will destroy now.
Could someone explain the difference?
The ApplicationContext class doesn't define either of these methods as a part of its interface, but the ConfigurableApplicationContext does define both of these.
From the JavaDoc:
close() -- Close this application context, destroying all beans in its bean factory.
registerShutdownHook() -- Register a shutdown hook with the JVM runtime, closing this context on JVM shutdown unless it has already been closed at that time.
Basically, AbstractApplicationContext#close() will close, or shutdown, the ApplicationContext at the time it is invoked, while AbstractApplicationContext#registerShutdownHook() will close, or shutdown, the ApplicationContext at a later time when the JVM is shutting down for whatever reason. This will be achieved by utilizing the JVM shutdown hook functionality.
In either case, the actual closing is done by the doClose() method.
If you are curious about why your outputs look so similar, it is because they are effectively doing the same thing, whether you call #close() or #registerShutdownHook() at line 3 of you example. #close will shutdown right away, and #registerShutdownHook will shutdown just before the JVM will exit, which is pretty much as soon as the method is done being invoked, because it is the last line of code!
While tomcat starts, getting following error.
OS : Linux
Tomcat Version : apache-tomcat-8.0.33
Jun 10, 2016 5:06:33 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Jun 10, 2016 5:06:33 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/comprofile] startup failed due to previous errors
Jun 10, 2016 5:06:33 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Jun 10, 2016 5:06:33 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.StackOverflowError
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:39)
at org.apache.log4j.LogManager.getLogger(LogManager.java:45)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
I'm using the tomcat7-maven-plugin to launch a web application from Maven during the pre-integration-test lifecycle phase so that I can run tests against it locally during the integration-test phase.
I haven't worked much on the web application itself, but for the record it uses JSP and Java controllers which are tied together using Spring MVC 3.0.
When I run Maven (mvn clean verify) on my own machine I see the following output for the plugin:
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
[INFO] Using existing Tomcat server configuration at /Users/alexjohnson/MyWorkspace/MyProject/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7
Jan 27, 2015 2:18:54 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/alexjohnson/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Jan 27, 2015 2:18:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 27, 2015 2:18:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 27, 2015 2:18:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Jan 27, 2015 2:18:54 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 425 ms
Jan 27, 2015 2:18:54 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 27, 2015 2:18:54 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
Jan 27, 2015 2:18:55 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
// More startup stuff
This is working as expected. Note that WebappClassLoader.validateJarFile is called. Also note that the APR info message is expected since we aren't using these libraries in the test environment.
When I run Maven on our build server (mvn clean verify) I see the following output for the plugin:
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
[INFO] Using existing Tomcat server configuration at /opt/jenkins/workspace/BuildServerWorkspace/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7
Jan 27, 2015 2:30:09 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Jan 27, 2015 2:30:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 27, 2015 2:30:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 27, 2015 2:30:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Jan 27, 2015 2:30:09 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 823 ms
Jan 27, 2015 2:30:09 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 27, 2015 2:30:09 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
Jan 27, 2015 2:30:10 PM org.apache.tomcat.util.scan.StandardJarScanner scan
WARNING: Failed to scan JAR [file:/opt/jenkins/BuildServerWorkspace/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7/webapps/../../../../../../../../../../../target/MyProject/WEB-INF/lib/openws-1.5.1.jar] from WEB-INF/lib
java.io.FileNotFoundException: /opt/jenkins/BuildServerWorkspace/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7/webapps/../../../../../../../../../../../target/MyProject/WEB-INF/lib/openws-1.5.1.jar (No such file or directory)
// Hundreds more FileNotFoundExceptions for JAR files.
This is not working. Note that this time StandardJarScanner.scan is called. Also note that the missing JAR files appear to have been created during the build on my local machine at the same relative path (11 directories out from webapps and 5 more into the target directory). I believe all of these JAR files are for third-party Maven dependencies.
I've read the official JavaDocs, but I can't find a helpful description of the WebappClassLoader or the StandardJarScanner. All I can really gather is that they're both used for loading classes from JAR files when Tomcat starts up.
What I'd like to know:
What are WebappClassLoader and StandardJarScanner specifically being used for in this context?
What are the key differences between WebappClassLoader and StandardJarScanner?
What sort of configuration could be different on the build server that causes it to use the StandardJarScanner instead of the WebappClassLoader when running Maven there (All of the environment variables and Maven parameters which I know of are already the same)?
have a look at this issue https://issues.apache.org/jira/browse/MTOMCAT-239
Sounds like some weird paths from jenkins, I can't figure out why..
WebAppClassLoader and StandardJarScanner are apples and oranges. StandardJarScanner always runs before WebAppClassLoader but only produces log statements if something goes wrong. This means that the StandardJarScanner log statements were appearing at the same point in the failing build as the WebAppClassLoader log statements in the passing build.
Since I was mis-reading these log statements I ended up asking the wrong question. My original problem still stands. I've opened a new question for it at Why is Tomcat throwing FileNotFoundExceptions for existing JAR files?.
I am trying to bring up a REST Server(without UI) using jersey + grizzly. I am attempting to use spring.
My github project link: https://github.com/seshumadhav/java-projects/tree/master/grizzlySpringJersey
When I run 'MyServer', and hit a url like http://localhost:3388/smc/time, I am banged with a ServletHandler.doServletService 'java.lang.NoSuchMethodError' exception. Full server log below
Can someone help me understand reason behind this, and how to get this fixed ?
Dec 26, 2013 5:53:21 PM org.glassfish.grizzly.servlet.WebappContext deploy
INFO: Starting application [DEMO REST Server WebappContext] ...
Dec 26, 2013 5:53:21 PM org.glassfish.grizzly.servlet.WebappContext log
INFO: [DEMO REST Server WebappContext] Initializing Spring root WebApplicationContext
Dec 26, 2013 5:53:21 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Dec 26, 2013 5:53:21 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Thu Dec 26 17:53:21 IST 2013]; root of context hierarchy
Dec 26, 2013 5:53:21 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Dec 26, 2013 5:53:21 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#192d5cf3: defining beans [resourceFoo,springRunner,myBean,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
Dec 26, 2013 5:53:21 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 377 ms
Dec 26, 2013 5:53:21 PM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
INFO: Using default applicationContext
Dec 26, 2013 5:53:21 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, resourceFoo, of type com.demo.web.ResourceFoo as a root resource class
Dec 26, 2013 5:53:21 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.17.1 02/28/2013 12:47 PM'
Dec 26, 2013 5:53:22 PM org.glassfish.grizzly.servlet.WebappContext initServlets
INFO: [DEMO REST Server WebappContext] Servlet [com.sun.jersey.spi.spring.container.servlet.SpringServlet] registered for url pattern(s) [[/*]].
Dec 26, 2013 5:53:22 PM org.glassfish.grizzly.servlet.WebappContext deploy
INFO: Application [DEMO REST Server WebappContext] is ready to service requests. Root: [/].
Dec 26, 2013 5:53:22 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [localhost:3388]
Dec 26, 2013 5:53:22 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
In order to test the server please try the following urls:
http://localhost:3388/smc/time to see time for smc
http://localhost:3388/bsv/time to see time for bsv
Press enter to stop the server...
Dec 26, 2013 5:53:28 PM org.glassfish.grizzly.servlet.ServletHandler doServletService
SEVERE: service exception:
java.lang.NoSuchMethodError: org.glassfish.grizzly.http.server.Request.createInputStream()Lorg/glassfish/grizzly/http/io/NIOInputStream;
at org.glassfish.grizzly.servlet.ServletInputStreamImpl.initialize(ServletInputStreamImpl.java:89)
at org.glassfish.grizzly.servlet.HttpServletRequestImpl.initialize(HttpServletRequestImpl.java:208)
at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:212)
at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:189)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpHandlerChain.service(HttpHandlerChain.java:196)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547)
at java.lang.Thread.run(Thread.java:744)
Dec 26, 2013 5:53:28 PM org.glassfish.grizzly.servlet.ServletHandler doServletService
SEVERE: service exception:
java.lang.NoSuchMethodError: org.glassfish.grizzly.http.server.Request.createInputStream()Lorg/glassfish/grizzly/http/io/NIOInputStream;
at org.glassfish.grizzly.servlet.ServletInputStreamImpl.initialize(ServletInputStreamImpl.java:89)
at org.glassfish.grizzly.servlet.HttpServletRequestImpl.initialize(HttpServletRequestImpl.java:208)
at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:212)
at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:189)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpHandlerChain.service(HttpHandlerChain.java:196)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547)
at java.lang.Thread.run(Thread.java:744)
Related other question:
Can someone correct If I am using correct/latest maven dependencies
The original pom seems to be broken.
You can fix it by changing some dependencies as follows:
Demote grizzly-http-servlet from 2.3.4 to 2.2.16
This way it's compatible with the other grizzly (transitive) dependencies:
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-servlet</artifactId>
<version>2.2.16</version>
</dependency>
Also, demote the Servlet API spec dependency from 3.1.0 to 3.0.1
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
I'm trying to learn about Spring using SpringSource Tool Suite. I haven't had much successful experience with either at this stage.
So far I've been able to install STS and create a new project, but haven't gotten much further. The problem seems to occur when running the application on the tc Server. I'll run through the steps I've taken and perhaps someone can point out where I'm going wrong. For the record, I'm using Ubuntu 11.10.
I installed STS using the this link, which I found on the
SpringSource Tool Suite Download page.
During installation of STS, I chose to install in my home folder
/home/luke/springsource. I left all of the packs selected:
SpringSource Tool Suite 2.8.0.RELEASE; vFabric tc Server
2.6.1.RELEASE; Spring Roo 1.1.5.RELEASE; Apache Maven 3.0.3
When selecting the JDK path, I chose /usr/lib/jvm/default-java, which
links to /usr/lib/jvm/java-6-openjdk.
The installation completes successfully and I launch STS manually by
going to the installation directory
/home/luke/springsource/sts-2.8.0.RELEASE and executing the file STS.
I had to do this to get STS to run despite having checked the box to
run STS now at the end of installation (not sure if that's a real
problem but thought it'd be worth mentioning).
I choose my workspace
/home/luke/Documents/workspace-sts-2.8.0.RELEASE and clicked OK. So
far so good?
In the dashboard I click Create > Spring Template Project.
In the following dialog I click Spring MVC Project and click Next,
then agree to download.
In the Project Settings dialog, I give the project a name, springmvc,
and a valid top-level package, then click Finish.
I can now see my newly created project in the Package Explorer, as
well as a Servers folder, plus the VMware vFabric tc Server Developer
Edition v2.6 in the Server window.
I drag the project to the server in the Server window and the project
appears there with a [Synchronized] status. I then right-click the
project in the Package Explorer and click Run As > Run on Server.
The aforementioned server is there and selected, so I click Next. The
project I created is in the Configured section of the next screen, so
I click Finish. I'm asked if I want to use Spring Insight, so I click
Yes and the server starts up.
Here's where the big trouble begins.
I get the following output to the console and a 404 message in the
browser window, which is pointed at http://localhost:8080/springmvc/
Console output:
Nov 3, 2011 4:21:29 PM com.springsource.tcserver.security.PropertyDecoder <init>
INFO: tc Runtime property decoder using memory-based key
Nov 3, 2011 4:21:30 PM com.springsource.tcserver.security.PropertyDecoder <init>
INFO: tcServer Runtime property decoder has been initialized in 924 ms
Nov 3, 2011 4:21:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 3, 2011 4:21:32 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
INFO: Started up JMX registry on 127.0.0.1:6969 in 368 ms
Nov 3, 2011 4:21:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3809 ms
Nov 3, 2011 4:21:32 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 3, 2011 4:21:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: VMware vFabric tc Runtime 2.6.1.RELEASE/7.0.20.B.RELEASE
Nov 3, 2011 4:21:32 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor springmvc.xml from /home/luke/springsource/vfabric-tc-server-developer-2.6.1.RELEASE/spring-insight-instance/conf/Catalina/localhost
Nov 3, 2011 4:21:33 PM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:springmvc' did not find a matching property.
Nov 3, 2011 4:21:33 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
INFO: Context [localhost|springmvc] will not be woven
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2406)
at java.lang.Class.getConstructor0(Class.java:2716)
at java.lang.Class.newInstance0(Class.java:343)
at java.lang.Class.newInstance(Class.java:325)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:119)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
... 14 more
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Nov 3, 2011 4:21:34 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [227] milliseconds.
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/springmvc] startup failed due to previous errors
Nov 3, 2011 4:21:34 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor insight.xml from /home/luke/springsource/vfabric-tc-server-developer-2.6.1.RELEASE/spring-insight-instance/conf/Catalina/localhost
Nov 3, 2011 4:21:41 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
INFO: Context [localhost|insight] will not be woven
Nov 3, 2011 4:21:42 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Nov 3, 2011 4:22:00 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Nov 3, 2011 4:22:11 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet'
Nov 3, 2011 4:22:18 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
Nov 3, 2011 4:22:18 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
INFO: Context [localhost|manager] will not be woven
Nov 3, 2011 4:22:18 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Nov 3, 2011 4:22:18 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
INFO: Context [localhost|ROOT] will not be woven
Nov 3, 2011 4:22:18 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 3, 2011 4:22:19 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 46286 ms
Any help in deciphering this, figuring out a solution and pointing out what I'm doing wrong here in what seems like a very simple use case of STS, would be greatly appreciated.
ditto Ralph.
selected the top level project, went to
Run As > Maven Clean
Run As > Maven Install
Run As > Run on Server
and it went through correctly. I'm not sure why it was failing on the first place though, or why installing it twice fixes it.
Looks like the Project is not correct deployed to the server.
The context menu, for the server contains a option to clean it. After you have clean it use the same context menu and publish the application.
Then try it again.
(An other cause for this problem can be that there is a compiler failure.)