You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Sebastien Poirier (JIRA)" <ji...@apache.org> on 2007/02/20 11:41:16 UTC

[jira] Commented: (WW-1635) struts.xml include dependant packages not loading properly

    [ https://issues.apache.org/struts/browse/WW-1635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40211 ] 

Sebastien Poirier commented on WW-1635:
---------------------------------------

Is it possible to reopen this issue: I upgraded recently from struts-2.0.1 to 2.0.5 and got exactly the same problem as Matt.

I spent a few time looking for the problem and it happened that the problem occurs in xwork2 when loading the configuration files:
in class com.opensymphony.xwork2.config.providers.XmlConfigurationProvider,  the method loadConfigurationFiles() was modified in the recent releases of xwork (since 2.0.0 I think): now when a struts.xml file includes another struts-foo.xml file, the packages are read in th wrong order, the ones from struts-foo.xml being configured before the ones in struts.xml, that's why the configuration provider can't resolve the parent package.

I found a simple patch to force the configuration provider to read the includes in the right order, but it applies to xwork, don't know if you work in collaboration with them.
I deployed my application with the patched version of xwork, and works perfectly now.

begin patch for com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.java  ------------------------------------------------------------

745c745
<         List<Document> docs = new ArrayList<Document>();
---
>         LinkedList<Document> docs = new LinkedList<Document>();
827c827
<                 docs.add(doc);
---
>                 docs.addFirst(doc);

end patch ----------------------------------------------------------------


Seb.

> struts.xml include dependant packages not loading properly
> ----------------------------------------------------------
>
>                 Key: WW-1635
>                 URL: https://issues.apache.org/struts/browse/WW-1635
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.2, 2.0.4, 2.0.5
>            Reporter: Matt Finholt
>         Assigned To: Don Brown
>            Priority: Critical
>
> In "struts.xml" when I include "myapp.xml" that contains packages that extend the defined pkg in "struts.xml" it is unable to resolve the parent package. This happens as the application is initially started.
> This issue was introduced when I upgraded from Struts 2.0.1 to 2.0.2
> -Matt
> ----- struts.xml ------
> <struts>
>     <include file="struts-default.xml"/>
>     <include file="config-browser.xml"/>
>     <package name="default" extends="struts-default">
> ....
>     </package>
>     <include file="other.xml"/>
> </struts>
> ------ other.xml ------
> <struts>
>     <package  name="user" extends="default" namespace="/">
> ....
>     </package>
> </struts>
> ----- ERROR ----
> [OLT] INFO [main] XmlConfigurationProvider.register(144) | Parsing configuration file [struts-default.xml]
> [OLT] INFO [main] XmlConfigurationProvider.register(144) | Parsing configuration file [struts-plugin.xml]
> [OLT] INFO [main] XmlConfigurationProvider.register(144) | Parsing configuration file [struts.xml]
> [OLT] INFO [main] ObjectTypeDeterminerFactory.<clinit>(30) | Detected GenericsObjectTypeDeterminer, initializing it...
> [OLT] INFO [main] XWorkConverter.getInstance(203) | Detected AnnotationXWorkConverter, initializing it...
> [OLT] INFO [main] SpringObjectFactory.setAutowireStrategy(71) | Setting autowire strategy to name
> [OLT] ERROR [main] ConfigurationUtil.buildParentsFromString(47) | Unable to find parent package default
> [OLT] ERROR [main] XmlConfigurationProvider.buildPackageContext(483) | Unable to find parent packages default
> [OLT] ERROR [main] [/OLT].filterStart(3638) | Exception starting filter struts
> .......
> [OLT] ERROR [main] [/OLT].filterStart(3638) | Exception starting filter struts
> Error building results for action mainMenu in namespace / - action - file:/C:/Documents%20and%20Settings/myloc/My%20Documents/~Workspace-config2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps/OLT/WEB-INF/classes/struts-webapp.xml:14:79
> 	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:302)
> 	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:378)
> 	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:242)
> 	at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
> 	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:146)
> 	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
> 	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:394)
> 	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450)
> 	at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:203)
> 	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223)
> 	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
> 	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
> 	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634)
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
> 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
> 	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
> 	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
> 	at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
> 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
> Caused by: No result type specified for result named 'success', perhaps the parent package does not specify the result type? - result - file:/C:/Documents%20and%20Settings/mfinholt.SEWARDINC/My%20Documents/~Workspace-config2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps/OLT/WEB-INF/classes/struts-webapp.xml:15:33
> 	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:524)
> 	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:300)
> 	... 26 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.