Hi guys,

I know that your help will be precious in this question. I'm running Tomcat
and Jboss as two separate bundles, having my war running on the web-tier
under a JVM and Jboss running under another context. I deployed succesfully
my EJBs on Jboss, and following the instructions I read somewhere some time
ago, I defined a jndi.properties file and put it under WEB-INF/classes so to
have it in the classpath. 

>From the web-client, I was expecting to contact Jboss services simply by
means of the following code (here it's shown only a fragment):

InitialContext context = new InitialContext();
Object node = context.lookup("ejb/MySqlDbManager");
DbManagerHomeInterface home =
(DbManagerHomeInterface)PortableRemoteObject.narrow(node,
DbManagerHomeInterface.class);
DbManagerInterface bean = home.create();

I received a NamingException.

To solve the problem I created a private method which sets the property the
client needs, as follows:

        private Properties setContext() {
                Properties properties = null;
                if (properties == null ) {
                        properties = new Properties();           
                        properties.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
                        properties.put("java.naming.provider.url",
"jnp://localhost:1099");
                        properties.put("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
                        properties.put("jnp.socketFactory",
"org.jnp.interfaces.TimedSocketFactory");
                        properties.put("jnp.timeout", "0");
                        properties.put("jnp.sotimeout", "0");
                }
                return properties;
        }

so I create the context as follows:

InitialContext context = new InitialContext( setContext() );

I know there is another way, I mean which allows me to place the Property
file outside from the code, and I know also that if I place the properties
in a property file called jndi.properties something should happen
automatically.

Could you please illuminate me with the light of your experience?

Regards,

Marco Tedone


-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to