ResolverUtil fails to load action beans outside WEB-INF under JBoss
-------------------------------------------------------------------

                 Key: STS-397
                 URL: http://mc4j.org/jira/browse/STS-397
             Project: Stripes
          Issue Type: Bug
    Affects Versions: Release 1.4.3
         Environment: Windows 2000, JDK 1.5.0.11, JBoss 4.0.2
            Reporter: Jan Moravec
         Assigned To: Tim Fennell


I encountered problem with Stripes failing to find action beans located outside 
WEB-INF/class. No exception was thrown, the action beans just were not found. 
After some digging I came to the following conclusion and solution:

The current dynamic action bean discovery implementation makes use of the URLs 
returned from URLClassLoaders found in the CL hierarchy of the current thread 
context CL. This is an example of the CL hierarchy with dumped URLs of the 
found URLClassLoader instances under JBoss:

10:56:43,218 INFO  (RMI TCP Connection(3)-192.168.1.65) [STDOUT] 
  WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

    
file:/C:/JBoss/server/eshops/tmp/deploy/tmp5995eshops.ear-contents/eshops-exp.war/WEB-INF/classes/
  [EMAIL PROTECTED]
    empty URLs
  [EMAIL PROTECTED] 
url=file:/C:/JBoss/server/eshops/tmp/deploy/tmp5995eshops.ear ,addedOrder=28}
    empty URLs
  [EMAIL PROTECTED]
    empty URLs
  [EMAIL PROTECTED]
    empty URLs
  [EMAIL PROTECTED]
    file:/C:/Java/Jdk1.5/lib/tools.jar
    file:/C:/JBoss/bin/run.jar
  [EMAIL PROTECTED]
    file:/C:/Java/Jdk1.5/jre/lib/ext/bcprov.jar
    file:/C:/Java/Jdk1.5/jre/lib/ext/dnsns.jar
    file:/C:/Java/Jdk1.5/jre/lib/ext/localedata.jar
    file:/C:/Java/Jdk1.5/jre/lib/ext/localedata.pack
    file:/C:/Java/Jdk1.5/jre/lib/ext/sunjce_provider.jar
    file:/C:/Java/Jdk1.5/jre/lib/ext/sunpkcs11.jar

As one can see, the URLs of EAR's utility JARs are not exposed by JBoss 
org.jboss.mx.loading.UnifiedClassLoader3. And that is even though the UCL is a 
subclass of URLClassLoader! Its getURLs method seems to return an empty array. 

One needs to call getClasspath() method on the UCL to obtain the array of URLs 
of JARs inside the deployed EAR. These URLs can then be normally scanned for 
ActionBean instances. I have a patched version of ResolverUtil class that seems 
to work. I will attach it later if I find out how to do that (no file upload on 
this screen).

Maybe the action bean discovery mechanism should be configurable because you 
may need similar hacks for other application servers....

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

        

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to