分割したファイルからパッケージを参照できない
分割したファイルからパッケージをextendすると、実行時に以下のエラーが発生して起動できないという問題が発生します。
2007-05-14 14:20:25,131 ERROR [main][com.opensymphony.xwork2.config.ConfigurationUtil] - Unable to find parent package myapp-eshop-default
原因は、xwork2.01のバグの模様。xwork 2.0.2にjarを差し替えると解消されました。
<dependency> <groupId>opensymphony</groupId> <artifactId>xwork</artifactId> <version>2.0.2</version> </dependency>
Struts2の正式FIXは、2.0.8のようです。
- 「struts.xml include dependant packages not loading properly」
- 「Packages in includes can't see packages declared ahead of include」
<struts> <!-- Include Struts 2 default (from Struts 2 JAR) --> <include file="struts-default.xml" /> <package name="myapp-default" extends="struts-default" abstract="true" > <interceptors> … </interceptors> </package> <include file="struts/struts-order.xml" /> </struts>
struts-order.xmlからstruts.xmlのパッケージを参照するとエラーになる。
<struts> <package name="order" extends="myapp-default" namespace="/order" > … </package> </struts>