我正在尝试在我的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)
我在其他帖子中看到这是因为它找不到struts.xml,因为有两个struts.xml文件 - 一个在我的主项目中,另一个在我包含的jar中。如果这是问题,有没有办法排除依赖struts.xml?或者这与其他事情有关?
删除includeJars行允许我部署我的应用程序,但是我无法访问正在包含的jar中的操作。
答案 0 :(得分:0)
确保struts.xml中有bean-scope拦截器,并且还作为pom.xml中的依赖项。