| Author |
unable to do jndi lookup for my ejb in websphere
|
Aarti Roshan
Greenhorn
Joined: May 09, 2008
Posts: 13
|
|
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
Joined: May 09, 2008
Posts: 13
|
|
|
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
|
 |
Duc Vo
Ranch Hand
Joined: Nov 20, 2008
Posts: 254
|
|
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?
|
“Everything should be as simple as it is, but not simpler.” Albert Einstein
|
 |
Aarti Roshan
Greenhorn
Joined: May 09, 2008
Posts: 13
|
|
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
Joined: Nov 20, 2008
Posts: 254
|
|
|
Ah, didn't read your previous post carefully... Try to lookup on this name "ejb/WeblogicLoginModuleService"
|
 |
Aarti Roshan
Greenhorn
Joined: May 09, 2008
Posts: 13
|
|
|
i have tried that..but that also does not work..
|
 |
Aarti Roshan
Greenhorn
Joined: May 09, 2008
Posts: 13
|
|
|
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
Joined: May 09, 2008
Posts: 13
|
|
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");
|
 |
 |
|
|
subject: unable to do jndi lookup for my ejb in websphere
|
|
|