首先新建Dynamic Web Project对吧,然后根据这个链接中的例子敲http://blog.csdn.net/hntyzgn2010/article/details/5547753,不过我下载的是最新版的struts2,版本为2.3.81,现在运行的时候报错,下面是错误代码
1 五月 04, 2016 2:41:22 下午 org.apache.coyote.AbstractProtocol init 2 信息: Initializing ProtocolHandler ["http-bio-8080"] 3 五月 04, 2016 2:41:22 下午 org.apache.coyote.AbstractProtocol init 4 信息: Initializing ProtocolHandler ["ajp-bio-8009"] 5 五月 04, 2016 2:41:22 下午 org.apache.catalina.startup.Catalina load 6 信息: Initialization processed in 549 ms 7 五月 04, 2016 2:41:22 下午 org.apache.catalina.core.StandardService startInternal 8 信息: Starting service Catalina 9 五月 04, 2016 2:41:22 下午 org.apache.catalina.core.StandardEngine startInternal 10 信息: Starting Servlet Engine: Apache Tomcat/7.0.65 11 五月 04, 2016 2:41:23 下午 org.apache.catalina.startup.TldConfig execute 12 信息: 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. 13 五月 04, 2016 2:41:23 下午 org.apache.struts2.dispatcher.Dispatcher error 14 严重: Dispatcher initialization failed 15 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 16 at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301) 17 at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438) 18 at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207) 19 at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) 20 at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93) 21 at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487) 22 at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484) 23 at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:584) 24 at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484) 25 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:351) 26 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:235) 27 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) 28 at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970) 29 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438) 30 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482) 31 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193) 32 at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) 33 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) 34 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) 35 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4841) 36 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5535) 37 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 38 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) 39 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) 40 at java.util.concurrent.FutureTask.run(Unknown Source) 41 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 42 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 43 at java.lang.Thread.run(Unknown Source) 44 Caused by: java.lang.reflect.InvocationTargetException 45 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 46 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 47 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 48 at java.lang.reflect.Method.invoke(Unknown Source) 49 at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299) 50 ... 27 more 51 Caused by: java.lang.ExceptionInInitializerError 52 at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:84) 53 ... 32 more 54 Caused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency! 55 at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:169) 56 ... 33 more 57 Caused by: java.lang.ClassNotFoundException: javassist.ClassPool 58 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854) 59 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703) 60 at java.lang.Class.forName0(Native Method) 61 at java.lang.Class.forName(Unknown Source) 62 at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:166) 63 ... 33 more 64 65 五月 04, 2016 2:41:23 下午 org.apache.catalina.core.StandardContext filterStart 66 严重: Exception starting filter struts2 67 java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector 68 File: ContainerImpl.java 69 Method: inject 70 Line: 301 - com/opensymphony/xwork2/inject/ContainerImpl.java:301:-1 71 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496) 72 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193) 73 at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) 74 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) 75 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) 76 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4841) 77 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5535) 78 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 79 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) 80 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) 81 at java.util.concurrent.FutureTask.run(Unknown Source) 82 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 83 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 84 at java.lang.Thread.run(Unknown Source) 85 Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 86 at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301) 87 at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438) 88 at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207) 89 at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) 90 at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93) 91 at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487) 92 at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484) 93 at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:584) 94 at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484) 95 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:351) 96 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:235) 97 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) 98 at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970) 99 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438) 100 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482) 101 ... 13 more 102 Caused by: java.lang.reflect.InvocationTargetException 103 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 104 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 105 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 106 at java.lang.reflect.Method.invoke(Unknown Source) 107 at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299) 108 ... 27 more 109 Caused by: java.lang.ExceptionInInitializerError 110 at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:84) 111 ... 32 more 112 Caused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency! 113 at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:169) 114 ... 33 more 115 Caused by: java.lang.ClassNotFoundException: javassist.ClassPool 116 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854) 117 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703) 118 at java.lang.Class.forName0(Native Method) 119 at java.lang.Class.forName(Unknown Source) 120 at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:166) 121 ... 33 more 122 123 五月 04, 2016 2:41:23 下午 org.apache.catalina.core.StandardContext startInternal 124 严重: One or more Filters failed to start. Full details will be found in the appropriate container log file 125 五月 04, 2016 2:41:23 下午 org.apache.catalina.core.StandardContext startInternal 126 严重: Context [/testStruts] startup failed due to previous errors 127 五月 04, 2016 2:41:23 下午 org.apache.coyote.AbstractProtocol start 128 信息: Starting ProtocolHandler ["http-bio-8080"] 129 五月 04, 2016 2:41:23 下午 org.apache.coyote.AbstractProtocol start 130 信息: Starting ProtocolHandler ["ajp-bio-8009"] 131 五月 04, 2016 2:41:23 下午 org.apache.catalina.startup.Catalina start 132 信息: Server startup in 1119 ms
求解这是哪里出了问题?
牵一发而动全身
?
java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency! ?????
CLASSPATH 环境变量
没懂
@眉间剪水泛千愁: 环境变量设置了么?
JAVA_HOME
CLASSPATH
@二十二号同学: 这个还要设置环境变量?
@眉间剪水泛千愁: 设置一下看看
@二十二号同学:
1 <!DOCTYPE struts PUBLIC 2 "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 3 "http://struts.apache.org/dtds/struts-2.0.dtd"> 4 <struts> 5 <package name="struts2" extends="struts-default"> 6 <action name="loginAction" class="per.zxl.LoginAction"> 7 <result name="success">/welcome.jsp</result> 8 <result name="error">/error.jsp</result> 9 </action> 10 </package> 11 </struts>
你说的是这个?
@眉间剪水泛千愁: e ~~` bai du , Bing , Google
for Java classpath
拿走2园豆