2

enter image description hereI am getting an error while starting my struts2 application. Following is the error I am getting:

2 Sep, 2012 12:17: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\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Java\jre7\bin\client;C:\Program Files (x86)\Java\jre7\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\QuickTime\QTSystem\
2 Sep, 2012 12:17:32 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:MateExpenseCalculator' did not find a matching property.
2 Sep, 2012 12:17:33 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2 Sep, 2012 12:17:33 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2364 ms
2 Sep, 2012 12:17:33 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2 Sep, 2012 12:17:33 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
2 Sep, 2012 12:17:33 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2 Sep, 2012 12:17:33 AM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
2 Sep, 2012 12:17:33 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/MateExpenseCalculator] startup failed due to previous errors
2 Sep, 2012 12:17:34 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2 Sep, 2012 12:17:34 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
2 Sep, 2012 12:17:34 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/73  config=null
2 Sep, 2012 12:17:34 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1233 ms

I have added below jar files in my classpath:

  • struts2-core-2.3.4.1.jar
  • commons-beanutils-1.8.0.jar
  • commons-chain-1.2.jar
  • commons-collections-3.1.jar
  • commons-digester-2.0.jar
  • commons-fileupload-1.2.2.jar
  • commons-io-2.0.1.jar
  • commons-lang-2.4.jar
  • commons-lang3-3.1.jar
  • commons-logging-1.1.1.jar
  • commons-logging-api-1.1.jar
  • freemarker-2.3.19.jar
  • xwork-core-2.3.4.1.jar
  • javassist-3.11.0.GA.jar
  • ognl-3.0.5.jar

web.xml:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
</filter>

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

I have followed this thread but no success.

Kindly help.

Community
  • 1
  • 1
DarkKnightFan
  • 1,913
  • 14
  • 42
  • 61
  • can you post complete error trace – Umesh Awasthi Sep 01 '12 at 17:22
  • You've added the jars to *what* classpath? If they're not *deployed* with your S2 app, it doesn't matter what classpath they've been added to. – Dave Newton Sep 01 '12 at 17:50
  • @UmeshAwasthi: I have added the full server log.. hope this helps. – DarkKnightFan Sep 01 '12 at 18:57
  • @DaveNewton: I have added the jars to the classpath of the application. – DarkKnightFan Sep 01 '12 at 18:58
  • What IDE are you using, are you using maven? If not why? – Quaternion Sep 01 '12 at 21:05
  • @Gaurav Meaning what? Please, please be specific. Where are the jars when they're deployed? How are you deploying? What makes you think they're in the right place? It doesn't seem as though they are. – Dave Newton Sep 01 '12 at 22:18
  • @Quaternion: I am using Eclipse Europa. Simple reason, I am comfortable using eclipse for my development. I have created a dynamic web project in that and deployed the app on tomcat v6.0 – DarkKnightFan Sep 02 '12 at 08:59
  • @DaveNewton I have added the screenshot of my application buildpath screen. I have added them as external jars in to my project. I am adding the project into the tomcat 6.0 server. On restarting the server I am getting the error log mentioned above. – DarkKnightFan Sep 02 '12 at 09:06
  • The build path doesn't matter, uuuu need to make sure the libraries are being deployed. I can't see the picture on my mobile device anyway. – Dave Newton Sep 02 '12 at 11:47
  • @Gaurav I was asking about the IDE because it could help us provide you with step by step instructions. Maven is method of build which handles a lot of the dependency management. Think of it as another project type managed by your IDE. I'm not familiar with your IDE so will not be able to help but someone else may. – Quaternion Sep 02 '12 at 17:50
  • @Gaurav: if problem is still there i suggest you to clean your work directory and uninstall app from server and clean tomcat work-directory and rebuild your app and try to deploy it and see how it is going and alternatively export your app as war and deploy it in independent tomcat to see how it goes and have a look at the directory structure under tomcat web-app – Umesh Awasthi Sep 03 '12 at 03:02

1 Answers1

-1

It's weird. You have all jars, but you can try with this web.xml to use version 2.4. I'm using netbeans with tomcat 7.

<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping> </web-app>

However you can see the apache log to find the exact problem like below:

Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    ... 55 more
Andrei Sfat
  • 8,440
  • 5
  • 49
  • 69
Haleem
  • 139
  • 1
  • 2