在Struts Web应用程序中添加Struts 2-Rest插件和Conventional插件时遇到错误

时间:2019-02-14 21:56:04

标签: struts2 struts2-rest-plugin

我正在研究添加Restful调用,我对struts和Restweb服务以及现有的非Rest(Action)调用都是陌生的,我知道我需要在我的应用程序中将struts2Rest插件与Conventional插件集成在一起(已经有StrutsCore jar)并在POM中添加了这些依赖关系,但是仍然在我的应用程序中第一个操作(LoginAction)命中后导致错误。有人可以帮我吗?提前谢谢

Error:
ERROR ClassFinder:38 - Unable to read class [WEB-INF.lib.SAEController-13.0.jar.com.ABC.wfb.struts.actionform2.WorkFlowForm]
Could not load WEB-INF/lib/SAEController-13/0/jar/com/ABC/wfb/struts/actionform2/WorkFlowForm.class - [unknown location]
    at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:722)
    at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:112)
    at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:390)
    at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:347)
    at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:260)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
    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.getFilter(ApplicationFilterConfig.java:416)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3225)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3794)
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163)
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61)
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    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)
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

我尝试添加这些罐子但出现错误

POM.xml如下:

<dependencies>
        <dependency>
    <groupId>org.apache.axis</groupId>
    <artifactId>axis</artifactId>
    <version>1.4</version>
</dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>    commons-lang</artifactId>
            <version>2.4</version>
        </dependency>
            <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging </artifactId>
            <version>1.0.4</version>
        </dependency>
        <dependency>
            <groupId>com.lowagie</groupId>
            <artifactId>    itext   </artifactId>
            <version>2.1.7</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>    itextpdf    </artifactId>
            <version>5.4.1</version>
        </dependency>
            <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>    servlet-api </artifactId>
            <version>2.3</version>
        </dependency>
            <dependency>
            <groupId>org.jfree</groupId>
            <artifactId>    jcommon </artifactId>
            <version>1.0.23</version>
        </dependency>
            <dependency>
            <groupId>org.jfree</groupId>
            <artifactId>    jfreechart  </artifactId>
            <version>1.0.14</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>    mail    </artifactId>
            <version>1.4</version>
        </dependency>
    <dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>3.2.8</version>
</dependency>
<dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.0-FINAL</version>
        </dependency>
        <dependency>
    <groupId>struts</groupId>
    <artifactId>struts</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.15.2</version>
</dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-tiles-plugin</artifactId>
    <version>2.3.15.2</version>
</dependency>
<dependency>
    <groupId>ognl</groupId>
    <artifactId>ognl</artifactId>
    <version>3.0.6</version>
</dependency>
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
</dependency>
    <dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-core</artifactId>
    <version>2.0.6</version>
</dependency>
<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-jsp</artifactId>
    <version>2.0.6</version>
</dependency>
<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-api</artifactId>
    <version>2.0.6</version>
</dependency>
 <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-tiles-plugin</artifactId>
    <version>2.3.15.2</version>
</dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-json-plugin</artifactId>
    <version>2.3.15.2</version>
</dependency>
<dependency>
    <groupId>com.jgeppert.struts2.jquery</groupId>
    <artifactId>struts2-jquery-plugin</artifactId>
    <version>2.5.3</version>
</dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-dojo-plugin</artifactId>
    <version>2.3.15.2</version>
</dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.15.2</version>
</dependency>
<dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.8.0</version>
                    </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.3</version>
                    </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.1</version>
                    </dependency> 

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>3.1.3.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.1.3.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.5</version>
    </dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.5.5</version>
</dependency>
<dependency>
    <groupId>javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.11.0.GA</version>
</dependency>
<dependency>
    <groupId>org.freemarker</groupId>
    <artifactId>freemarker</artifactId>
    <version>2.3.19</version>
</dependency>
<dependency>
    <groupId>displaytag</groupId>
    <artifactId>displaytag-export-poi</artifactId>
    <version>1.1.1</version>
</dependency>
<dependency>
    <groupId>displaytag</groupId>
    <artifactId>displaytag</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>commons-discovery</groupId>
    <artifactId>commons-discovery</artifactId>
    <version>0.2</version>
</dependency>
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>2.1</version>
        </dependency>   
        <dependency>
            <groupId>commons-el</groupId>
            <artifactId>commons-el</artifactId>
            <version>1.0</version>
        </dependency>
    <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.1</version>
        </dependency>
                <dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.0.3</version>
</dependency>
                <dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-common-utilities</artifactId>
    <version>2.0.6</version>
</dependency>
        <dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20090211</version>
</dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-annotations</artifactId>
    <version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-rest-plugin</artifactId>
        <version>2.3.15.2</version>
    </dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-convention-plugin</artifactId>
    <version>2.3.15.2</version>
    </dependency>
    </dependencies>






And My Struts.xml contains configuration as:

<struts>
    <constant name="struts.devMode" value="false" />

    <constant name="struts.configuration.xml.reload" value="true" />
    <constant name="struts.enable.DynamicMethodInvocation" value="true" /> 
    <constant name="struts.ui.theme" value="simple" />
    <constant name="struts.multipart.maxSize" value="5242880" />
...............................................



<actions>...............................








It should Work for both rest and non Rest

0 个答案:

没有答案