包含 Jar 后无法加载配置



我正在尝试在我的 struts2 项目中包含一个 jar,以便它的操作可以在我的主项目中使用。添加行后

struts.convention.action.includeJars=.*?survey.*?

到我的 struts.properties 并尝试使用 Maven 重新部署到 Tomcat,我收到错误:

WARN  InterceptorBuilder 14 Nov 2012 09:58:09: Unable to load config class com.googlecode.scopeplugin.ScopeInterceptor at interceptor - jar:file:/other/dev/survey/webapp/target/survey-4.4-RC11-SNAPSHOT/WEB-INF/lib/survey-controller-4.4-RC11-SNAPSHOT.jar!/struts.xml:12:91 probably due to a missing jar, which might be fine if you never plan to use the bean-scope interceptor
ERROR InterceptorBuilder 14 Nov 2012 09:58:09: Actual exception
Caught Exception while registering Interceptor class com.googlecode.scopeplugin.ScopeInterceptor - interceptor - jar:file:/other/dev/survey/webapp/target/survey-4.4-RC11-SNAPSHOT/WEB-INF/lib/survey-controller-4.4-RC11-SNAPSHOT.jar!/struts.xml:12:91
    at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:214)
    at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:70)
    at org.apache.struts2.convention.DefaultInterceptorMapBuilder.buildInterceptorList(DefaultInterceptorMapBuilder.java:99)

并进一步追踪:

ERROR Dispatcher 13 Nov 2012 17:37:13: Dispatcher initialization failed
Unable to load configuration. - [unknown location]
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)

我在其他帖子中看到这是因为它找不到支柱.xml因为有两个支柱.xml文件 - 一个在我的主项目中,另一个在我包含的罐子中。如果这是问题所在.xml有没有办法排除这种依赖关系支柱?或者这完全与别的东西有关?

删除包含 Jars 行允许我部署我的应用,但我无法访问所包含的 jar 中的操作。

确保在你的 struts 中.xml 中有一个 bean-scope 拦截器,并且作为 pom 中的依赖项.xml。

最新更新