Is there a way for a core module to load a class from a war

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is there a way for a core module to load a class from a war

Michael Musgrove
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
[hidden email]

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
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a way for a core module to load a class from a war

Bob McWhirter
Sounds like what the ServiceLoader stuff is supposed to accomplish.

Bob

--
Sent from my iPhone


On Jul 4, 2011, at 11:14 AM, Michael Musgrove <[hidden email]> 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
> [hidden email]
>
> 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
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a way for a core module to load a class from a war

Jason T. Greene
In reply to this post by Michael Musgrove
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 <[hidden email]> 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
> [hidden email]
>
> 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
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Loading...