Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Local EJB call - Naming Exception

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using weblogic 7.0 and i am making an local call on ejb using a client in the same environment.I am getting this exception while lookup.
Is there anything i missed in client program/ejb descriptors/weblogic descriptors.
javax.naming.NameNotFoundException: Unable to resolve 'HelloLocalHome' Resolved: '' Unresolved:'HelloLocalHome' ; remaining name 'HelloLocalHome'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
at javax.naming.InitialContext.lookup(Unknown Source)
at examples.HelloClients.main(HelloClients.java:37)
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We would need to see the deployment descriptors (both ejb-jar.xml and the vendor-specific one).
 
poonks Arasu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i am giving same
EJB DESCRIPTOR:
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>examples.HelloHome</home>
<remote>examples.Hello</remote>
<ejb-class>examples.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>Hello</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>examples.HelloLocalHome</local-home>
<local>examples.HelloLocal</local>
</ejb-local-ref>
</session>
</enterprise-beans>
</ejb-jar>
VENDOR SPECIFIC DESCRIPTOR:
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>Hello</ejb-name>
<reference-descriptor>
<ejb-local-reference-description>
<ejb-ref-name>Hello</ejb-ref-name>
<jndi-name>HelloLocalHome</jndi-name>
</ejb-local-reference-description>
</reference-descriptor>
<clients-on-same-server>true</clients-on-same-server>
<jndi-name>HelloHome</jndi-name>
<local-jndi-name>HelloLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Send us the lookup code as well.
 
poonks Arasu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am providing the lookup code
Client lookup :
Properties props = System.getProperties();
Context ctx = new InitialContext(props);
examples.HelloLocalHome home = (examples.HelloLocalHome)ctx.lookup("HelloLocalHome");
HelloLocal hello = home.create();
System.out.println(hello.hello());
hello.remove();
Calling code
java
-Djava.security.policy=../java.policy
-Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
-Djava.naming.provider.url=t3:ip ort
examples.HelloClient
thanks,
poonks
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Poonks,
(btw, you might want to change your name to comply with the 'Ranch naming policy)
Your code should use the following lookup string:

 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, wait a minute. Are you calling a local interface from a remote standalone client? That isn't even supposed to work.
 
poonks Arasu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lasse,
Can you please throw more light into it.
Am I supposed to call this from servlet/EJB only
(I will chnage name to comply with the 'Ranch naming policy)
Thanks,
poonks
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call the EJB from a standalone client but you'll have to use a remote interface instead of the local interface.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That would require some changes to your client-side code:

...and ofcourse your deployment descriptors need to be changed to using <ejb-ref> instead of <ejb-local-ref>, <home> instead of <local-home>, etc.
 
poonks Arasu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lasse,
Actually we am planning to call Local interface one EJB from another EJB in same M/c.So initially i am trying out how to call local interface.Can you please clarify me Instead of a standalone call can i do the same call from another EJB.
Thanks in advance
poonks
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call a local interface from another EJB as long as the calling EJB is in the same .ear as the target EJB.
 
reply
    Bookmark Topic Watch Topic
  • New Topic