Win a copy of Fixing your Scrum this week in the Agile 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Local Interface (NameNotFoundException)

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I'm trying to call session bean's method from client. Session bean has implemented Local Interface. But at runtime it is throwing an error that javax.naming.NameNotFoundException.

Same example works fine if we use Remote Interface.

ejb-jar.xml file is as follows
----------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<display-name>LocalInterfaceJAR</display-name>
<enterprise-beans>
<session>
<display-name>SimpleSessionEJB</display-name>
<ejb-name>SimpleSessionEJB</ejb-name> <local-home>beans.SimpleSessionHome</local-home> <local>beans.SimpleSession</local>
<ejb-class>beans.SimpleSessionBean</ejb-class> <session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/beans.SimpleSession</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>beans.SimpleSessionHome</local-home>
<local>beans.SimpleSession</local>
<ejb-link>SimpleSessionEJB</ejb-link>
</ejb-local-ref>
<security-identity>
<description></description>
<use-caller-identity></use-caller-identity>
</security-identity>
</session>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked />
<method>
<ejb-name>SimpleSessionEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getEchoString</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>SimpleSessionEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params />
</method>
<method>
<ejb-name>SimpleSessionEJB</ejb-name>
<method-intf>Local</method-intf> <method-name>getEJBLocalHome</method-name>
<method-params />
</method>
<method>
<ejb-name>SimpleSessionEJB</ejb-name>
<method-intf>LocalHome</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>SimpleSessionEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<method>
<ejb-name>SimpleSessionEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBLocalObject</method-param>
</method-params>
</method>
<method>
<ejb-name>SimpleSessionEJB</ejb-name>
<method-intf>LocalHome</method-intf>
<method-name>create</method-name>
<method-params />
</method>
</method-permission>
</assembly-descriptor>
</ejb-jar>
----------------------------------------------------------------------------

Could anybody tell me what's wrong with this?

Thanks in Advance :roll:
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

You need to have remote interface inorder to access Session Bean from the client.

KUnal
 
Chandu Dharmadhikari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kunal
Thanks for giving instant reply. But here is one another thing. The Same exception it is throwing for EntityBean.

It is too frustrating.

Plz send solution as early as posible.

Thanks again
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u can not call any beans local interface from a client
if u want to test a local interface ...
client -> sessin bean remote -> entity/session bean local
Try something like this..
 
Chandu Dharmadhikari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shrividya
I tried this path also for EJB-QL. But this is not working till we don't implement remote interface for entity bean. I used path as follows
Client-> Stateless SessionBean (Implements Rmote Interface) -> EntityBean (implement Local Interface)
It throws Exception at Session bean(javax.naming.NameNotFoundException)

Plz send solution.

Thanks for reply
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic