• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

unable to do jndi lookup for my ejb in websphere

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi am trying following in the code in java class .this is jar deployed in classes folder of C:\Program Files\IBM\WebSphere\AppServer\classes

String jndiName = "ejb/com/clearorbit/connect/service/WeblogicLoginModuleService";
InitialContext initialContext = new InitialContext();
Context context = (Context) initialContext.lookup("java:comp/env");
Object homeObject = context.lookup(jndiName);

But i get name not found exception at Object homeObject = context.lookup(jndiName);


I am calling a ejb deployed within my application ear.
web.xml

<ejb-local-ref id="EJBLocalRef_1233977974926">
<ejb-ref-name>ejb/com/clearorbit/connect/service/WeblogicLoginModuleService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.clearorbit.connect.service.home.WeblogicLoginModuleServiceHome</local-home>
<local>com.clearorbit.connect.service.WeblogicLoginModuleService</local>
<ejb-link>WeblogicLoginModuleService</ejb-link>
</ejb-local-ref>
ejb.jar.xml
<session id="Session_1233977973771">
<description><![CDATA[WeblogicLoginModuleService.]]></description>
<display-name>WeblogicLoginModuleService</display-name>

<ejb-name>WeblogicLoginModuleService</ejb-name>

<local-home>com.clearorbit.connect.service.home.WeblogicLoginModuleServiceHome</local-home>
<local>com.clearorbit.connect.service.WeblogicLoginModuleService</local>
<ejb-class>com.clearorbit.connect.service.DefaultWeblogicLoginModuleService</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref id="ResourceRef_1233977973771">
<res-ref-name>jdbc/clr</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>

ibm-ejb-jar-bnd.xmi

<ejbBindings xmi:id="EnterpriseBeanBinding_1233977973771" jndiName="ejb/WeblogicLoginModuleService">
<enterpriseBean xmi:type="com.ibm.etools.ejb:Session" href="META-INF/ejb-jar.xml#Session_1233977973771"/>
<resRefBindings xmi:id="ResourceRefBinding_1233977973772" jndiName="jdbc/clr">
<bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1233977973771"/>
</resRefBindings>
</ejbBindings>
 
Aarti Roshan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone have any idea on this....my ejbs are deployed within ear on server1 and am trying to call the deployed ejb from Custom User registry class But get name not found exception
 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Few questions:
What are your InitialContext settings?
Are you running on the same machine or different machine?
Does your classpath contain jndi client jar library of Websphere?
 
Aarti Roshan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer your questions
1) i have tried with both default initial context as well as below settings
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2809");
InitialContext initialContext = new InitialContext(env);

2) am running single machine..ejb is deployed in ear within websphere and am trying to access ejb from custom user registry class

3) Do i need this jndi client jar library of Websphere ..Is this file present within websphere...I have not changed the classpath default settings? i am unaware of this jar.
 
Duc Vo
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, didn't read your previous post carefully... Try to lookup on this name "ejb/WeblogicLoginModuleService"
 
Aarti Roshan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have tried that..but that also does not work..
 
Aarti Roshan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there anyway i can debug this? i have tried all possible things i could with the ibm-ejb-jar-bnd.xmi..am using websphere 6.
 
Aarti Roshan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just wanted to let know that i got it working the lookup was to be done like this

Object homeObject = initialContext.lookup("local:ejb/WeblogicLoginModuleService");
 
Doe, a deer, a female deer. Ray, a pockeful of sun. Me, a name, I call my tiny ad ...
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic