Solved

Error while running J2EE app with spring jars

Posted on 2014-01-27
2
1,978 Views
Last Modified: 2014-01-28
I have created a webapp and trying to run the same in tomcat server. When I try to run the project, I get HTTP Status 404, and the following error in tomcat console:

Jan 27, 2014 6:02:40 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\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows \System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0_10\bin;.
Jan 27, 2014 6:02:40 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:EmployeeServices' did not find a matching property.
Jan 27, 2014 6:02:40 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:BataMeServices' did not find a matching property.
Jan 27, 2014 6:02:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 27, 2014 6:02:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 27, 2014 6:02:40 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 535 ms
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.33
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class   org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jan 27, 2014 6:02:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/EmployeeServices] startup failed due to previous errors
Jan 27, 2014 6:02:41 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO:  validateJarFile(D:\ielect_sw\ws_workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm p1\wtpwebapps\BataMeServices\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet  Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jan 27, 2014 6:02:43 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
log4j:ERROR setFile(null,true) call failed.

Open in new window



I have used the following jar's , which I presume would suffice. Still I am unsure why I get this error. Any help is appreciated:

antlr-2.7.6
com.springsource.net.sf.cglib-2.2.0
com.springsource.org.aopalliance-1.0.0
com.springsource.org.apache.commons.logging-1.1.1
com.springsource.org.apache.log4j-1.2.15
com.springsource.org.aspectj.tools-1.6.6.RELEASE
com.springsource.org.aspectj.weaver-1.6.8.RELEASE
commons-collections-3.1
dom4j-1.6.1
javassist-3.12.0.GA
jta-1.1
org.json-1.0
org.springframework.web.servlet-3.1.4.RELEASE
org.springframework.web-3.0.4.RELEASE
servlet-api
servlet-api-3.0-alpha-1.jar
slf4j-api-1.6.1
slf4j-log4j12-1.6.1
spring-aop-4.0.0.RELEASE
spring-asm-3.1.4.RELEASE
spring-aspects-4.0.0.RELEASE
spring-beans-4.0.0.RELEASE
spring-context-4.0.0.RELEASE
spring-context-support-4.0.0.RELEASE
spring-core-4.0.0.RELEASE
spring-expression-4.0.0.RELEASE
spring-jdbc-4.0.0.RELEASE
spring-orm-4.0.0.RELEASE
spring-security-config-3.1.3.RELEASE
spring-security-core-3.1.3.RELEASE
spring-security-taglibs-3.1.3.RELEASE
spring-tx-4.0.0.RELEASE
spring-security-web-3.1.3.RELEASE	
spring-tx-4.0.0.RELEASE
spring-web-3.0.2.RELEASE
spring-web-3.1.4.RELEASE
spring-web-4.0.0.RELEASE
spring-webmvc-3.1.4.RELEASE
standard-1.0.6

Open in new window

0
Comment
Question by:Sreejith22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
mccarl earned 500 total points
ID: 39814202
I have used the following jar's , which I presume would suffice
First, ensure that those JAR's are actually in your webapps WEB-INF/lib directory when the webapp gets deployed in Tomcat. By looking at the logs they would need to be present in the following directory...
D:\ielect_sw\ws_workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\BataMeServices\WEB-INF\lib

Open in new window


Secondly, there are way too many versions of some of those JAR's that you are using. eg. you have 4 different versions of spring-web, and there are others there too. This may or may not be the source of your errors, but you should fix it anyway, as it is highly likely to cause you a problem at some point.

Lastly, the "servlet-api" jars are being included in your webapp hence you get the message on line 43 of the tomcat logs. While not causing an error, it's still a good idea to resolve this. Now these JAR's are required in order to "compile" your app but should not be included in your app when you deploy it. Tomcat provides it's own versions. If you are using Maven, then you should set the <scope> of these dependencies to "provided" so that they don't get included in your app.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question