gpt4 book ai didi

java - 正在调用 struts.xml 中定义的 Action ,但未调用 Action 包中存在的 Action

转载 作者:行者123 更新时间:2023-11-30 09:28:18 30 4
gpt4 key购买 nike

我正在将我的应用程序服务器从 Jboss 4.2 迁移到 7.1。我在 Struts 配置中收到以下错误。 struts.xml 中定义的 Action 被调用,而 Action 包中的操作未被调用。我还发布了我的 Actionstruts.xml 和堆栈跟踪:

13:56:06,503 ERROR [org.apache.struts2.dispatcher.Dispatcher] (http-localhost-127.0.0.1-8080-2) Could not find action or result: There is no Action mapped for namespace / and action name loginValidate. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178) [xwork-core-2.1.6.jar:]
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) [struts2-core-2.1.8.1.jar:]
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) [struts2-core-2.1.8.1.jar:]
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) [xwork-core-2.1.6.jar:]
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478) [struts2-core-2.1.8.1.jar:]
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) [struts2-core-2.1.8.1.jar:]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) [struts2-core-2.1.8.1.jar:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_20]

我的Struts.xml:

<constant name="struts.convention.action.packages" value="com.infotech.project.web.action" />
<constant name="struts.convention.package.locators" value="actions,action" />


<constant name="struts.convention.result.path" value="/WEB-INF/jsp" />

<constant name="struts.convention.default.parent.package" value="project" />


<package name="default" namespace="/" extends="struts-default,json-default" />
<constant name="struts.devMode" value="true" />

<package name="project"
extends="struts-default,json-default,jfreechart-default, jasperreports-default"
namespace="/">
<!-- more action names goes here -->
</package>

我的LoginAction.java:

package com.infotech.project.web.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
@Result(type="json")
public class LoginAction extends ActionSupport implements SessionAware {


@SuppressWarnings("unchecked")
@SkipValidation
@Action(value = "/loginValidate", results = { @Result(name = "success", params = {"ignoreHierarchy","false"}) })
public String validateUserLogin() {
// validation code goes here
}
}

更新到 Struts 2.3.4 后:

ERROR [com.opensymphony.xwork2.util.finder.ClassFinder] (MSC service thread 1-1) Unable to read class [com.lntinfotech.virtuoso.web.action.DttjoinAction]: java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/finder/ClassFinder$InfoBuildingVisitor
at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:782) [xwork-core-2.3.4.jar:2.3.4]
at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:165) [xwork-core-2.3.4.jar:2.3.4]
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:386) [struts2-convention-plugin-2.3.4.jar:2.3.4]
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:344) [struts2-convention-plugin-2.3.4.jar:2.3.4]
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53) [struts2-convention-plugin-2.3.4.jar:2.3.4]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:245) [xwork-core-2.3.4.jar:2.3.4]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) [xwork-core-2.3.4.jar:2.3.4]
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) [struts2-core-2.3.4.jar:2.3.4]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437) [struts2-core-2.3.4.jar:2.3.4]
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) [struts2-core-2.3.4.jar:2.3.4]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) [struts2-core-2.3.4.jar:2.3.4]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_20]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_20]

最佳答案

我认为问题可能出在同一个命名空间中有两个包。尝试删除一个包,或更改其中一个的命名空间(可能是第一个,它是空的)


编辑:

它是 Bug WW-3662: (Struts2) convention-plugin not work in jboss-7.0.0

如您所见,它已在最新版本中得到解决。

因此,如果您需要迁移到 JBoss 7,则需要迁移到 Struts 2.3.3 或更高版本。

希望对你有帮助

关于java - 正在调用 struts.xml 中定义的 Action ,但未调用 Action 包中存在的 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14099422/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com