java.lang.ClassNotFoundException:org.apache.struts.action.ActionServlet

时间:2012-09-09 13:57:25

标签: java

我得到了Tomcat错误:

Sep 09, 2012 3:27:48 PM org.apache.catalina.core.AprLifecycleListener init
Information: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Products\jdk1.7.0_03\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Products/jdk1.7.0_03/jre/bin/client;C:/Products/jdk1.7.0_03/jre/bin;C:/Products/jdk1.7.0_03/jre/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Products\jdk1.7.0_03\jre\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Products\eclipse32;;.
Sep 09, 2012 3:27:48 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Warnung: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:NAR_JDBC_DBO' did not find a matching property.
Sep 09, 2012 3:27:49 PM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["http-bio-80"]
Sep 09, 2012 3:27:49 PM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 09, 2012 3:27:49 PM org.apache.catalina.startup.Catalina load
Information: Initialization processed in 1359 ms
Sep 09, 2012 3:27:49 PM org.apache.catalina.core.StandardService startInternal
Information: Starting service Catalina
Sep 09, 2012 3:27:49 PM org.apache.catalina.core.StandardEngine startInternal
Information: Starting Servlet Engine: Apache Tomcat/7.0.27
Sep 09, 2012 3:27:49 PM org.apache.catalina.startup.TaglibUriRule body
Information: TLD skipped. URI: http://struts.apache.org/tags-html is already defined
Sep 09, 2012 3:27:49 PM org.apache.catalina.startup.TaglibUriRule body
Information: TLD skipped. URI: http://struts.apache.org/tags-bean is already defined
Sep 09, 2012 3:27:49 PM org.apache.catalina.startup.TaglibUriRule body
Information: TLD skipped. URI: http://struts.apache.org/tags-nested is already defined
Sep 09, 2012 3:27:49 PM org.apache.catalina.startup.TaglibUriRule body
Information: TLD skipped. URI: http://struts.apache.org/tags-logic is already defined
Sep 09, 2012 3:27:49 PM org.apache.catalina.core.ApplicationContext log
Information: Marking servlet action as unavailable
Sep 09, 2012 3:27:49 PM org.apache.catalina.core.StandardContext loadOnStartup
Schwerwiegend: Servlet /NAR_JDBC_DBO threw load() exception
java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:124)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1136)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    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)

Sep 09, 2012 3:27:49 PM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler ["http-bio-80"]
Sep 09, 2012 3:27:49 PM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 09, 2012 3:27:49 PM org.apache.catalina.startup.Catalina start
Information: Server startup in 725 ms

这是我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 <display-name>NAR_JDBC_DBO</display-name>
 <servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/struts-config.xml</param-value>
  </init-param>
  <init-param>
   <param-name>validate</param-name>
   <param-value>true</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
 </welcome-file-list>
 <jsp-config>
  <taglib>
   <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
   <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
   <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
   <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
   <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
   <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>
  <taglib>
   <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
   <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
  </taglib>
 </jsp-config>
</web-app>

显然,org.apache.struts.action.ActionServlet中的Servlet名称“Action”存在问题。 Unfurtunatley我不知道我做错了什么。你有个主意吗? 许多事先提前。 奥利

9 个答案:

答案 0 :(得分:11)

发生此错误是因为您的servlet-core jar不在您的运行时类路径中。 如果您使用的是maven,

  1. 打开您的EAR /网络项目属性
  2. 点击&#34;部署程序集&#34;
  3. 点击&#34;添加...&#34;
  4. 选择&#34; Java构建路径条目&#34;
  5. 点击&#34;下一步&#34;
  6. 选择&#34; Maven Dependencies&#34;
  7. 点击&#34;完成&#34;
  8. 如果不是maven,请确保您放置罐子的lib文件夹位于&#34;部署装配&#34;。

答案 1 :(得分:2)

我认为您应该将jar文件保存到/ WEB_INF / Lib文件夹中,这对您有用。

答案 2 :(得分:1)

使用Tomcat 7时出现了同样的错误。我找到了解决方案。 根本原因是struts jar版本或jar配置。 Previsouly我使用struts.jar,现在我添加了struts-core-1.3.10.jar推荐用于Tomcat 7和servlet-api jar shloud可用并确保jar配置正确或不正确..它更好地删除当前项目和刚刚开始。

答案 3 :(得分:0)

我认为问题是由于jar文件,请确保lib文件夹中的jar文件。如果您使用的是eclipse,则将所有jar文件复制到lib文件夹而不是构建路径

答案 4 :(得分:0)

我遇到了同样的问题。虽然我将struts库添加到项目Build Path并标记为导出,但Eclipse在WEB-INF / lib中没有包含任何内容。与Vivek Kothari所说的类似,你可以让Eclipse添加它们。但是,如果您已经下载了jar文件并添加到项目构建路径(可能是用户库),则可以在步骤6中选择您的库。

答案 5 :(得分:0)

此问题是由于仅丢失Jars ... 将所有这些罐子放入/ WEB-INF / lib文件夹...

  1. ANTLR-2.7.2.jar
  2. 公地BeanUtils的-1.8.0.jar
  3. 公地链1.2.jar
  4. 公地消化器-1.8.jar
  5. 共享记录-1.0.4.jar
  6. 公地验证-1.3.1.jar
  7. 口 - 2.0.8.jar
  8. 支柱核-1.3.10.jar
  9. 支柱-标签库-1.3.10.jar
  10. 如果我们只使用struts-core.jar,那么我们就会遇到这个问题...因为所有其他的jar也是必需的。

答案 6 :(得分:0)

为了避免这种类型的问题,将所有struts jar放在web app的lib文件夹中。这将解决问题

答案 7 :(得分:0)

org.apache.struts.actions.ActionServlet not org.apache.struts.action.ActionServlet

答案 8 :(得分:0)

我们需要添加一个额外的jar:struts-extras-1.3.9.jar中的WEB/lib。正确地说是org.apache.struts.actions.ForwardAction