How do I configure this Spring project correctly? - spring

Me and my team are trying to setup a Spring project, and would like to implement REST services. But when I try to deploy it to tomcat 7, I get an error. Here is the output:
Jan 22, 2012 9:39:34 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 22, 2012 9:39:34 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:niths' did not find a matching property.
Jan 22, 2012 9:39:34 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 22, 2012 9:39:34 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 22, 2012 9:39:34 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 497 ms
Jan 22, 2012 9:39:34 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 22, 2012 9:39:34 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
Jan 22, 2012 9:39:34 PM org.apache.catalina.startup.ContextConfig webConfig
SEVERE: Unable to determine URL for WEB-INF/classes
javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found
at org.apache.naming.resources.BaseDirContext.listBindings(BaseDirContext.java:733)
at org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirContext.java:546)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1197)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:825)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:300)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
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:722)
Jan 22, 2012 9:39:37 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 22, 2012 9:39:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 22, 2012 9:39:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 22, 2012 9:39:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3208 ms
I have tried Googling javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found without luck. I am guessing the project was not deployed at all.
The project is hosted on this GitHub repo.
Deployment descriptor
The REST controller
I have added a very simple method for testing my application: getBaz(), which I guess would be invoked at localhost:8080/niths/rest/baz.
I am having a hard time figuring out what is missing as this is my first Spring project, and would therefore be grateful if someone skilled in the arts of Spring would point out what's the problem!

From your pom.xml file, it seems that you excluded your classes and libs from the generated war :
<warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
Try again by removing this line.

Related

Getting error while running Webservices on Tomcat7 server - Ubuntu 16.04 LTS

Technical Environment:-
Ubuntu 16.04 LTS
Tomcat 7
Java 7
Eclipse Luna
I have imported a webservice into my eclipse luna workspace and tried to run that service on tomcat7 server. But I'm getting the following error.
Jul 24, 2016 5:39:30 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:service' did not find a matching property.
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.68 (Ubuntu)
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 27 2016 18:13:17 UTC
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.68.0
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 4.4.0-28-generic
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /usr/lib/jvm/java-7-oracle/jre
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_80-b15
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /home/shravan/Projects/Webservices/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /usr/share/tomcat7
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/home/shravan/Projects/Webservices/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/share/tomcat7
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/home/shravan/Projects/Webservices/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed
Jul 24, 2016 5:39:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Jul 24, 2016 5:39:31 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jul 24, 2016 5:39:31 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 781 ms
Jul 24, 2016 5:39:31 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 24, 2016 5:39:31 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.68 (Ubuntu)
Jul 24, 2016 5:39:31 PM org.apache.catalina.startup.TldConfig execute
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.
Jul 24, 2016 5:39:33 PM org.apache.catalina.startup.TldConfig execute
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.
Jul 24, 2016 5:39:33 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jul 24, 2016 5:39:33 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jul 24, 2016 5:39:33 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Jul 24, 2016 5:39:33 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy
Jul 24, 2016 5:39:34 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Jul 24, 2016 5:39:34 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dataSource.xml]
Jul 24, 2016 5:39:34 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at org.apache.catalina.core.ApplicationContext.getInitParameterNames(ApplicationContext.java:368)
at org.apache.catalina.core.ApplicationContextFacade.getInitParameterNames(ApplicationContextFacade.java:367)
at org.springframework.web.context.support.WebApplicationContextUtils.registerEnvironmentBeans(WebApplicationContextUtils.java:200)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.postProcessBeanFactory(AbstractRefreshableWebApplicationContext.java:165)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Jul 24, 2016 5:39:34 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at org.apache.catalina.core.ApplicationContext.getInitParameterNames(ApplicationContext.java:368)
at org.apache.catalina.core.ApplicationContextFacade.getInitParameterNames(ApplicationContextFacade.java:367)
at org.springframework.web.context.support.WebApplicationContextUtils.registerEnvironmentBeans(WebApplicationContextUtils.java:200)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.postProcessBeanFactory(AbstractRefreshableWebApplicationContext.java:165)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Jul 24, 2016 5:39:34 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
Jul 24, 2016 5:39:34 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/service] startup failed due to previous errors
Jul 24, 2016 5:39:34 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Jul 24, 2016 5:39:34 PM org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy
Jul 24, 2016 5:39:34 PM org.springframework.context.support.AbstractApplicationContext doClose
WARNING: Exception thrown from ApplicationListener handling ContextClosedEvent
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:880)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:551)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5779)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Jul 24, 2016 5:39:34 PM org.springframework.context.support.AbstractApplicationContext doClose
WARNING: Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sun Jul 24 17:39:33 IST 2016]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:359)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:888)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:551)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5779)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Jul 24, 2016 5:39:34 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 24, 2016 5:39:34 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3547 ms
Please point me out to the possible solution. Thank you so much.
I had the same problem recently.
It seems that Tomcat 7 classes were compiled using Java 8 libraries in Ubuntu 16.04, so you cannot run it using Java 7.
This is from catalina.jar (7.0.68) from repository:
# javap -verbose org/apache/catalina/core/ApplicationContext.class
Classfile /usr/share/tomcat7/lib/org/apache/catalina/core/ApplicationContext.class
Last modified 27/06/2016; size 33798 bytes
MD5 checksum b176f6c6f5854428fbfa67b298ed308a
Compiled from "ApplicationContext.java"
public class org.apache.catalina.core.ApplicationContext implements javax.servlet.ServletContext
SourceFile: "ApplicationContext.java"
InnerClasses:
public static #479= #478 of #943; //Dynamic=class javax/servlet/FilterRegistration$Dynamic of class javax/servlet/FilterRegistration
public static #479= #511 of #945; //Dynamic=class javax/servlet/ServletRegistration$Dynamic of class javax/servlet/ServletRegistration
public static #1005= #1004 of #2; //KeySetView=class java/util/concurrent/ConcurrentHashMap$KeySetView of class java/util/concurrent/ConcurrentHashMap
minor version: 0
major version: 50
flags: ACC_PUBLIC, ACC_SUPER
And this is from catalina.jar (7.0.68) downloaded from Apache:
# javap -verbose org/apache/catalina/core/ApplicationContext.class
Classfile /root/apache-tomcat-7.0.68/lib/org/apache/catalina/core/ApplicationContext.class
Last modified 08/02/2016; size 33585 bytes
MD5 checksum eda7f125c1ef506be98d360f6611a717
Compiled from "ApplicationContext.java"
public class org.apache.catalina.core.ApplicationContext implements javax.servlet.ServletContext
SourceFile: "ApplicationContext.java"
InnerClasses:
public static #481= #480 of #946; //Dynamic=class javax/servlet/FilterRegistration$Dynamic of class javax/servlet/FilterRegistration
public static #481= #513 of #948; //Dynamic=class javax/servlet/ServletRegistration$Dynamic of class javax/servlet/ServletRegistration
minor version: 0
major version: 50
flags: ACC_PUBLIC, ACC_SUPER
Both are compiled to class format 50 (Java 6), but the repository class has a link to a Java 8 exclusive method:
public static #1005= #1004 of #2; //KeySetView=class java/util/concurrent/ConcurrentHashMap$KeySetView of class java/util/concurrent/ConcurrentHashMap
So if you want to run Tomcat 7 with Java 7 in Ubuntu 16.04 you have to download it directly from Apache and install it manually.

Tomcat taking too long to initialize

Why would it take 40+ minutes for the server to initialize the 'http-bio-8443' protocol handler as highlighted below.
This line is single handedly causing all the tomcat startup delay.
Mar 30, 2015 10:12:49 AM. org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
************************************
Mar 30, 2015 10:12:49 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Mar 30, 2015 10:55:26 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
************************************
Mar 30, 2015 10:55:26 AM org.apache.catalina.startup.Catalina load
The OS does not have enough entropy to initialise the cryptography used by the HTTPS connector.

What's the difference between WebappClassLoader and StandardJarScanner?

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?.

SEVERE: Context [/yacceleratorstorefront] startup failed due to previous errors

I am installing hybris on MAC (i5 - 500gb - 4gb)
I am getting this type of errors and I am not able to access localhost:9001
Friends please help me out.
Below is the log file details
Nov 14, 2014 11:44:44 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Nov 14, 2014 11:44:44 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/yacceleratorstorefront] startup failed due to previous errors
Nov 14, 2014 11:44:44 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9001"]
Nov 14, 2014 11:44:44 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9002"]
Nov 14, 2014 11:44:44 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Nov 14, 2014 11:44:44 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 257151 ms
There is a error in starting the web application of yacceleratorstorefront. So either you can Comment out yaccelerator extensions from your localextensions.xml or solve the error thrown in yacceleratorstorefront.

SEVERE: Servlet threw load() exception javax.servlet.UnavailableException

I am getting the below error while deploying my application in Tomcat 6.0.26 on eclipse Juno. I am using struts for web content and spring for ORM.
I have tried cleaning up and building up the Workspace.
Mar 19, 2013 5:33:30 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:CPCPROJ' did not find a matching property.
Mar 19, 2013 5:33:30 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: C:\Program Files\Java\jdk1.6.0_18\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.6.0_18\jre\bin;C:/Program Files/Java/jdk1.6.0_18/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0_18/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_18/bin/../jre/lib/i386;C:\Program Files\Java\jdk1.6.0_18\bin;E:\Oracle\product\10.1.0\Client_2\bin;E:\Oracle\product\10.1.0\Client_2\jre\1.4.2\bin\client;E:\Oracle\product\10.1.0\Client_2\jre\1.4.2\bin;E:\Oracle\product\10.1.0\Client_1\bin;E:\Oracle\product\10.1.0\Client_1\jre\1.4.2\bin\client;E:\Oracle\product\10.1.0\Client_1\jre\1.4.2\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Windows Imaging\;C:\Program Files\Java\jdk1.6.0_18\bin;E:\456789\Venkat\Servers\Tomcat\bin;E:\456789\Venkat\Servers\JBoss\bin;E:\apache-maven-2.2.1\bin;E:\456789\Venkat\Servers\apache-ant-1.7.0\bin;.;C:\Documents and Settings\456789\My Documents\Downloads\eclipse-jee-kepler-M4-win32\eclipse;
Mar 19, 2013 5:33:30 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Mar 19, 2013 5:33:30 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 769 ms
Mar 19, 2013 5:33:30 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 19, 2013 5:33:30 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Mar 19, 2013 5:33:31 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(E:\356387\Venkat\Juno\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CPCPROJ\WEB-INF\lib\j2ee-1.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Mar 19, 2013 5:33:31 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(E:\356387\Venkat\Juno\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CPCPROJ\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Mar 19, 2013 5:33:32 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN No appenders could be found for logger (com.tcs.framework.configuration.TCSCommonsConfigurationFactory).
log4j:WARN Please initialize the log4j system properly.
Mar 19, 2013 5:33:43 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet action as unavailable
Mar 19, 2013 5:33:43 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /CPCPROJ threw load() exception
javax.servlet.UnavailableException
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Mar 19, 2013 5:33:44 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'CPCPROJ'
Mar 19, 2013 5:33:47 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 19, 2013 5:33:47 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 19, 2013 5:33:47 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Mar 19, 2013 5:33:47 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 16435 ms
I think the data you provided in web.xml is not proper please check it once.
see here for details

Resources