• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Basic EJB access question

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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()
{
try
{
java.util.Properties env = new java.util.Properties();
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(javax.naming.Context.PROVIDER_URL,"iiop://localhost:2809/");
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");
System.out.println(objref.getClass());
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?

Thanks.
 
gar tek
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help me
 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Regards,
Darya
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic