[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-4316) Classloader cannot find XML files in multiple WARs

Stuart Douglas (JIRA) jira-events at lists.jboss.org
Mon Jul 27 19:04:40 EDT 2009


     [ https://jira.jboss.org/jira/browse/JBSEAM-4316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Douglas updated JBSEAM-4316:
-----------------------------------

    Attachment: jbseam4316-v1.diff


I have done a patch based on approach 2, there was a fair bit more to it that just passing ServletContext around, this may have to be one for 2.2.1, and just let people know that hot deployment does not work in multi war projects. The major changes are:

- FileDescriptor now try to get a url from the SerlvetContext before the classLoader, this is nessesary as some jboss versions will pick up the wrong .page.xml file if there are two with the same name in different wars.

- The servletContext is passed around through the Scanner and DeplotmentStrategy classes, any methods/constructors that were changes were kept as delegates to the new method. This should also fix some potential problems with resources such as remoting and captcha that could occur in multi war apps.

- I changed the signature of two methods on the ServletLifecycle class (keeping the old methods as delegates), this was necessary because otherwise the wrong Pages component could be replaced, so application a would end up with application b's pages.

This patch MAY also fix hot deployment of components in multi war setups, but I have not tested this. 

Reind, would you be able to try this patch out? I am confident that it fixes the original issue, but I have only had time to test it on the simple test case you provided so I am not 100% sure there will not be unintended side effects.

> Classloader cannot find XML files in multiple WARs
> --------------------------------------------------
>
>                 Key: JBSEAM-4316
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4316
>             Project: Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.2.0.CR1
>         Environment: JBoss AS 5.0.0.GA. Seam 2.2 r11299
>            Reporter: Reind D
>         Attachments: jbseam-4316.tar.gz, jbseam4316-v1.diff, pages-fix.diff
>
>
> I have an EAR that contains multiple WAR files. The first webapp to be accessed works fine. Any web request to the 2nd WAR to be accessed causes the following error:
> WARN [VFSScanner] Error handling item 'login/index.page.xml': java.lang.NullPointerException: Cannot find URL from classLoader for login/index.page.xml, loading from org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader at 1ed964f 
> FileDescriptor.java calls:
>    Resources.getResource(name, ServletLifecycle.getServletContext());
> Which returns a static reference to the ServletContext which is overwritten by the last webapp to be initialized.
>    private static ServletContext servletContext;
>    public static ServletContext getServletContext()
>    {
>       //don't throw an exception if null, because of unit tests
>       return servletContext;
>    }
> The 2nd webapp to be initialized will have a reference to the first webapp's ServletContext.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list