[jboss-as7-dev] Is there a way for a core module to load a class from a war

Jason Greene jgreene at redhat.com
Mon Jul 4 12:49:03 EDT 2011


You can instantiate a class in another module if you have a classloader or a module name for that module. This could be done by adding a registration method that takes a classloader. Alternatively if you are sure the incoming calls are all coming in from an EE context which contains the classes (and not system code) you can use TCCL.

Lastly you can switch to some kind of declarative model and add a deployment processor which handles registration as part of deployment.

Sent from my iPhone
On Jul 4, 2011, at 10:14 AM, Michael Musgrove <mmusgrov at redhat.com> wrote:

> The transactions module (org.jboss.jts) includes a flexible mechanism 
> for recovering transaction participants. Third party software can hook 
> into the recovery system by registering an object of type 
> java.lang.Class whose instances are capable of recovering particular 
> types of log record.
> 
> The registration is done by calling a static method defined in the jts 
> transactions module.
> 
> However this mechanism fails with the module class loading used in AS7 
> since the transactions module tries to instantiate an instance of a 
> class that belongs to another module (in my case it is a war deployed 
> into the deployment directory).
> 
> We use this mechanism in our REST API in order to support recovery.
> 
> My question is: is there a way of enabling the transactions module to 
> instantiate a class belonging to a war's class loader?
> 
> Mike
> 
> -- 
> Michael Musgrove
> mmusgrov at redhat.com
> 
> JBoss, by Red Hat
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
> (USA), Charlie Peters (USA)
> 
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev



More information about the jboss-as7-dev mailing list