On Wed, Aug 25, 2004 at 11:13:45AM +0200, Jacek Laskowski wrote:
> Just saw the thread, and I'm concerned with the system properties and
> the JNDI factories. Would you send me an example that proves it?
Hi Jacek,
Thanks for the help. Here's the story:
If I set up a simple EJB (like the ones used in the OpenEJB remote
tests) and call it remotely it works fine if I specify the 4
parameters needed in code
Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "127.0.0.1:4201");
p.put("java.naming.security.principal", "myuser");
p.put("java.naming.security.credentials", "mypass");
And it also works if I put the first two on the command line
Properties p = new Properties();
p.put("java.naming.security.principal", "myuser");
p.put("java.naming.security.credentials", "mypass");
$ java
-Djava.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
-Djava.naming.provider.url=127.0.0.1:4201 etc...
but if I try to put the java.naming.security.principal on the command
line
Properties p = new Properties();
p.put("java.naming.security.credentials", "mypass");
$ java
-Djava.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
-Djava.naming.provider.url=127.0.0.1:4201
-Djava.naming.security.principal=myuser etc...
then I get
javax.naming.ConfigurationException: Context property cannot be null:
java.naming.security.principal
at
org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:163)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at g6o.ServerUnitTest.newOpenEJBInitialContext(ServerUnitTest.java:50)
at g6o.ServerUnitTest.findStatelessSessionBean(ServerUnitTest.java:118)
at g6o.ServerUnitTest.testPing(ServerUnitTest.java:95)
I thought that perhaps junit wasn't passing the properties through,
but since the first two get propagated I think that's not likely to be
the problem.
If you'd like me to send you code please let me know.
Regards,
Toby