This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Basic EJB access question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Basic EJB access question" Watch "Basic EJB access question" New topic

Basic EJB access question

gar tek

Joined: Mar 07, 2007
Posts: 10
Hi ,

I am learning the basic EJB and trying to write my first piece of code.
I wrote a HelloWorld.jar(EJB) and deployed it in Websphere server.

Then I wrote a standalone java program with main method to access the EJB client. As per the tutorial..
public void callEJB()
java.util.Properties env = new java.util.Properties();
javax.naming.Context initial = new javax.naming.InitialContext(env);
//Object objref =(javax.naming.Context)initial.lookup("java:comp/env/HelloWorld");
Object objref =initial.lookup("ejb/ejb/demo/HelloWorldHome");
HelloWorldComponent helloRef = (HelloWorldRemote)PortableRemoteObject.narrow(objref, HelloWorldComponent.class);

}catch(Exception e){e.printStackTrace();}

How will my code compile??? Because HelloWorldComponent is on the application server, but my client is on a different server. It cannot find the HelloWorldComponent class right??
What should I do now?

gar tek

Joined: Mar 07, 2007
Posts: 10
Please help me
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
I recommend you get a copy of HF EJB and start on again.

There are too much details that are involved here so that I could give you a short answer.


I agree. Here's the link:
subject: Basic EJB access question
Similar Threads
Duke's Bank app
EJB and Sun One Application server
com/ibm/CORBA/iiop/ORB - Help
Getting Class cast exception while Lookup EJB2.1 session bean using JNDI name in WAS6.1
Advice Client problem