*
The moose likes EJB and other Java EE Technologies and the fly likes Lookup problem for local beans on oc4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Lookup problem for local beans on oc4j" Watch "Lookup problem for local beans on oc4j" New topic
Author

Lookup problem for local beans on oc4j

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
A lookup of a local Bean as follows:

<%
Context context = new InitialContext();
jdevpackage.hrAppEJBLocalHome hrapphome = (jdevpackage.hrAppEJBLocalHome)context.lookup("java:comp/env/ejb/hrAppEJB");

// Create local object
jdevpackage.hrAppEJBLocal hrapp = (jdevpackage.hrAppEJBLocal)hrapphome.create();

%>

where the web.xml contains the reference of the bean as follows:

<ejb-ref>
<ejb-ref-name>hrApp</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>jdevpackage.hrAppEJBHome</home>
<remote>jdevpackage.hrAppEJB</remote>
</ejb-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/hrAppEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>jdevpackage.hrAppEJBLocalHome</local-home>
<local>jdevpackage.hrAppEJBLocal</local>
</ejb-local-ref>

gives the following Java exception:
javax.naming.NamingException: Error instantiating web-app JNDI-context: No location specified and no suitable instance of the type 'jdevpackage.hrAppEJB' found for the ejb-ref hrApp


I am using oc4j and jdeveloper for deployment.
Andreas Schaefer
Ranch Hand

Joined: Feb 13, 2006
Posts: 63
To me that looks more like that the 'remote' EJB-Ref is invalid. Do you have a Remote Interface for this EJB? If not then please remove the EJB-Ref and only keep the local one.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Lookup problem for local beans on oc4j
 
Similar Threads
Exception while Looking up a local bean
one EJB from other EJB
NameNotFoundException and jndi
Need help on EJB2.0 Local interfaces
Help how do i call a LOCAL ejb