You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by thabach <ba...@evolootion.ch> on 2009/11/02 22:24:43 UTC

RAR deployment, ConnectionFactory Instantiation and JNDI.

Heya 

I am implementing an outbound-resourceadapter. The RAR seems to deploy fine,
but the ManagedConnectionFactory's createConnectionFactory method is never
triggered by the container. 

As I learned every application server has some complement to the ra.xml. In
JBoss for example there are the *-ds.xml files as mentioned in an 
http://old.nabble.com/Re%3A-Unit-testing-code-containing-DirContext-resource-injection-p24836874.html
earlier post . In such *-ds.xml files, for example the JNDI name of the
instantiated ConnectionFactory object is given. 

Instantiation of the ConnectionFactory object (the call to the
ManagedConnectionFactory's createConnectionFactory method) and binding to
JNDI registry is triggered by JBoss at *-ds.xml file processing.

I want to accomplish the same with OpenEJB. I found an ra.xml complementing 
http://cwiki.apache.org/GMOxDOC22/geronimo-raxml.html file  for Geronimo,
but see no JNDI name declaration in there and don't know how to apply it for
OpenEJB.

How does one configure matter for OpenEJB ? How to trigger the creation of a
ManagedConnectionFactory, the instantiation of the ConnectionFactory object
and the binding of the latter to JNDI ?

Any help very much appreciated, cheers, Christian. 



-- 
View this message in context: http://old.nabble.com/RAR-deployment%2C-ConnectionFactory-Instantiation-and-JNDI.-tp26157843p26157843.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: RAR deployment, ConnectionFactory Instantiation and JNDI.

Posted by David Blevins <da...@visi.com>.
On Nov 3, 2009, at 6:49 AM, thabach wrote:

>
> I succeeded in looking up the ManagedConnectionFactory under
> "java:openejb/Resource/classes". Apologies for bothering you while  
> having
> lengthy posts in talking to myself over the mailing list :thinking: !

That's quite alright.  Thinking out loud is "documenting out loud" and  
all sorts of good things can come from that.

On the question of why your connector shows up as "classes", it's  
because we use the jar or directory name to come up with the module  
name and we use the module name as the name of the connector.  You can  
set the name of the connector in the ra.xml like so:

   <connector id="FooConnector">
     ...
   </connector>

Not all vendors will use that id, but we do.  In Java EE 6 all  
descriptors will have a "<module-name>" element where the name can be  
standardly set, which will be very nice.

Did you figure out how to get references to your objects from JNDI?   
 From inside an EJB or Servlet you can use @Resource to get it bound  
into java:comp/env and made available for lookup or injection.

Hope that helps!  Keep sending the emails :)

-David


