You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Kalyan <ka...@gmail.com> on 2019/06/20 20:24:27 UTC

Jndi lookup for bean and datasource.

Hello,
I have two issues with the jndi lookup. 
I am using kind of a netty server which is our home grown server. 
I used openejb to deploy the ejbs.  I don't have any EAR or WAR file. Its
jar file with contains the ejb-jar.xml etc.. 
The deployment was successful.  The container came up fine. 


*1 ) Bean lookup issue*
If you look at the jndi below

Jndi(name=*global/classpath.ear*/SERVICE_EJBs/SyncServiceBean!SyncServiceBeanLocalHome)
--> Ejb(deployment-id=SyncServiceBean)

what's the classpath.ear here?? from where its is coming ? i don't have any
classpath.ear file in my deployment. 

I want to lookup the bean using something like sd/SyncServiceBeanSB .

How can i do the mapping ? 


2) Datasource lookup issue 

    I created a datasource as 

     p.put("DS_DB", "new://Resource?type=javax.sql.DataSource");
        p.put("DS_DB.JdbcDriver", "oracle.jdbc.OracleDriver");
        p.put("DS_DB.JdbcUrl", "jdbc:oracle:thin:@xxxxxxx:1521/readdb");
        p.put("DS_DB.UserName", "q1_user");
        p.put("DS_DB.Password", "XXXXX");
        p.put("DS_DB.LogSql", "true");
        p.put("DS_DB.JtaManaged", "true");

     InitialContext initialContext = new InitialContext(p);

  In the code if i try to lookup with DS_DB it doesn't work 

    context.lookup("java:/DS_DB")   throws exception 


But same if i lookup as 
   context("java:openejb:Resource/DS_DB")  it works. 

I also tried with the link

    context.bind("java:/DS_DB",new
                    javax.naming.LinkRef("java:openejb:Resource/DS_DB"));

Even then it doesn't work. 

Please help me solve the above two issues.. 

thanks
Kalyan



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html