I have a simple hello world application with embedded tomcat v.8.5.28
It works fine when I explicitly add servlet and mapping:
public static void main(String[] args) throws Exception {
Tomcat server = new Tomcat();
server.setPort(8080);
Context context = server.addContext("", Paths.get(".").toAbsolutePath().toString());
Tomcat.addServlet(context, "hello", new HelloServlet());
context.addServletMappingDecoded("/", "hello");
server.start();
server.getServer().await();
}
But if I delete addServlet and addServletMappingDecoded and annotate my servlet with #WebServlet(name = "HelloServlet", urlPatterns = "/hello") it doesn't work. http://localhost:8080/hello/ returns HTTP Status 404 – Not Found
I have this files hierarchy:
And this is file hierarchy in jar:
I have this output when trying to start my app
>java -jar servlet-app-1.0-SNAPSHOT-jar-with-dependencies.jar
Mar 09, 2018 3:57:36 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Mar 09, 2018 3:57:36 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 09, 2018 3:57:36 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Mar 09, 2018 3:57:36 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.28
Mar 09, 2018 3:57:36 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Mar 09, 2018 3:57:36 AM org.apache.jasper.servlet.TldScanner scanJars
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.
Mar 09, 2018 3:57:36 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
What paths should I pass to addWebapp so tomcat can find my web.xml?
Related
I am trying to create a simple Spring MVC Demo. I have the problem with the error java.lang.NoClassDefFoundError.
I have searched for solutions.
I came across:
1. Clean and build (tried) and
2. Add the missing jar for WebApplicationContext.
3. Place your jar files in WEB-INF/lib/*.jars I have done that as well.
ControllerDemo.java
package Demo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class ControllerDemo {
#RequestMapping("/")
public String showMyPage() {
return "myview";
}
}
myview.jsp
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
spring-mvc-demo-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- Step 3: Add support for component scanning -->
<context:component-scan base-package="Demo" />
<!-- Step 4: Add support for conversion, formatting and validation support -->
<mvc:annotation-driven/>
<!-- Step 5: Define Spring MVC view resolver -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>spring-mvc-demo</display-name>
<absolute-ordering />
<!-- Spring MVC Configs -->
<!-- Step 1: Configure Spring MVC Dispatcher Servlet -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc-demo-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Step 2: Set up URL mapping for Spring MVC Dispatcher Servlet -->
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
I expected to see Hello World on chrome,
I had this error:
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.94
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Apr 10 2019 16:56:40 UTC
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.94.0
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 3.19.0-80-generic
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_171-8u171-b11-2~14.04-b11
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /home/justdial/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /home/justdial/Downloads/apache-tomcat-7.0.94
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/home/justdial/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/home/justdial/Downloads/apache-tomcat-7.0.94
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/home/justdial/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/home/justdial/Downloads/apache-tomcat-7.0.94/endorsed
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Jul 17, 2019 3:07:32 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
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/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
Jul 17, 2019 3:07:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jul 17, 2019 3:07:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jul 17, 2019 3:07:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 493 ms
Jul 17, 2019 3:07:32 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 17, 2019 3:07:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.94
Jul 17, 2019 3:07:32 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/home/justdial/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SpringMVCDemo/WEB-INF/lib/javax.servlet-api-3.1.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Jul 17, 2019 3:07:32 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/home/justdial/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SpringMVCDemo/WEB-INF/lib/javax.servlet.jsp-3.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Jul 17, 2019 3:07:32 PM org.apache.catalina.deploy.WebXml setVersion
WARNING: Unknown version string [3.1]. Default version will be used.
Jul 17, 2019 3:07:32 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCDemo]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1243)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1707)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1697)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCDemo]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:138)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:70)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:417)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:884)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5606)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1955)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1798)
... 20 more
Jul 17, 2019 3:07: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 17, 2019 3:07:33 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1243)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:758)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:711)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1707)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1697)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1254)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCDemo]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1243)
... 8 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCDemo]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:138)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:70)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:417)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:884)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5606)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1955)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1798)
... 20 more
Jul 17, 2019 3:07:33 PM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.startup.Catalina.start(Catalina.java:711)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:758)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1254)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 11 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1243)
... 13 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1707)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1697)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1254)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCDemo]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1243)
... 8 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCDemo]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:138)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:70)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:417)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:884)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5606)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1955)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1798)
... 20 more
Jul 17, 2019 3:07:33 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Jul 17, 2019 3:07:33 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jul 17, 2019 3:07:33 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jul 17, 2019 3:07:33 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Jul 17, 2019 3:07:33 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
There are 2 things after which the application worked.
First using spring 3's logj4 jar (I removed all my spring 4 jars, tried spring 5, didn't work, then I shifted to spring 3 jars, then I found the applicaitonContext error then I renamed the file and volaa it worked)
Second changing the name of spring-mvc-demo-servlet.xml file to applicationContext.xml.
I am working on a dynamic web project and everything has been working fine until I added the email capability. Since I added spring: 2.5.6 to my dependency list, tomcat won't start. Here's my POM file:
Here's the stack trace:
May 28, 2015 7:44:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:testApp' did not find a matching property.
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.15
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Nov 2 2014 19:25:20 UTC
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.15.0
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.10.2
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JAVA_HOME: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_25-b17
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /Users/Puru/GitRepos/Private/testApp/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /usr/local/apache-tomcat-8.0.15
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/Puru/GitRepos/Private/testApp/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/local/apache-tomcat-8.0.15
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/Users/Puru/GitRepos/Private/testApp/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/usr/local/apache-tomcat-8.0.15/endorsed
May 28, 2015 7:44:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
May 28, 2015 7:44:24 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/Puru/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
May 28, 2015 7:44:24 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 28, 2015 7:44:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 28, 2015 7:44:24 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8443"]
May 28, 2015 7:44:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 28, 2015 7:44:24 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 28, 2015 7:44:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 28, 2015 7:44:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 922 ms
May 28, 2015 7:44:24 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 28, 2015 7:44:24 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.15
May 28, 2015 7:44:26 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testApp]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testApp]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationAwareOrderComparator.sort(Ljava/util/List;)V
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5185)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
May 28, 2015 7:44:26 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:439)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:760)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:625)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
May 28, 2015 7:44:26 PM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:625)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:760)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:439)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8080"]
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8443"]
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-nio-8009"]
May 28, 2015 7:44:26 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8080"]
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol destroy
SEVERE: Failed to destroy end point associated with ProtocolHandler ["http-nio-8080"]
java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307)
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482)
at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795)
at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:531)
at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:850)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8443"]
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol destroy
SEVERE: Failed to destroy end point associated with ProtocolHandler ["http-nio-8443"]
java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307)
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482)
at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795)
at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:531)
at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:850)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-nio-8009"]
May 28, 2015 7:44:26 PM org.apache.coyote.AbstractProtocol destroy
SEVERE: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"]
java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307)
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482)
at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795)
at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:531)
at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:850)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
I have looked up other threads which say that there might be a version conflict and the solution would be to remove on or the other. But I don't understand what if I want to use both.
Thanks in advance.
I finally figured out that indeed removing spring 2.5.6 was the solution. The package that I was trying to use from spring2.5.6 was also present in spring.context.support framework.
Removing the spring2.5.6. resolved the conflict and adding spring.context.support resolved build errors.
I'm running a Spring-Boot application on cloudControl and a simple Jenkins task to check every 10 minutes whether the application is still available or not. So it occurs every couple days that the check-alive fails, but it is available again only minutes later. The cloudControl log says there was a deployment in these times, but the hash value of the build is the same as no changes were made.
Why are these (IMHO unnecessary) deployments happening?
[Wed Sep 10 12:20:16 2014] lb-101 INFO Routing requests to new version
[Wed Sep 10 12:20:44 2014] lb-102 INFO Routing requests to new version
[Wed Sep 10 16:43:50 2014] lxc-1752 INFO Deploying ...
[Wed Sep 10 16:44:03 2014] lxc-1752 INFO Deployed version: b6a4eb94702f9a9aaeb9baa367d7a74c8d1c75e8
[Wed Sep 10 16:44:03 2014] lb-97 INFO Routing requests to new version
[Wed Sep 10 16:44:03 2014] lb-98 INFO Routing requests to new version
...
[Mon Sep 15 08:44:01 2014] lxc-1767 INFO Deploying ...
[Mon Sep 15 08:44:16 2014] lxc-1767 INFO Deployed version: b6a4eb94702f9a9aaeb9baa367d7a74c8d1c75e8
[Mon Sep 15 08:44:16 2014] ngx-72 INFO Routing requests to new version
[Mon Sep 15 08:44:16 2014] lb-120 INFO Routing requests to new version
If a deployments is in the free tier its containers are hibernated to free up resources if not used. If hibernated deployments get a request a new container is started to serve that request. This is the behaviour you are seeing.
To avoid having your application hibernated simply scale the deployment up or out.
Whenever I am going to run my project I am getting this error frequently.please let me know what is the reason behind it.serverstartup in 1680.I googled a lot but not getting any solution of it.I created a new workspace also but getting this same problem.
Dec 22, 2012 11:35:31 AM 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
\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java
/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib
/i386;c:\program files\dell\dw wlan card;C:\Windows\system32;C:\Windows;C:\Windows
\system32\wbem;C:\Windows\system32\windowspowershell\v1.0\;c:\program files\java
\jdk1.6.0_25\bin;c:\program files\ibm\gsk8\lib;C:\Program Files\Microsoft SQL
Server\100\Tools\Binn\;C: \Program Files\Microsoft SQL Server\100\DTS\Binn
\;B:\eclipse;;.
Dec 22, 2012 11:35:31 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property
'source' to 'org.eclipse.jst.jee.server:RESTfulProject' did not find a matching property.
Dec 22, 2012 11:35:31 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 22, 2012 11:35:31 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 22, 2012 11:35:31 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 742 ms
Dec 22, 2012 11:35:31 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 22, 2012 11:35:31 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.8
Dec 22, 2012 11:35:31 AM com.sun.jersey.api.core.ClasspathResourceConfig init
INFO: Scanning for root resource and provider classes in the paths:
B:\XYRAD\XyRadwebservicesMoon\.metadata\.plugins\org.eclipse.wst.server.core
\tmp6\wtpwebapps\RESTfulProject\WEB-INF\lib
B:\XYRAD\XyRadwebservicesMoon\.metadata\.plugins\org.eclipse.wst.server.core
\tmp6\wtpwebapps\RESTfulProject\WEB-INF\classes
Dec 22, 2012 11:35:32 AM com.sun.jersey.api.core.ClasspathResourceConfig init
INFO: Root resource classes found:
class webService.FeedService
Dec 22, 2012 11:35:32 AM com.sun.jersey.api.core.ClasspathResourceConfig init
INFO: Provider classes found:
Dec 22, 2012 11:35:33 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 22, 2012 11:35:33 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 22, 2012 11:35:33 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1680 ms
I use SpringSource Tool Suite sts to start a hello world example about MVC.
File -> New -> Spring Template Project -> then choose Spring MVC Project
I add Project Name: helloworld
and specify the top-level package as com.helloworld.myapp
then finish.
now I try to run the application and choose Run on Server
and it always shows me the everlasting screen that says: The requested resource (/helloworld/) is not available.
server shows the following:
Nov 30, 2011 4:06:53 PM com.springsource.tcserver.security.PropertyDecoder <init> INFO: tc
Runtime property decoder using memory-based key Nov 30, 2011 4:06:53
PM com.springsource.tcserver.security.PropertyDecoder INFO:
tcServer Runtime property decoder has been initialized in 183 ms Nov
30, 2011 4:06:53 PM org.apache.coyote.AbstractProtocol init INFO:
Initializing ProtocolHandler ["http-bio-8080"] Nov 30, 2011 4:06:53 PM
com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
INFO: Started up JMX registry on 127.0.0.1:6969 in 63 ms Nov 30, 2011
4:06:53 PM org.apache.catalina.startup.Catalina load INFO:
Initialization processed in 693 ms Nov 30, 2011 4:06:53 PM
org.apache.catalina.core.StandardService startInternal INFO: Starting
service Catalina Nov 30, 2011 4:06:53 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 30, 2011 4:06:53 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor insight.xml from
D:\springsource\vfabric-tc-server-developer-2.6.1.RELEASE\spring-insight-instance\conf\Catalina\localhost
Nov 30, 2011 4:06:53 PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|insight] will not be woven Nov 30, 2011
4:06:54 PM org.apache.catalina.core.ApplicationContext log INFO:
Initializing Spring root WebApplicationContext Nov 30, 2011 4:07:04 PM
org.apache.catalina.core.ApplicationContext log INFO: Initializing
Spring FrameworkServlet 'Spring MVC Dispatcher Servlet' Nov 30, 2011
4:07:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager Nov 30, 2011 4:07:06
PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|manager] will not be woven Nov 30, 2011
4:07:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT Nov 30, 2011 4:07:06 PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|ROOT] will not be woven Nov 30, 2011
4:07:06 PM org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["http-bio-8080"] Nov 30, 2011 4:07:06 PM
org.apache.catalina.startup.Catalina start INFO: Server startup in
12820 ms Nov 30, 2011 4:07:56 PM
org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor EchoSpringMVC.xml from
D:\springsource\vfabric-tc-server-developer-2.6.1.RELEASE\spring-insight-instance\conf\Catalina\localhost
Nov 30, 2011 4:07:56 PM
org.apache.catalina.startup.SetContextPropertiesRule begin WARNING:
[SetContextPropertiesRule]{Context} Setting property 'source' to
'org.eclipse.jst.jee.server:EchoSpringMVC' did not find a matching
property. Nov 30, 2011 4:07:56 PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|EchoSpringMVC] will not be woven Nov
30, 2011 4:07:56 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.NoClassDefFoundError: org/apache/log4j/Level at
org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at
org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:191)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
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:722) Caused by:
java.lang.ClassNotFoundException: org.apache.log4j.Level at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
... 18 more
Nov 30, 2011 4:07:56 PM org.apache.catalina.core.StandardContext
startInternal SEVERE: Error listenerStart Nov 30, 2011 4:07:56 PM
org.apache.catalina.core.StandardContext startInternal SEVERE: Context
[/EchoSpringMVC] startup failed due to previous errors Nov 30, 2011
4:07:56 PM org.apache.catalina.core.ApplicationContext log INFO:
Closing Spring root WebApplicationContext Nov 30, 2011 4:07:56 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.ExceptionInInitializerError at
org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
at
org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4763)
at
org.apache.catalina.core.StandardContext$4.run(StandardContext.java:5473)
at java.lang.Thread.run(Thread.java:722) Caused by:
java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be
successfully initialized. See also
http://www.slf4j.org/codes.html#unsuccessfulInit at
org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:282) at
org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
at
org.springframework.web.context.ContextCleanupListener.(ContextCleanupListener.java:43)
... 4 more
Where do I go wrong?
Please help.
I've solved changing log4j 1.2.15 with 1.2.16 in pom.xml
New dependency look like this
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
That's all
It looks like you are having this exception:
https://issuetracker.springsource.com/browse/STS-2128
Your code will run fine. This is a caching problem with WTP (Web Tools Project). A clean build should remove the error.