users@glassfish.java.net

Re: @Resource not working for custom-resource

From: <forums_at_java.net>
Date: Thu, 5 Jan 2012 02:20:20 -0600 (CST)

I've further tested my case and found something even more puzzling to me. If
I start glassfish from fresh, the jndi "fileloc" is bound to
"org.glassfish.javaee.services.ResourceProxy", so the c.getBindings method
failed when casting the Reference (since the return is not a Reference). I
then put a c.lookup("fileloc") before the c.getBindings. It will still failed
with "IllegalAccessException: value cannot be null". Then I change the coding
again to remove the c.lookup and only leave c.getBindings, and run it the
third time, in which the jndi "fileloc" will be bound to
"javax.naming.Reference" and so the c.getBindings works.

I repeated the above 3-4 times and it behaves like this consistently. Any
idea why it behaves like this?


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