I have at least a partial answer to my own question. May seem obvious to JEE
afficianados. The JNDI context is basically not available in the contructor
of the bean. I am able to access it during invocations of the methods of the
beans. I guess its probably not very bright to look it up in the constructor
and keep it anyway
Wayne Rasmuss wrote:
>
> I am unable to lookup a data source from a RAR that is deployed in the
> same ear as jar file containing BMP entity beans. Here are some details.
>
> 1.) I am able to use the data source in war files contained in the same
> ear.
>
> 2.) The following line throws an NameNotFound("comp/env") new
> InitialContext().lookup("java:comp/env")
>
> 3.) I am able to use the data source for my login module
>
> 4.) My ear deploys without errors
>
> 5.) My ejb-jar entity bean tags look like this
>
> <entity>
> <ejb-name>realm</ejb-name>
>
> <local-home>com.popstarnetworks.realm.beans.realm.RealmLocalHome</local-home>
>
> <local>com.popstarnetworks.realm.beans.realm.RealmLocal</local>
>
> <ejb-class>com.popstarnetworks.realm.beans.realm.RealmBean</ejb-class>
> <persistence-type>Bean</persistence-type>
> <prim-key-class>java.util.UUID</prim-key-class>
> <reentrant>true</reentrant>
> <resource-ref>
> <res-ref-name>realm_database</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
> </entity>
>
> 6.) My openejb entity bean tags look like this
> <entity>
> <ejb-name>node</ejb-name>
> <jndi-name>node</jndi-name>
> <naming:resource-ref>
> <naming:ref-name>realm_database</naming:ref-name>
>
> <naming:resource-link>realm_database</naming:resource-link>
> </naming:resource-ref>
> </entity>
>
> 7.) I have tried different names in the <naming:ref-name> tags. When I do
> this, my application will deploy with either the name in
> <naming:ref-name>, <naming:resource-link> listed in the ejb-jar file
>
> 8.) If I remove the <naming:resource-ref> tags, my application will still
> deploy as long as I use the name declared in my RAR
>
> Thanks for You Help
> Wayne
>
--
View this message in context:
http://www.nabble.com/Can%27t-lookup-data-source-from-BMP-entity-bean-tf4616638s134.html#a13214184
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.