2012-11-13 104 views
1

我想包括一個jar在我的struts2項目,使其行動可用於我的主要項目。添加行無法加載配置後,包括Jar

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

我struts.properties,並試圖重新部署到Tomcat使用Maven後,我得到的錯誤:

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文件 - 一個在我的主項目中,另一個在t他包括我的jar。如果這是問題,有什麼方法可以排除依賴關係struts.xml嗎?或者這與其他事情完全相關?

刪除includeJars行允許我部署我的應用程序,但我無法訪問正在包含的jar中的操作。

回答

0

確保你的struts.xml中有bean範圍的攔截器,並且也是你的pom.xml中的依賴項。