> thabach wrote:
>>
>> Heya
>>
>> I think I got a bit further, but still am confused.
>>
>> OpenEJB in its Assembler::createResource() method does create both an
>> instance of my  ResourceAdapter and an instance of my
>> ManagedConnectionFactory. Both instances are bound to JNDI through  
>> (also
>> from Assembler::createResource()):
>>
>> containerSystem.getJNDIContext().bind("openejb/Resource/" +
>> serviceInfo.id, service);
>>
>> Strange enough the serviceInfo.id is 'classesRA' for the  
>> ResourceAdapter
>> and 'classes' for the ManagedConnectionFactory, respectively (see  
>> log,
>> below). Is this normal or am I missing something in my  
>> implementation ?
>>
>> Further, when I try to lookup either "openejb/Resource/classesRA" or
>> "openejb/Resource/classes", I get an NameNotFoundException. How can  
>> I get
>> a reference to the ManagedConnectionFactory object through the
>> initialContext ?
>> 	
>> Any help is very much appreciated, Christian.
>>
>> (== log on staring up my outbound ResourceAdapter with OpenEJB ==)
>>
>> Apache OpenEJB 3.1.2    build: 20091010-03:11
>> http://openejb.apache.org/
>> INFO - openejb.home = C:\Develop\_jee_local\_jee_ws\loopback-adapter
>> INFO - openejb.base = C:\Develop\_jee_local\_jee_ws\loopback-adapter
>> INFO - Configuring Service(id=Default Security Service,
>> type=SecurityService, provider-id=Default Security Service)
>> INFO - Configuring Service(id=Default Transaction Manager,
>> type=TransactionManager, provider-id=Default Transaction Manager)
>> INFO - Using
>> 'openejb.deployments.classpath.include=.*target/classes.*|.*target/ 
>> test-classes.*'
>> INFO - Found ConnectorModule in classpath:
>> C:\Develop\_jee_local\_jee_ws\loopback-adapter\target\classes
>> INFO - Beginning load:
>> C:\Develop\_jee_local\_jee_ws\loopback-adapter\target\classes
>> INFO - Configuring enterprise application: classpath.ear
>> INFO - Configuring Service(id=classesRA, type=Resource,
>> provider-id=classesRA)
>> INFO - Configuring Service(id=classes, type=Resource, provider- 
>> id=classes)
>> INFO - Enterprise application "classpath.ear" loaded.
>> INFO - Creating TransactionManager(id=Default Transaction Manager)
>> DEBUG - defaultTransactionTimeoutSeconds=600
>> DEBUG - TxRecovery=false
>> DEBUG - bufferSizeKb=32
>> DEBUG - checksumEnabled=true
>> DEBUG - adler32Checksum=true
>> DEBUG - flushSleepTimeMilliseconds=50
>> DEBUG - logFileDir=txlog
>> DEBUG - logFileExt=log
>> DEBUG - logFileName=howl
>> DEBUG - maxBlocksPerFile=-1
>> DEBUG - maxBuffers=0
>> DEBUG - maxLogFiles=2
>> DEBUG - minBuffers=4
>> DEBUG - threadsWaitingForceThreshold=-1
>> DEBUG - createService.success
>> INFO - Creating SecurityService(id=Default Security Service)
>> DEBUG - createService.success
>> INFO - Assembling app: classpath.ear
>> INFO - Creating Resource(id=classesRA)
>> DEBUG - createService.success
>> INFO - Creating Resource(id=classes)
>> DEBUG - TransactionSupport=none
>> DEBUG - ResourceAdapter=classesRA
>> INFO - Creating ConnectionManager for Resource(id=classes)
>> DEBUG - createService.success
>> INFO - Deployed Application(path=classpath.ear)
>>
>>
>> thabach wrote:
>>>
>>> Heya
>>>
>>> I am implementing an outbound-resourceadapter. The RAR seems to  
>>> deploy
>>> fine, but the ManagedConnectionFactory's createConnectionFactory  
>>> method
>>> is never triggered by the container.
>>>
>>> As I learned every application server has some complement to the  
>>> ra.xml.
>>> In JBoss for example there are the *-ds.xml files as mentioned in an
>>> http://old.nabble.com/Re%3A-Unit-testing-code-containing-DirContext-resource-injection-p24836874.html
>>> earlier post . In such *-ds.xml files, for example the JNDI name  
>>> of the
>>> instantiated ConnectionFactory object is given.
>>>
>>> Instantiation of the ConnectionFactory object (the call to the
>>> ManagedConnectionFactory's createConnectionFactory method) and  
>>> binding to
>>> JNDI registry is triggered by JBoss at *-ds.xml file processing.
>>>
>>> I want to accomplish the same with OpenEJB. I found an ra.xml
>>> complementing  http://cwiki.apache.org/GMOxDOC22/geronimo- 
>>> raxml.html file
>>> for Geronimo, but see no JNDI name declaration in there and don't  
>>> know
>>> how to apply it for OpenEJB.
>>>
>>> How does one configure matter for OpenEJB ? How to trigger the  
>>> creation
>>> of a ManagedConnectionFactory, the instantiation of the  
>>> ConnectionFactory
>>> object and the binding of the latter to JNDI ?
>>>
>>> Any help very much appreciated, cheers, Christian.
>>>
>>>
>>>
>>>
>>
>>
>
> -- 
> View this message in context: http://old.nabble.com/RAR-deployment%2C-ConnectionFactory-Instantiation-and-JNDI.-tp26157843p26160177.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


Re: RAR deployment, ConnectionFactory Instantiation and JNDI.

Posted by thabach <ba...@evolootion.ch>.
I succeeded in looking up the ManagedConnectionFactory under
"java:openejb/Resource/classes". Apologies for bothering you while having
lengthy posts in talking to myself over the mailing list :thinking: !

Cheers, Christian.



thabach wrote:
> 
> Heya 
> 
> I think I got a bit further, but still am confused.
> 
> OpenEJB in its Assembler::createResource() method does create both an
> instance of my  ResourceAdapter and an instance of my
> ManagedConnectionFactory. Both instances are bound to JNDI through (also
> from Assembler::createResource()):
> 
> containerSystem.getJNDIContext().bind("openejb/Resource/" +
> serviceInfo.id, service);
> 
> Strange enough the serviceInfo.id is 'classesRA' for the ResourceAdapter
> and 'classes' for the ManagedConnectionFactory, respectively (see log,
> below). Is this normal or am I missing something in my implementation ? 
> 
> Further, when I try to lookup either "openejb/Resource/classesRA" or
> "openejb/Resource/classes", I get an NameNotFoundException. How can I get
> a reference to the ManagedConnectionFactory object through the
> initialContext ?
> 	
> Any help is very much appreciated, Christian.
> 
> (== log on staring up my outbound ResourceAdapter with OpenEJB ==)
> 
> Apache OpenEJB 3.1.2    build: 20091010-03:11
> http://openejb.apache.org/
> INFO - openejb.home = C:\Develop\_jee_local\_jee_ws\loopback-adapter
> INFO - openejb.base = C:\Develop\_jee_local\_jee_ws\loopback-adapter
> INFO - Configuring Service(id=Default Security Service,
> type=SecurityService, provider-id=Default Security Service)
> INFO - Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> INFO - Using
> 'openejb.deployments.classpath.include=.*target/classes.*|.*target/test-classes.*'
> INFO - Found ConnectorModule in classpath:
> C:\Develop\_jee_local\_jee_ws\loopback-adapter\target\classes
> INFO - Beginning load:
> C:\Develop\_jee_local\_jee_ws\loopback-adapter\target\classes
> INFO - Configuring enterprise application: classpath.ear
> INFO - Configuring Service(id=classesRA, type=Resource,
> provider-id=classesRA)
> INFO - Configuring Service(id=classes, type=Resource, provider-id=classes)
> INFO - Enterprise application "classpath.ear" loaded.
> INFO - Creating TransactionManager(id=Default Transaction Manager)
> DEBUG - defaultTransactionTimeoutSeconds=600
> DEBUG - TxRecovery=false
> DEBUG - bufferSizeKb=32
> DEBUG - checksumEnabled=true
> DEBUG - adler32Checksum=true
> DEBUG - flushSleepTimeMilliseconds=50
> DEBUG - logFileDir=txlog
> DEBUG - logFileExt=log
> DEBUG - logFileName=howl
> DEBUG - maxBlocksPerFile=-1
> DEBUG - maxBuffers=0
> DEBUG - maxLogFiles=2
> DEBUG - minBuffers=4
> DEBUG - threadsWaitingForceThreshold=-1
> DEBUG - createService.success
> INFO - Creating SecurityService(id=Default Security Service)
> DEBUG - createService.success
> INFO - Assembling app: classpath.ear
> INFO - Creating Resource(id=classesRA)
> DEBUG - createService.success
> INFO - Creating Resource(id=classes)
> DEBUG - TransactionSupport=none
> DEBUG - ResourceAdapter=classesRA
> INFO - Creating ConnectionManager for Resource(id=classes)
> DEBUG - createService.success
> INFO - Deployed Application(path=classpath.ear)
> 
> 
> thabach wrote:
>> 
>> Heya 
>> 
>> I am implementing an outbound-resourceadapter. The RAR seems to deploy
>> fine, but the ManagedConnectionFactory's createConnectionFactory method
>> is never triggered by the container. 
>> 
>> As I learned every application server has some complement to the ra.xml.
>> In JBoss for example there are the *-ds.xml files as mentioned in an 
>> http://old.nabble.com/Re%3A-Unit-testing-code-containing-DirContext-resource-injection-p24836874.html
>> earlier post . In such *-ds.xml files, for example the JNDI name of the
>> instantiated ConnectionFactory object is given. 
>> 
>> Instantiation of the ConnectionFactory object (the call to the
>> ManagedConnectionFactory's createConnectionFactory method) and binding to
>> JNDI registry is triggered by JBoss at *-ds.xml file processing.
>> 
>> I want to accomplish the same with OpenEJB. I found an ra.xml
>> complementing  http://cwiki.apache.org/GMOxDOC22/geronimo-raxml.html file 
>> for Geronimo, but see no JNDI name declaration in there and don't know
>> how to apply it for OpenEJB.
>> 
>> How does one configure matter for OpenEJB ? How to trigger the creation
>> of a ManagedConnectionFactory, the instantiation of the ConnectionFactory
>> object and the binding of the latter to JNDI ?
>> 
>> Any help very much appreciated, cheers, Christian. 
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/RAR-deployment%2C-ConnectionFactory-Instantiation-and-JNDI.-tp26157843p26160177.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: RAR deployment, ConnectionFactory Instantiation and JNDI.

Posted by thabach <ba...@evolootion.ch>.
Heya 

I think I got a bit further, but still am confused.

OpenEJB in its Assembler::createResource() method does create both an
instance of my  ResourceAdapter and an instance of my
ManagedConnectionFactory. Both instances are bound to JNDI through (also
from Assembler::createResource()):

containerSystem.getJNDIContext().bind("openejb/Resource/" + serviceInfo.id,
service);

Strange enough the serviceInfo.id is 'classesRA' for the ResourceAdapter and
'classes' for the ManagedConnectionFactory, respectively (see log, below).
Is this normal or am I missing something in my implementation ? 

Further, when I try to lookup either "openejb/Resource/classesRA" or
"openejb/Resource/classes", I get an NameNotFoundException. How can I get a
reference to the ManagedConnectionFactory object through the initialContext
?
	
Any help is very much appreciated, Christian.

(== log on staring up my outbound ResourceAdapter with OpenEJB ==)

Apache OpenEJB 3.1.2    build: 20091010-03:11
http://openejb.apache.org/
INFO - openejb.home = C:\Develop\_jee_local\_jee_ws\loopback-adapter
INFO - openejb.base = C:\Develop\_jee_local\_jee_ws\loopback-adapter
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Using
'openejb.deployments.classpath.include=.*target/classes.*|.*target/test-classes.*'
INFO - Found ConnectorModule in classpath:
C:\Develop\_jee_local\_jee_ws\loopback-adapter\target\classes
INFO - Beginning load:
C:\Develop\_jee_local\_jee_ws\loopback-adapter\target\classes
INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=classesRA, type=Resource,
provider-id=classesRA)
INFO - Configuring Service(id=classes, type=Resource, provider-id=classes)
INFO - Enterprise application "classpath.ear" loaded.
INFO - Creating TransactionManager(id=Default Transaction Manager)
DEBUG - defaultTransactionTimeoutSeconds=600
DEBUG - TxRecovery=false
DEBUG - bufferSizeKb=32
DEBUG - checksumEnabled=true
DEBUG - adler32Checksum=true
DEBUG - flushSleepTimeMilliseconds=50
DEBUG - logFileDir=txlog
DEBUG - logFileExt=log
DEBUG - logFileName=howl
DEBUG - maxBlocksPerFile=-1
DEBUG - maxBuffers=0
DEBUG - maxLogFiles=2
DEBUG - minBuffers=4
DEBUG - threadsWaitingForceThreshold=-1
DEBUG - createService.success
INFO - Creating SecurityService(id=Default Security Service)
DEBUG - createService.success
INFO - Assembling app: classpath.ear
INFO - Creating Resource(id=classesRA)
DEBUG - createService.success
INFO - Creating Resource(id=classes)
DEBUG - TransactionSupport=none
DEBUG - ResourceAdapter=classesRA
INFO - Creating ConnectionManager for Resource(id=classes)
DEBUG - createService.success
INFO - Deployed Application(path=classpath.ear)


thabach wrote:
> 
> Heya 
> 
> I am implementing an outbound-resourceadapter. The RAR seems to deploy
> fine, but the ManagedConnectionFactory's createConnectionFactory method is
> never triggered by the container. 
> 
> As I learned every application server has some complement to the ra.xml.
> In JBoss for example there are the *-ds.xml files as mentioned in an 
> http://old.nabble.com/Re%3A-Unit-testing-code-containing-DirContext-resource-injection-p24836874.html
> earlier post . In such *-ds.xml files, for example the JNDI name of the
> instantiated ConnectionFactory object is given. 
> 
> Instantiation of the ConnectionFactory object (the call to the
> ManagedConnectionFactory's createConnectionFactory method) and binding to
> JNDI registry is triggered by JBoss at *-ds.xml file processing.
> 
> I want to accomplish the same with OpenEJB. I found an ra.xml
> complementing  http://cwiki.apache.org/GMOxDOC22/geronimo-raxml.html file 
> for Geronimo, but see no JNDI name declaration in there and don't know how
> to apply it for OpenEJB.
> 
> How does one configure matter for OpenEJB ? How to trigger the creation of
> a ManagedConnectionFactory, the instantiation of the ConnectionFactory
> object and the binding of the latter to JNDI ?
> 
> Any help very much appreciated, cheers, Christian. 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/RAR-deployment%2C-ConnectionFactory-Instantiation-and-JNDI.-tp26157843p26160043.html
Sent from the OpenEJB User mailing list archive at Nabble.com.