users@glassfish.java.net

Re: @Resource not working for custom-resource

From: <forums_at_java.net>
Date: Thu, 5 Jan 2012 01:42:29 -0600 (CST)

Cheng, thanks for the reply.

For @Resource, I've tried name only, mappedName only and both together, all
returns null.

For lookup("fileloc"), it seems it can found fileloc but finally ended with
the IllegalAccessException. I do not have any \ , only /. Here is the
stacktrace (testUtil is my singleton bean):

[code]

javax.naming.CommunicationException: Communication exception for
SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is
java.lang.IllegalAccessException: value cannot be null]
 at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:542)
 at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
 at javax.naming.InitialContext.lookup(InitialContext.java:392)
 at javax.naming.InitialContext.lookup(InitialContext.java:392)
 at ejb.testUtil.init(testUtil.java:72)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

[/code]


--
[Message sent by forum member 'senderj']
View Post: http://forums.java.net/node/880055