Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Local Interface (NameNotFoundException)  RSS feed

 
Chandu Dharmadhikari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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:
 
Kunaal A Trehan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Balaji Anand
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!