Resource Adapter and consuming Servlet on AS7
fady Oct 14, 2011 8:34 AMHi there,
I have a resource adapter and a servlet using it. They are bundled separately in a rar and a war They have been successfully tested on Glassfish 3.1.1 however I can't get them to deploy with JBoss AS 7.0.2.Final "Arc".
The issue seems to be related to JNDI and Dependencies.
This is the adapter config in standalone.xml:
<resource-adapter>
<archive>legstar.socket.connector-0.1.rar</archive>
<transaction-support>LocalTransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="com.legsem.legstar.jca.socket.LegStarSocketManagedConnectionFactoryImpl" jndi-name="java:jboss/legstar.socket.connector" enabled="true" use-java-context="true" pool-name="LegStarConnectionPool" use-ccm="true">
<config-property name="ServerName">mainframe</config-property>
<pool>
<max-pool-size>2</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
</pool>
</connection-definition>
</connection-definitions>
</resource-adapter>
The rar deploys fine and I can see the JNDI entry java:jboss/legstar.socket.connector using the administration console.
The servlet's war however, fails to deploy.
The servlet references the adapter using the following code:
@Resource(name = "legstar.socket.connector", mappedName="java:jboss/legstar.socket.connector")
private ConnectionFactory connectionFactory;
The mappedName is something I had to add for JBoss because otherwise, I would systematically get this warning when deploying the war:
13:10:04,659 WARN [org.jboss.as.ee.component.deployers.ResourceInjectionAnnotationParsingProcessor] (MSC service thread 1-3) Can't handle @Resource for ENC name: java:jboss/legstar.socket.connector on class com.legsem.legstar.connector.it.web.ClientServlet since it's missing a "lookup" (or "mappedName") value and isn't of any known type
With the mappedName, the warning goes away but I get a ClassNotFoundException on the first reference to a class from the Resource Adapter.
I was assuming that the classpath for the servlet would include the resource adapter classes once the @Resource has been resolved. Is that the case or do I have to declare a dependency somewhere?
Thanks for any help.