• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Problem with Session Facade

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
somehow I have the problem of not beeing able to look up my Entity Bean's local home interface in my Session Facade Bean (=Session Bean).
I try to lookup the JNDI name of the local home interface as I have read in an article using the local scheme: local:ejb/.
First of all I have the following question:
When I use "stage.person.PersonBean" as my JNDI Name, in which schema is it located ? Usually lookup with .lookup("stage.person.PersonBean") works fine, but when I use the local home interface it can't be found.
So do i have to set the JNDI name to: "local:ejb/stage/person/PersonBean" in order to make it work ?
And why Websphere doesn't find the local Schema. Sorry that I can't provide the stacktrace, but I can tell you that the Server can't find the local Schema.
I appreciate any hints, in order to get my Session Facade pattern running.
-- Max
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where did you find instructions telling you to use the "local:" scheme? It's not standard, and is not supported by WebSphere. Instead, after declaring an EJBReference to your local Entity home in your Session, you need to use "java:comp/env" as the namespace root to locate your entity.
Kyle
 
Maximilian Trenks
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kyle, thank you for the reply.
I found it in a review on theserverside.com, someone replied on the review:
here the link: http://www.theserverside.com/reviews/thread.jsp?thread_id=17947
Message #79783
" 2.1 It does not work. The SAME application is working UNMODIFIED on JBoss and weblogic, but not on websphere. For example have you tried to run local ejb calls in websphere ? If you want do it, you have to discover that there is a local namespace and use IN YOUR CODE. Since this, i have in my code (write once run anywhere BUT on websphere):
(WEBSPHERE SPECIFIC)
static final String WASLOCALJNDISTRING = "local:ejb/";
public static String getSequenceLocalHome() {
if (SystemProperties.isWebsphere())
return WASLOCALJNDISTRING + SEQUENCE_HOME;
return SEQUENCE_LOCAL_HOME;
}
...."
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The guy who posted that is full of ****. He doesn't know what he's talking about. The java:comp/env namespace is all you need to use.
Kyle
 
Maximilian Trenks
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kyle,
is there any paper or article you can recommend that describes the jndi names I have to use when building a session fascade with Websphere 5.0 ?
This would help me a lot.
Many thanx,
Max
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the best reference would be my book, but unfortunately we're about a month out from having that released. In the meantime, though, you really don't need anything special for WebSphere -- this isn't a WebSphere specific issue.
The third edition of Richard Monson-Haefel's EJB book describes the use of ejb-references in detail, and that would be a good reference to use. Do you understand what I mean by using the "java:comp/env" namespace? Are you simply getting confused as to on what EJB you declare the local references? If so, you might want to look at the short little writeup on my blog (available from my webpage below).
Or would it be more instructive if I try to write you a short tutorial?
Kyle
 
Maximilian Trenks
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately I don't have my box available at the moment.
So I can't tell you the exception I get when trying to look up my Entity Bean. But I may have a problem with understanding the need to use the java:comp/env namespace. In most articles I have read, the people use the following JNDI bindings "com/mycompany/somepackage/someclassname".
There is absolutely no sign of "java:comp/env", but as mentioned before I may not understand - maybe the "java:comp/env" is the standard namespace.
But on weekend I will be at home (where my box is standing) and I will post my exception, maybe you can help me again.
Really many many thank yous !!!
Max
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maximilian,
The JNDI references like "com/ibm/yada/MyBean" are old-style "Global References". They were what was advocated before the introduction of EJB 1.1. Ever since then the method that has been advocated has been the use of "ejb-references", as described in Monson-Haefel, or in the EJB spec. You can gain some insight into how this works by reading this sidebar to one of my articles. However, I would strongly suggest you pick up a copy of Monson-Haefel's 3rd Edition and start there.
Kyle
 
Maximilian Trenks
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanx Kyle.
This hint was what I needed and I hope I can resolve my problem on friday.
In case it doesn't work, I will post a new message with the stacktrace.
Max
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maximillian
The main reason you are not able to find your local ejb or whichever ejb you are trying to reference is bcos, you need to mention in your deployment descriptor that "One ejb is referring to the other". ejb-ref links...
And as far as I have been doing it, you dont have to use java:comp/env but it is always a good practice not to use jndi names directly in ur code which will lose the flexibility of changing the jndi names while installing the application.
What does java:comp/env does is:
You will have a jndi name, say for example for your local entity bean, call it as x/ejbA
Now, your ejbB calls this ejbA with this name. Now if anytime if anyone change this name in the deployment descriptor you will end up changing your code or property file or whatever. so, inorder to avoid this, you can give a reference to your jndi names through binding files in websphere. The name which you are using to bind with the original jndi name is the one you should use with java:comp/env/doundJndiName
 
What a stench! Central nervous system shutting down. Save yourself tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic