• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3 and Websphere Application Server 8

 
Martin Reuter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
i want to use EJB 3 in my WAS8 application but it doesn't work.

First of all i created an remote-interface:


Then i created a session bean class:


So far so good. But now i want to call the session bean from a normal (no servlet, no ejb) java class but i doesn't work (NamingNotFoundException):


What is missing here or what is wrong? I tried a lot of things but nothing worked.

Thanks for your help!
 
saqib rashids
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been sometime since I have worked in EJB 3, but as long as I remember EJBs are (by default) bound in JNDI at the following location:
java:global/<applicationName>/<moduleName>/<bean component name>!<fully qualified interface name>

For example: java:global/myApp/myModule/MyBeanComponent!com.foo.MyBeanComponentLocalInterface

You can try looking up your EJB based on the above Jndi Url scheme.
 
Claude Moore
Ranch Hand
Posts: 783
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moreover, just remember that if you need to access EJBs from a plain Java client which runs outside the EJB container (for example, a swing application), you need to have EJB container's client jars on Java client classpath,
otherwise it won't work.

You may try and read following url which explains
required steps.

Just another - even if unrequired - advice from me. Even it seems a cool thing - and it have seemed so to me for a long time, believe me - nowadays I would not expose EJB functionalities
via EJB client. Simply, it's too complex, since you need to provide ejb client jars with your application and these client jars may need to be updated when you install fixes on your
appserver; you'll have to deal with firewalls and so on.

It's by far better use REST or SOAP webservices. With EJB 3, you can expose your services as webservices just with a couple of annotations (@Webservice and @Webmethod)

Hope this may help you, man.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic