• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNDI Problem(HELP)

 
Greenhorn
Posts: 7
  • 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 use EJBs from one application
I'll call "A") in a different (web) application (I'll call "B"). Both applications are deployed.
Application A has four EJB classes (that I'll call A1, A2, A3, A4).
I have <ejb-ref> tags in B's web.xml that give JNDI names (like ejb/A1) to the EJBs in A. I have the home and remote interface classes in the
WEB-INF/classes directory for B. In my JSP in B,
I have this code:
context = new InitialContext();
A4Home a4Factory = (A4Home)
PortableRemoteObject.narrow(context.lookup("java:comp/env/ejb/A4"),
A4Home.class);
but the JSP throws a naming exception that looks like this:
javax.naming.NamingException: Error instantiating web-app JNDI-context: No location specified and
no suitable instance of the type 'mypackage.A1' found for the ejb-ref ejb/A1 at
com.evermind.server.http.HttpApplication.getEnvironmentContext(JAX)
at com.evermind.server.go.fz(JAX)
at com.evermind.server.go.lookup(JAX)
at javax.naming.InitialContext.lookup(InitialContext.java:354)
at /login2.jsp._jspService(/login2.jsp.java:81) (JSP page line 84)
at com.evermind.server.http.EvermindHttpJspPage.service(JAX)
at com.evermind.server.http.HttpApplication.t8(JAX)
at com.evermind.server.http.JSPServlet.service(JAX)
at com.evermind.server.http.di.pz(JAX)
at com.evermind.server.http.di.forward(JAX)
at com.evermind.server.http.dr.p4(JAX, Compiled Code)
at com.evermind.server.http.dr.p3(JAX, Compiled Code)
at com.evermind.util.f.run(JAX, Compiled Code)
I'm thinking there's a need for a jndi.properties file somewhere, but I can't figure out where to put it. I've put it in WEB-INF/classes, WEB-INF,
the web-app root, but no joy.
Any ideas?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic