• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help how do i call a LOCAL ejb

 
Sam Kebab
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jboss and i have no problems calling remote session. However, from withing the bean (remote) i plan to call another session locally (i.e. a helper session class) but can't seem to do it. I have been getting the ubiquitous class not found exception.
//code follows
InitialContext initialcontext = new InitialContext(properties);
Object ref = initialcontext.lookup("LocalCount");
mysecondpackage.LocalCountHome localhome = (mysecondpackage.LocalCountHome)ref;
//the ejb-jar follows
<enterprise-beans>
<session>
<ejb-name>TaxCounter</ejb-name> ...
<ejb-local-ref>
<ejb-ref-name>LocalCount</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>mysecondpackage.LocalCountHome</local-home>
<local>mysecondpackage.Local</local>
<ejb-link>Count</ejb-link>
</ejb-local-ref>
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was "<local>mysecondpackage.Local</local>" a typo or should it say "...LocalCount"?
 
Sam Kebab
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for responding.
Yes, the <local> has a different name. However, is not the .lookup("whateverName") based on the ejb-ref-name?
So that if
<ejb-ref-name>brittney</ejb-ref-name> ... my code would be
initialcontext.lookup("brittney");
also,
initialcontext.lookup("java:comp/env/brittney");
Am i missing something?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you're not missing a thing. I just thought that the container could be complaining about not finding a class named "...Local" because of a typo.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!