struts配置出错的问题

时间:2024-04-09 06:59:54

Hello!这是我第二篇文章了

首先,SSH的课程正在学习,而代表S的Struts一开始配置就出现错误了(不会吧

在我出错的时候,看到很多同学都交了作业了,QAQ

所以我觉得是自己打错的问题,毕竟老师的答案都有给出

然后找啊找,很难才找到。

首先建了ssh03的项目,项目结构是这样的,不过有点错,后面会提到

struts配置出错的问题

这里大致上是没什么问题,接着看下去,自己配置的struts.xml:

struts配置出错的问题

来找个碴吧!和老师给的代码配图

struts配置出错的问题

嗯,首先的碴是:1、字体不一样2、图片分辨率不一样3、继续观察中。。。

过了5个小时左右……

好的,找到了吗,我找到了全部错误的点了QAQ

不过先po一下错误的提示

21:41:00,238 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) WFLYDS0004: Found ssh03.war in deployment directory. To trigger deployment create a file called ssh03.war.dodeploy
21:41:00,257 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "ssh03.war" (runtime-name: "ssh03.war")
21:41:01,175 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."ssh03.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ssh03.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "ssh03.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class org.apache.struts.faces.taglib.JavascriptValidatorTag with ClassLoader ModuleClassLoader for Module "deployment.ssh03.war" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/validator/ValidatorResources
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:80)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.validator.ValidatorResources from [Module "deployment.ssh03.war" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 15 more


21:41:01,253 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "ssh03.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"ssh03.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"ssh03.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class org.apache.struts.faces.taglib.JavascriptValidatorTag with ClassLoader ModuleClassLoader for Module \"deployment.ssh03.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: org/apache/commons/validator/ValidatorResources
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.validator.ValidatorResources from [Module \"deployment.ssh03.war\" from Service Module Loader]"}}
21:41:01,277 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "ssh03.war" (runtime-name : "ssh03.war")
21:41:01,278 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."ssh03.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "ssh03.war"

总的来说就是部署不成功,项目部署出错,就连网站都是这样显示

struts配置出错的问题

然后其实struts.xml也有提示错误,但是不知道怎么解决,可能上课基础什么的有没学好,百度后的问题答案也有但也不是可以让我解决的

struts配置出错的问题

然后我对比了老师的终于发现了一个点的不同。。。。。。改了其中一个碴,既然一改就要全改嘛

struts配置出错的问题struts配置出错的问题

index.jsp和login.jsp

然后部署不成功

22:02:51,432 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"ssh03.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"ssh03.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class org.apache.struts.faces.taglib.JavascriptValidatorTag with ClassLoader ModuleClassLoader for Module \"deployment.ssh03.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: org/apache/commons/validator/ValidatorResources
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.validator.ValidatorResources from [Module \"deployment.ssh03.war\" from Service Module Loader]"}}
22:02:51,465 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0016: Replaced deployment "ssh03.war" with deployment "ssh03.war"
22:02:51,465 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."ssh03.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "ssh03.war"

网上查了是包的问题,我看了看应该是导入多了一个struts.1.38那个library,然后不能remove,只能重新建一个项目了,名字叫lab3,结构如下:

struts配置出错的问题

还有个需要改一下的,就是struts文件

struts配置出错的问题

其中adduser大小写错还有“actionName”那里写错配置,adduser.jsp老师那里没有给出代码所以我写成login.jsp不信回去上面看一下

 网上百度查到如果type="redirectAction" 会出现错误,就改了如下配置

在Myeclipse里Window-->Preference-->Myeclipse -->Validation -->struts2 Validator后的Build列要去掉勾

因为博主文章说不得未经允许转载我也没转了,默默地点了个赞

这些配置好了之后,就到项目部署,没报错

第一次觉得用户名和密码错误是一件多么开心的事,毕竟这个页面就代表我做完作业了TAT

struts配置出错的问题struts配置出错的问题struts配置出错的问题

又是一次“老眼昏花”的经历,要多吃鱼了,而且部署struts要多加小心了

喔对了,部署wildfly的时候最好把带有wildfly服务器地址网页全关了,比较保险,实在是烦就把所有网页关了再部署wildfly,可能会好点。

p.s.在这报错期间有ssh03项目之外,自己还建了个sshlab3项目,因为代码差不多,所以要删了,写段文字纪念一下...