You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Robert Burrell Donkin (JIRA)" <ji...@apache.org> on 2007/01/07 19:33:27 UTC

[jira] Commented: (BETWIXT-57) Class loader problem in JBoss version 4.0.4GA

    [ https://issues.apache.org/jira/browse/BETWIXT-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462843 ] 

Robert Burrell Donkin commented on BETWIXT-57:
----------------------------------------------

There are issues with switching universally to using the context classloader: too many containers do not set this classloader correctly. Digester rules should use the classloader provided by Digester. So, the Betwixt rules should use the Digester classloader. However, the Digester implemetation is not exposed by XmlIntrospector. So, this setting needs to be added into the IntrospectionConfiguration.

I've committed these changes into trunk.

Now, when using Betwixt in a container like JBoss with a well behaved context classloader, setUseContextClassLoader(true) should called on IntrospectionConfiguration for the XMLIntrospector. This should produce the same result as the fix above. Please try the latest code and open this again if this fix doesn't work.

> Class loader problem in JBoss version 4.0.4GA
> ---------------------------------------------
>
>                 Key: BETWIXT-57
>                 URL: https://issues.apache.org/jira/browse/BETWIXT-57
>             Project: Commons Betwixt
>          Issue Type: Bug
>         Environment: JBoss application server version 4.0.4GA. Probably affects most versions of JBoss
>            Reporter: Surjit Sen
>            Priority: Critical
>
> When using betwixt in a JBoss application, "Class not found" exceptions get thrown when Class.forName methods are called in classes org.apache.commons.betwixt.digester.ElementRule and org.apache.commons.betwixt.digester.ClassRule. Specifically the Class.forName method uses the system class loader to load classes and in JBoss the classpath normally does not contain the application jar files. The fix is very simple. The Class.forName method calls in both the classes were replaced with the following code lines in ElementRule and similar changes were made in ClassRule as well. This fix ensures that the appropriate class loader is used for loading classes and is similar to the fix made in log4j.
>                 ClassLoader loader = Thread.currentThread().getContextClassLoader();
>                 if (loader == null) {
>                 	loader = Class.forName(implementationClass).getClassLoader();
>                     //Class clazz = Class.forName(implementationClass);
>                 }
>                 Class clazz = loader.loadClass(implementationClass);
>                 descriptor.setImplementationClass(clazz);

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org