tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Two datasources - one database
Date Tue, 05 Dec 2006 18:41:56 GMT

On Dec 5, 2006, at 12:22 AM, Per Newgro wrote:

> Hi *,
>
> i try to port my application from jboss to openejb to use it as a  
> standalone
> version. David Blevins already helped alot on my other issue:
>   HOWTO OpenEJB and HSqlDB
>
> He noticed me to add the following lines to my ejb-jar.xml file
>>       <session>
>>          ...
>>             <resource-ref>
>>                 <res-ref-name>APPLDB</res-ref-name>
>>                 <res-type>javax.sql.DataSource</res-type>
>>                 <res-auth>Container</res-auth>
>>             </resource-ref>
>>             <resource-ref>
>>                 <res-ref-name>APPLDBnoTx</res-ref-name>
>>                 <res-type>javax.sql.DataSource</res-type>
>>                 <res-auth>Container</res-auth>
>>             </resource-ref>
>>       </session>
>
> One of his comments was:
>>  On a slightly different note, I'm curious why you'd have two
>>  connectors with the exact same configuration
>
> And now i have my problem with exactly this issue. Access to the  
> APPLDB is
> working by lookup("java:comp/env/APPLDB"). But if i try to access  
> the no
> transaction datasource by lookup("java:comp/env/APPLDBnoTx") i get a
> javax.naming.NameNotFoundException: Name "java:comp/env/APPLDBnoTx"  
> not found.
>
> Is there an issue in ejb spec that i cant access same database by  
> usage of
> different datasources?

This should work fine.  I saw your config file, your openejb-jar.xml  
file and they were spot on.

Essentially they were:

openejb.conf:
  <openejb>
     ...
     <Connector id="APPLDB">...</Connector>
     <Connector id="APPLDBnoTx">...</Connector>
     ...
  </openejb>

openejb-jar.xml:
  ...
   <ejb-deployment ... >
     <resource-link res-ref-name="APPLDB" res-id="APPLDB"/>
     <resource-link res-ref-name="APPLDBnoTx" res-id="APPLDBnoTx"/>
   </ejb-deployment>
  ...

And of course the ejb-jar.xml you post above with the two resource- 
ref elements whose names are "<res-ref-name>APPLDB" and "<res-ref- 
name>APPLDBnoTx".

This should be working.  What you have is exactly right (unless I'm  
missing something too obvious)

First thing you'll want to check is to make sure you are doing the  
lookup the ExportDatabaseUC bean and not some other bean.

Also definitely check or post your log file for anything suspicious.

-David


Mime
View raw message