-
1. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
jesper.pedersen Aug 10, 2012 9:13 AM (in response to pedrokowalski)Depends on what you are trying to do. But I would wait until ManagedConnection / Activation. Use the latest nightly snapshot to get the latest JCA related fixes.
-
2. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
pedrokowalski Aug 10, 2012 9:20 AM (in response to jesper.pedersen)Jasper, thanks for your reply.
I want to create JMS endpoint based on the JCA (ra.xml) configuration, so basically I need to wait for the set...(-) methods of the ResourceAdapter to be called. In this case, the @PostConstruct is a bit too early in the initialization phase for me (setters are not called at this point). Activation is even earlier, right? So still I won't have access to the properties I require to create the Queue.
-
3. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
jesper.pedersen Aug 10, 2012 9:37 AM (in response to pedrokowalski)1 of 1 people found this helpfulA JMS endpoint doesn't belong in the start(BootstrapContext) method - each ManagedConnection should control that - kill in .destroy() - same goes for the Activation instance created in ResourceAdapter::endpointActivation. The endpointActivation method can be called after the resource adapter have been fully initialized (incl. start(BC)).
Look at ResourceAdapterAssociation in order to move data around between the different components: ResourceAdapter, ManagedConnectionFactory, ActivationSpec and AdminObject.
-
4. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
pedrokowalski Aug 13, 2012 7:02 AM (in response to jesper.pedersen)Ok, I modified it a bit, so now I have all the properties I need - I just have a problem of binding a Queue to the JNDI. I am not using the CCI for the clients but instead I've chosen to use the JMS API.
So, I've got the ManagedConnectionFactory already binded in the JNDI (thanks to the connection-definition in the ironjacamar.xml) that produces my ConnectionFactory (it extends javax.jms.ConnectionFactory). At this point I can successfully lookup the ConnectionFactory from the JNDI and create a Connection. My ManagedConnection creates a Connection which implements javax.jms.Connection.
Now, I've implemented my own Queue (extends javax.jms.Queue) and would like to bind it to the JNDI, so the user will be able to do something like:
@Resource(mappedName = "java:jboss/myjca/connection/test")
private IfaceConnectionFactory connectionFactory;
@Resource(mappedName = "java:jboss/myjca/queue/test")
private Queue queue;
And use the JMS API to create a message and send it to the my Queue.
Can I bind some resource to the JNDI from the JCA? Is this even the right way to do it or did I messed up the overall design?
Thanks in advance for your help.
-
5. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
jesper.pedersen Aug 13, 2012 7:18 AM (in response to pedrokowalski)If your resource adapter is JMS like I suggest that you take a look at HornetQ's resource adapter implementation. Binding something in JNDI for JCA is either a ConnectionFactory or an AdminObject.
-
6. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
pedrokowalski Aug 14, 2012 10:19 AM (in response to jesper.pedersen)Thanks once again Jasper for your time and help.
Finally, I've used some combination of Stuart's sample code (https://github.com/stuartwdouglas/as7-example-jndi-binding/blob/master/src/main/java/org/jboss/as/example/jndibinding/JndiServiceActivator.java) and saved the reference to the ServiceActivatorContext. I can now bind resources to the JNDI in runtime; yeah, I feel it's damn nasty but at least it moves me I a bit closer to the JCA RA migration (it worked well in JBoss 4.2.x and doesn't want to cooperate with JBoss 7.1.1 :-)
-
7. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
jesper.pedersen Aug 14, 2012 10:20 AM (in response to pedrokowalski)I'm getting the feeling that you aren't doing it correctly The hint was above, use an AdminObject with ResourceAdapterAssociation. And use a nightly snapshot...
-
8. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
pedrokowalski Aug 14, 2012 10:43 AM (in response to jesper.pedersen)Yeah, Jasper I got the same feeling that it's nasty... I'm just trying to workaround it to make an old JCA adapter with a lot of logic in it to work on the JBoss 7.1.1.
I can use the ResourceAdapterAssociation to move the ResourceAdapter forth and back but will the JBoss allow me to bind anything to the JNDI from within the AdminObject?
And about the nightly snapshot - I'm not sure if it'll be approved by the decisive guys...
Thanks!
-
9. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
jesper.pedersen Aug 14, 2012 10:47 AM (in response to pedrokowalski)The AdminObject is bound in JNDI. And I don't accept bug reports against 7.1.1; we have done a ton of bug fixes since. Furthermore AS7 isn't supported by a SLA - use JBoss EAP.
-
10. Re: JCA cannot bind JNDI resource within javax.resource.spi.ResourceAdapter#start() method
pedrokowalski Aug 17, 2012 5:15 AM (in response to jesper.pedersen)I've referred to the JCA spec one more time and the Admin object fits exactly what I was trying to achieve. I bound it to the JNDI using ironjacamar.xml.
Thanks once again Jasper.