Since nobody seems to have answered you.  Here is what I use to connect standalone 
Tomcat to Jboss.
There is more here than you asked for, but you get the idea.

  private static final String          contextFactory = 
"org.jnp.interfaces.NamingContextFactory" ;
  private static final String          urlPkgPrefixes = "org.jnp.interfaces" ;
  private static final String          providerUrl    = "localhost:1099" ;
  private static InitialContext        jndiContext = null ;

  public static InitialContext getJndiContext()
      throws NamingException {
    return getJndiContext(false) ;
  } //end getJndiContext()

  public static synchronized InitialContext getJndiContext(
      boolean                          restart )
      throws NamingException {
    if (jndiContext == null
       || restart) {
        Properties props = new Properties();
        props.setProperty(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
        props.setProperty(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
        props.setProperty(Context.PROVIDER_URL, providerUrl);
        jndiContext = new InitialContext(props);
    } //end if
    return jndiContext ;
  } //end getJndiContext()

  public static Object getRemoteHome(
      String                           beanName,
      Class                            remoteHomeClass )
      throws NamingException {
    Object ref  = null ;
    try {
      ref = getJndiContext().lookup(beanName);
    } catch (Exception e) {
      ref = getJndiContext(true).lookup(beanName) ;
    } //end try
    return PortableRemoteObject.narrow(ref, remoteHomeClass);
  } //end getRemoteHome()


> From: "Andrew" <[EMAIL PROTECTED]>
> To: "JBossUser" <[EMAIL PROTECTED]>
> Date: Fri, 7 Jun 2002 18:46:02 +0400
> Subject: [JBoss-user] (JBoss3)Handles problem in Tomcat standalone
> Reply-To: [EMAIL PROTECTED]
>
>     EJB handles not properly work in  Tomcat environment seems it's using
> Tomcat's JNDI Context for lookup...
> What could be wrong?
>
> Thanks.

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to