• 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

EJB JNDI lookup problems from Tomcat Standalone

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
can anyone help me with this problem? ->
I have an istance of JBoss 3.2.2RC4 running in a server (bdmc_server) and an istance of Tomcat 4.1.24 stand-alone running on another server.
Well, I'm using struts for building my web application, but when I try to bind a Session EJB in the JBoss Server, I got a bound error.
In the ActionBean I do something like this:
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.setProperty(Context.PROVIDER_URL, "bdmc_server:1099");
env.setProperty(Context.URL_PKG_PREFIXES,
"org.jboss.naming rg.jnp.interfaces");
InitialContext context = new InitialContext(env);
//look up jndi name
Object ref = context.lookup("java:ValidatoreUtente");
//look up jndi name and cast to Home interface
validatoreUtenteHome = (ValidatoreUtenteHome) PortableRemoteObject.narrow(ref, ValidatoreUtenteHome.class);
validatoreUtente = validatoreUtenteHome.create();
/******/
I tried all possible combination, if I write in the lookup statement "jnp:ValidatoreUtente" I get an unknown protocol exception.
If i write something like "java:comp/env/ejb/ValidatoreUtente" or any combination of those tokens, I get everytime a not bound exception.
Does anyone know where is the problem?
Help me plz!!!
 
Alessio Fabiani
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Well, I solved the problem.
There was nothing wrong in the code, it seems that until the application is an instance of Tomcat\webapps context, it can't find the correct JNDI path even if the connection with JNDI Server works fine.
The solution:
create a directory somewhere, and add the context to the server.xml configuration file, move the application there, and all will work properly.
Thanks!!!
reply
    Bookmark Topic Watch Topic
  • New Topic