Thanks Guy, for the response.  That is the way I used to do things.  However,
there is code in org.jboss.tm.usertx.client.ClientUserTransaction that calls new 
InitialContext()
when you are trying to use a transaction from Tomcat.  If I don't use jndi.properties 
then the
client transaction will not work.  Much of the JBoss development is geared toward 
embedded
Tomcat/Jetty so I don't know whether this issue would qualify for a bug.  I am 
certainly finding
it difficult to be able to separate Tomcat and JBoss.  Looks like I will be limited to 
a physical
two-tier application even if I have written the code as three-tier or n-tier.

On Sunday 23 June 2002 12:23 pm, [EMAIL PROTECTED] wrote:
> From: "Guy Rouillier" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Re: [JBoss-user] Never ending etandalone Tomcat issues
> Date: Sun, 23 Jun 2002 01:06:20 -0400
> Reply-To: [EMAIL PROTECTED]
>
> I wouldn't recommend putting jndi.properties into the Tomcat classpath,
> because then you are restricting everyone using that instance of Tomcat to
> those settings.  What we do is to include the home and object creation into
> a header file, and include that header file on each jsp page that needs to
> get to JBoss (equivalent things can be done for servlets).  Here is what
> our header looks like:
>
>          java.util.Hashtable env = new java.util.Hashtable();
>          env.put("java.naming.factory.initial",    INITIAL_FACTORY);
>          env.put("java.naming.provider.url",       aJndiURL);
>          env.put("java.naming.factory.url.pkgs",   URL_FACTORY);
>          ctx = new InitialContext(env);
>
>          Object ref = ctx.lookup("xxxxxxx");
>          home =
> (AuthenticationHome)PortableRemoteObject.narrow(ref,xxxxxxx.class);
>          obj = home.create();
>
> A page that needs to connect to JBoss then would looks something like this:
>
> <%@ include file="/common/html/nccheader.jsp" %>
>
> <%
> obj.callSomeMethod(....);
> %>
>
> If you have multiple objects you need to lookup, maybe just setting up the
> initial context in the header would be better, then getting the home and
> remote references can be done on the pages.


-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to