users@glassfish.java.net

ResourceAdapter and _at_Resource(mappedName)

From: <glassfish_at_javadesktop.org>
Date: Tue, 03 Aug 2010 06:23:41 PDT

Hello. I have a resource adapter that is scoped to my .ear file.

I have successfully gotten this to be injected if I use a plain unadorned @Resource annotation, like this:

[code]
@Resource
private KnowledgeBase kb;
[/code]

I've used the various asadmin commands to create and link up a connection pool like this:
[code]
asadmin create-connector-connection-pool --raname=foo-1.0-SNAPSHOT#foo-drools-rar-1.0-SNAPSHOT --connectiondefinition=org.drools.KnowledgeBase --description "A connector connection pool for the foo-drools-rar resource adapter." foo-drools-connection-pool

asadmin create-connector-resource --poolname foo-drools-connection-pool --description "A connector resource for the foo-drools-connection-pool connection pool." com.foo.ejb.FooBean/kb
[/code]

In reality, however, the @Resource annotation in the code that I've got to work with looks like this:

[code]
@Resource(mappedName = "java:rulesengine/ra")
[/code]

...which is the only way to get JBoss to do the same thing (that I'm aware of; you have to explicitly set a JNDI name, and it's not necessarily relative to comp/env).

My question is: is there a way to use asadmin create-connector-resource in such a way that the ultimate JNDI name for the resource adapter will be java:rulesengine/ra?

Thanks,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=479216