How to point fromTomcat4.0.4 to Jboss3.0.0 server using JNDI

Discussions

EJB programming & troubleshooting: How to point fromTomcat4.0.4 to Jboss3.0.0 server using JNDI

  1.  
    In a servlet running under tomcat4.0.4,
    I have to access to an ejb home interface installed on jboss 3.0.0 this is my code:



    Properties.setProperty "java.naming.provider.url" , "localhost" ) ;

    Properties . setProperty ( "java.naming.factory.initial" , "org.jnp.interfaces.NamingContextFactory" ) ;
    Properties . setProperty ( "java.naming.factory.url.pkgs" ,"org.jboss.naming:org.jnp.interfaces" ) ;

    InitialContext jndiContext = new InitialContext(Properties);

    Object obj = jndiContext.lookup ("NameClassHome")



    I tried putting jndi.properties with the same settings in tomcat classpath and calling the default constructor of InitialContext but doesn't match: this attempt tries to access to Tomcat context.
    Can anyone help me?

    Thanks in advance


     
  2. set this in ur jndi.properties:

    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=localhost:1099

    change the localhost accordingly if jboss is not running on the local host.

    HTH.

    alex