Hi,

The last two months I made my first experiences with jboss as a bean 
developer. I am really surprised and impressed by the work, that is 
done. But now, the first serious problem arised.

In an EJB client a tried to obtain the home interface of a bean from its 
remote interface. But a call to EJBObject.getEJBHome() throws an 
exception. That was the first sign. Later, I tried to use a HomeHandle 
to reobtain a home interface after a server restart. 
HomeHandel.getEJBHome() throws an exception.

I had a deeper look and found the problem: My code was

   Hashtable env = new Hashtable();
   env.put("java.naming.factory.initial", 
"org.jnp.interfaces.NamingContextFactory");
   env.put("java.naming.provider.url",  "localhost:1099");
   env.put("java.naming.factory.url.pkgs",  "org.jboss.naming");

   MyHome home = (MyHome) new InitialContext(env).lookup("MyHome");
   MyHome h = (MyHome) home.getHomeHandle().getEJBHome();

The last line throws the exception. It works, when I change the code to:

   Hashtable env = new Hashtable();
   System.setProperty("java.naming.factory.initial", 
"org.jnp.interfaces.NamingContextFactory");
   System.setProperty("java.naming.provider.url", "localhost:1099");
   System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");

MyHome home = (MyHome) new InitialContext().lookup("MyHome");
MyHome h = (MyHome) home.getHomeHandle().getEJBHome();

So had a look into the jboss source code. The HomeHandle implementation 
simply does not know the server, is came from. It just creates a new 
inital context without any Arguments. So it gets the local root context, 
which is not the context its home interface is bound to.

-alf

-- 
Alf Werder | System Engineering | TOMORROW Technologies GmbH
Oberstra�e 14b | D-20144 Hamburg
Mail: [EMAIL PROTECTED]


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to