dcsimg
EJB & Websphere - Client cant call EJB...help!
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Michael_Bezas
Posted On:   Wednesday, April 10, 2002 06:55 AM

Hi guys, any help on this issue would be appreaciated....I have looked through the Java Developer Connection forum and many people seem to have this problem. I have developed an EJB with VisualAge 4.0. I can successful talk to the EJB within the VisualAge Websphere Test Environment using a simple client class. When I deploy the EJB within WebSphere 4.0 I cannot seem to talk to it from my VisualAge development enviroment using the same client class as before. My code falls over at the JNDI lookup stage, giving me a "Could not get InitialContext" error. My code is as follows: // Populate URL String url = "IIOP://" + "192.168.1   More>>

Hi guys, any help on this issue would be appreaciated....I have looked through the Java Developer Connection forum and many people seem to have this problem.



I have developed an EJB with VisualAge 4.0. I can successful talk to the EJB within the VisualAge Websphere Test Environment using a simple client class.



When I deploy the EJB within WebSphere 4.0 I cannot seem to talk to it from my VisualAge development enviroment using the same client class as before.



My code falls over at the JNDI lookup stage, giving me a "Could not get InitialContext" error.



My code is as follows:


// Populate URL
String url = "IIOP://" + "192.168.1.2" + ":" + "900" + "/";

p.put(javax.naming.Context.PROVIDER_URL, url);

p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");



initialContext = new InitialContext(p);

String jndiName = BuildSystemProfile.class.getName().replace('.', '/');

Object o = initialContext.lookup(jndiName);

BuildSystemProfileHome home = (BuildSystemProfileHome) PortableRemoteObject.narrow(o, BuildSystemProfileHome.class);

BuildSystemProfile bsf = home.create();

String msg = bsf.testMsg("You say hello");




The error I get is as follows:


Could not get InitialContext!

javax.naming.NameNotFoundException:
tdw/ejb/BuildSystemProfile

java.lang.Throwable(java.lang.String)

java.lang.Exception(java.lang.String)

javax.naming.NamingException(java.lang.String)

javax.naming.NameNotFoundException(java.lang.String)

java.lang.Object com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(org.omg.CosNaming.NameComponent [])

java.lang.Object com.ibm.ejs.ns.jndi.CNContextImpl.lookup(java.lang.String)

java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)

void tdw.ejb.TestBuildSystemProfile.main(java.lang.String [])




Issues:


- I have had a good look on the web and at the Sun Developer Connection there seems to be quite a few people with similar problems with all App.Servers in the market. I can't seem to find a clear answer, but what is becoming obvious from those forums is that for a client to communicate with an EJB in a App.Server, the client needs to have the App.Servers deployment .jars in it's classpath. Apparently with WebSphere you also need to have the IBM JVM installed.



*** Well, I have done both of these things yet I still get an error.



*** Can anyone please shed some light as to what steps I need to do exactly. Please explicitly list what needs to be done. Your help would be greatly appreaciated.



Regards
Michael

   <<Less

Re: EJB & Websphere - Client cant call EJB...help!

Posted By:   Jennifer_Sleeman  
Posted On:   Friday, April 26, 2002 02:42 AM

I ran into the same problem on WAS until I created the client application and did the proper binding using the assembly tool. Then I used the launchClient tool to test my client and it worked.

Re: EJB & Websphere - Client cant call EJB...help!

Posted By:   Anonymous  
Posted On:   Tuesday, April 16, 2002 06:50 AM

I also have this kind of problem : my EJB works well with Inprise Application Server (and very very well). But i have to make it work on Websphere. But Websphere 4.0 doesn't want to load it...


Everything is fine during deployment with the deploy tool, i can set every parameter without any problem, i can generate all the stubs with no error. But when i install the EJB in WAS 4.0, i receive a NoClassDefFoundError exception, WAS says he can't find a particular stub : he searches javax/ejb/_EJBHome_Stub, while i have in my .ear a org/omg/stub/javax/ejb/_EJBHome_Stub. I've been looking at other EJBs, the examples from ibm given with WAS 4.0 increment and beenThere), which have the org/omg/stub/javax/ejb/_EJBHome_Stub, but who work perfectly in WAS and who don't have this exception. I have tried a lot of things, but nothing worked...
I don't understand why Websphere wants this truncated package, while it seems that the norm is the whole package name...


If somebody has an answer...



The error is :



WSVR0040E : Echec de addEjbModule pour com.ibm.ejs.models.base.config.applicationserver.impl.EJBModuleRefImpl (desiredExecutionState: START) (uri: Deployed_DKLinkDemoEJB.jar)
java.lang.NoClassDefFoundError: javax/ejb/_EJBHome_Stub
etc...



Thank you.

Re: EJB & Websphere - Client cant call EJB...help!

Posted By:   Benoit_Quintin  
Posted On:   Wednesday, April 10, 2002 07:54 AM

Have you tried the new WebSphere 4.0 InitialContextFactory ? (Don't remember the actual name, sorry) I'm not sure that is the problem you're running into, it probably wouldn't hurt using the new IC.

Also, make sure you are publishing your EJB under the correct JNDI name (in your WebSphere console).

About | Sitemap | Contact