执行教程时出现Tomcat错误

时间:2014-01-09 09:45:42

标签: java tomcat struts2

我正在从http://viralpatel.net/blogs/tutorial-create-struts-2-application-eclipse-example/执行来自tuorial的代码,我收到以下错误

janv. 09, 2014 11:20:02 AM org.apache.struts2.dispatcher.Dispatcher error
Grave: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/K:/sop/java/code/.
metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/W
EB-INF/lib/struts2-core-2.3.16.jar!/struts-default.xml:64:179
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Configu
rationManager.java:70)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatche
r.java:445)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperation
s.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(S
trutsPrepareAndExecuteFilter.java:57)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilte
rConfig.java:281)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilter
Config.java:262)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterCon
fig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:47
75)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:
5452)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:15
59)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:15
49)
    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)
Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.Mul
tiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequ
est - bean - jar:file:/K:/sop/java/code/.metadata/.plugins/org.ecli
pse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB-INF/lib/struts2-core-2.
3.16.jar!/struts-default.xml:64:179
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(X
mlConfigurationProvider.java:245)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlC
onfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(Def
aultConfiguration.java:234)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Configu
rationManager.java:67)
    ... 16 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUpl
oadBase$SizeLimitExceededException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getDeclaredConstructors(Unknown Source)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(X
mlConfigurationProvider.java:235)
    ... 19 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileU
ploadBase$SizeLimitExceededException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1702)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1547)
    ... 23 more

我使用的罐子是:

  • 共享记录-1.1.3.jar
  • 公地lang3-3.1.jar
  • 共享记录-1.1.3.jar
  • freemaker的-2.3.19.jar
  • 了Javassist-3.11.0.GA.jar
  • ongl-3.0.6.jar
  • struts2的核 - 2.3.16.jar
  • XWork的核 - 2.3.16.jar

有人可以告诉我,我错了什么?是Tomcat服务器吗?是代码吗?

另一个问题是我在互联网上尝试更多教程,每次在将struts2应用到网页时都会出错。有人能告诉我Tomcat缺少什么?

P.S。我正在使用Eclipse kepler,这可能是它的问题吗?

1 个答案:

答案 0 :(得分:0)

缺少Javassist库。您可以从下面的maven下载它是链接。这在异常本身中提到:)

http://mvnrepository.com/artifact/javassist/javassist