Is the JSP and SessionBean within same VM? Then just do new InitialContext();

make sure that jboss/server/xxx/conf/jndi.properties has the Provider URL commented out. This will force JBoss to connect locally rather than going over net.

Maybe you have a jndi.properties file? Or maybe you have a Provider URL hardcoded with your JSP.

Bill

Rod Macpherson wrote:

Thanks Bill, Scott posted this as well. I am using that but here is the
problem

1. Have a box with three virtual IP addresses we will call default,
primary and secondary. 2. Launch JBoss on primary using "--host primary" with nothing running
on the others. 3. Telnet to primary port 1099 reveals that JNDI is listening.
4. Browsing to primary:8080 works fine revealing that JBoss is up and
running on primary.


Here is the problem when we try to access a session bean lookup from a
given JSP page:

javax.naming.CommunicationException [Root exception is
java.rmi.ConnectException: Connection refused to host: 1.2.11.21; nested
exception is:
        java.net.ConnectException: Connection refused: connect]

Here is where that IP address 1.2.11.21 fits in:

Default 1.2.11.21 (not running anything but access is being attempted)
Primary 1.2.11.22 (running JBoss) Secondary 1.2.11.23 (not running anything)


As you can see, there is no JNDI or RMI listener on 1.2.11.21 so no
wonder it is complaining. The listener is on "primary" where it should
be. I am using the jboss.bind.address is being reported as "primary" and
that is being used to cobble together the JNDI properties prior to doing
the context.lookup. So everything looks cool and this used to work. It
still works like a charm on my home PC. Ideas? Our multihome 3.2.2 is
fubar:(


TIA,

(P.S. If we need the JBG to fix this that's not a problem but want to
cover all the bases first)

Rod


-----Original Message-----
From: Bill Burke [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 26, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Multihome JBoss Issue



System.getProperty("jboss.bind.address");




Rod Macpherson wrote:

I use this to get the JNDI properties and bind Globals.HOST in a static
class initializer using java.net.InetAddress.getLocalHost().getHostName(). The problem is that


method returns the hostname of my box NOT the hostname that JBoss was started with using the --host switch. Given the static method call and


the fact that the JVM is not running on the bound --host, it's not surprising that Globals.HOST is not what I want but how then do we get


the --host value?

public static Properties getJNDIProperties()
{
   Properties properties = new Properties();

   if(Globals.JBOSS == Boolean.TRUE)  {
       properties.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
       properties.put("java.naming.provider.url", Globals.HOST +

":1099");


properties.put("java.naming.factory.url.pkgs",

"org.jboss.naming");


}




-- ================ Bill Burke Chief Architect JBoss Group LLC. ================



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to