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

WebSphere EJB Woes

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HELP!

I'm an experienced J2EE developer who is having difficulty understanding why my application won't behave appropriately when deployed to websphere 5. I'm a websphere newbie so please go easy on me ..

My application runs without issue when deployed to JBoss 3.2.3. The application contains three stateless session beans and a single mdb. Two of my session beans reference the third which adds messages to a queue and is also called by my mdb in order to process the message asynchronously. All communication between beans is done using local interfaces to avoid network overhead.

How does websphere know what jndi name to assign to a given session bean? I do not see any location where this information is defined. In JBoss, you must include the jndi-name and local-jndi-name in the META-INF\jboss.xml file of the ejb.jar. The server reads this file at deployment time and creates the appropriate jndi entries.

When I deployed my enterprise application to websphere I was prompted to enter a jndi name for each of my non-mdb enterprise beans. I entered the remote jndi names here .. not the local jndi names. Is this correct?

Lets say I entered 'EchoService' as the remote jndi name for a bean that I would like to lookup. What is the jndi name that I should lookup in order to communicate with my local ejb objects?

Thanks,

Patrick
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Patrick,
You are correct that you should enter the remote name. WebSphere automatically assigns the local name. If your remote name is "ejb/com/javaranch/MyBean", the local name would be "local:ejb/ejb/com/javaranch/MyBean"
 
Patrick Farrell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

Thanks for your reply.. however I still cannot find my local objects. In this case, my three JNDI names are defined as follows in the websphere console:

DocumentSearchService
DocumentRetrievalService
OnDemandService

I did not preface these jndi names with 'ejb/'. Shouldn't matter .. but could that be the issue?

I can lookup each of the jndi names listed above without issue. However, I have never been able to find a local object. I have taken your advice and configured my application to lookup the following jndi names:

OnDemandService --> works but is a remote object .. and results in
local nDemandService --> javax.naming.NameNotFoundException: Name "OnDemandService" not found in context "local:".
java:comp/env/local nDemandService --> javax.naming.NameNotFoundException: Name "comp/env/local nDemandService" not found in context "java:".

I've heard some people saying that you need to use the java:comp/env as a prefix to jndi names. When should I be prefixing my jndi name with this string?

I was looking in the WebSphere\AppServer\installedApps folder and I see that websphere generated some files in my ejb-jar during the deployment of my enterprise application:

EJSLocalStatelessOnDemandService_7f06a9a7.class
EJSLocalStatelessOnDemandServiceHome_7f06a9a7.class

It appears that the files were generated but were never bound in the jndi tree. Is there an easy way to tell which entries are bound in the jndi tree via the server administrative console?

Do you have any other suggestions? Could my ibm-ejb-jar-bnd.xmi file be to blame? I'm using xdoclet to generate each of my deployment descriptors.

Thanks,

Patrick
 
Patrick Farrell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

Forgive me .. I was trying to do about 100 things at once when I tried to follow your advice. In the haze, I must have missed the fact that you told me to prefix the jndi name with 'local:ejb/'. When I adjusted my jndi name to be 'local:ejb/OnDemandService' everything worked!

Thanks,

Patrick
 
Men call me Jim. Women look past me to this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic