Hi

Your lookup should be:
DataSource datasource = (DataSource)
initContext.lookup("java:comp/env/services");

Can you give that a try?

Cheers

Jon

On Tue, Feb 19, 2019 at 3:15 PM zsaade <[email protected]> wrote:

> Dear jgallimore
>
> Find below <tomee-home>\apps\earFile\jarFile\META-INF\openejb-jar.xml:
> <?xml version="1.0"?>
> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1";>
>
>         <ejb-deployment  ejb-name="TestEJB" deployment-id="TestEJB"
> container-id="Default Stateless Container" >
>                 <resource-link res-ref-name="services"  res-id="Default
> JDBC Database"/>
>         </ejb-deployment>
> </openejb-jar>
>
> I changes the the openejb-jar.xml format based on the below links
> specifications:
>
> http://tomee.apache.org/details-on-openejb-jar.html
>
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/resources/schema/openejb-jar.xsd
>
> and <tomee-home>\apps\earFile\jarFile\META-INF\ejb-jar.xml:
> <enterprise-beans>
>         <session id="Test">
>                 <description>Describe here the session bean
> Administration</description>
>                 <display-name>test/testEJB</display-name>
>                 <ejb-name>TestEJB</ejb-name>
>                 <home>test.TestHome</home>
>                 <remote>test.Test</remote>
>                 <ejb-class>test.TestEJB</ejb-class>
>                 <session-type>Stateless</session-type>
>                 <transaction-type>Container</transaction-type>
>                 <env-entry>
>                         <env-entry-name>name1</env-entry-name>
>                         <env-entry-type>java.lang.String</env-entry-type>
>                         <env-entry-value>value1</env-entry-value>
>                 </env-entry>
>                 <resource-ref>
>                         <res-ref-name>services</res-ref-name>
>                         <res-type>javax.sql.DataSource</res-type>
>                         <res-auth>Application</res-auth>
>                 </resource-ref>
>         </session>
> </enterprise-beans>
>
> And <tomee-home>\conf\tomee.xml :
> <?xml version="1.0" encoding="UTF-8"?>
> <tomee>
>
>
>
>         <Deployments dir="apps" />
>
>         <Resource id="services" type="javax.sql.DataSource">
>                    ....................
>         </Resource>
>
> </tomee>
>
> and in my TestEJB i'm doing the below Connection Call:
>
> DataSource datasource = (DataSource) initContext.lookup("services");
>
> And i'm still getting the below exception:
>
> javax.naming.NameNotFoundException: NAme [services] is nt bound in this
> Context. Unable to find [services].
>
> Best Regards
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
>

Reply via email to