Struts 2将无法运行并出错

时间:2014-11-17 19:46:05

标签: java html eclipse hibernate struts2

不确定出了什么问题,但我注意到 Eclipse Tomcat 对我的班级变化没有反应。 Jsp和html更改工作正常。 我放了一些System.out.println("Printing from CompanyManagmentClass..")语句,但它没有用!  我有一个已执行并打印的hibernate请求,但不是我的println语句。所以我试图清理我的项目和tomcat,因此它现在不会运行struts 2。

可能与eclipse,tomcat和缓存有关吗?

此错误:

Nov 23, 2014 4:45:10 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter Struts2Controller
Unable to load configuration. - action - file:/home/roman/workspace/apache-tomcat-config/handyman/webapps/handyman/WEB-INF/classes/struts.xml:18:25
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:501)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
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.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: Unable to load configuration. - action - file:/home/roman/workspace/apache-tomcat-config/handyman/webapps/handyman/WEB-INF/classes/struts.xml:18:25
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
... 18 more
Caused by: Action class [com.handyman.web.HandymanManagementActions] not found - action - file:/home/roman/workspace/apache-tomcat-config/handyman/webapps/handyman/WEB-INF/classes/struts.xml:18:25
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:482)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:426)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:552)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:258)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 20 more

这是我的struts.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<constant name="struts.action.extension" value="php" />

<package name="basicPackage" extends="struts-default">

    <action name="welcome">
        <result>/index1.jsp</result>
    </action>

    <action name="newCompany" class="com.handyman.web.CompanyManagementAction"
        method="addCompany">
        <result>/companyRegisterSuccess.jsp</result>
        <result name="input"> /firstStruts.jsp </result>
    </action>

    <action name="newHandyman" class="com.handyman.web.HandymanManagementActions"
        method="addHandyman">
        <result>/handymanRegisterSuccess.jsp</result>
        <result name="input"> /firstStruts.jsp </result>
    </action>

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
 <display-name>Handyman2</display-name>
<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>

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

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

0 个答案:

没有答案