I have just written an inbound resource adapter and everything seems to work fine with it. When I deploy my RA to the JBoss 7.0.1 AS, the container calls the ResourceAdapter.start(BootstrapContext ctx) method and I get a log message that the resource adapter has been started successfully.

In the next step, I try to activate an endpoint for my MDB using the following annotations:

Unfortunately when I deploy the MDB, I end up with a NoClassDefFoundError and ClassNotFoundException for the MessageListener Interface:

23:56:30,367 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.subunit."MDB_RA_TEST.ear"."MDBs.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."MDB_RA_TEST.ear"."MDBs.war".INSTALL: Failed to process phase INSTALL of subdeployment "MDBs.war" of deployment "MDB_RA_TEST.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.LinkageError: Failed to link UDPMessageDrivenBean (Module "deployment.MDB_RA_TEST.ear.MDBs.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)
at org.jboss.modules.Module.loadModuleClass(Module.java:588)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)
at java.lang.Class.forName0(Native Method) [:1.6.0_26]
at java.lang.Class.forName(Class.java:247) [:1.6.0_26]
at org.jboss.as.ee.component.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:124)
at org.jboss.as.ee.component.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:114)
at org.jboss.as.ee.component.LazyValue.get(LazyValue.java:40)
at org.jboss.as.ee.component.EEApplicationDescription.getClassConfiguration(EEApplicationDescription.java:183)
at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription.createConfiguration(MessageDrivenComponentDescription.java:78)
at org.jboss.as.ee.component.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:63)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: java.lang.NoClassDefFoundError: de/RATest/UDPMessageListener
at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_26]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [:1.6.0_26]
at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [:1.6.0_26]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [:1.6.0_26]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)
... 22 more
Caused by: java.lang.ClassNotFoundException: de.RATest.UDPMessageListener from [Module "deployment.MDB_RA_TEST.ear.MDBs.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)
... 27 more

I'm relatively new in the Java EE world and have not a lot of experiences with resource adapters, but this exceptions seems to me that the classes of the .RAR-file are not loaded correctly. I have read parts of the specification and also tried a lot with different combinations of archives, for example: a standalone .rar and a .ejb-jar file, everything inside of an .ear-file and a lot of other combination - but nothing has worked.

I am actually not sure anymore, that the resource adapter is completely correct. I have some questions that maybe could solve my problem:

do I need an JBoss specific deployment descriptor for the resource adapter?

do I have to modify the standalone-preview.xml also for an inbound resource adapter?

do I need something like the @ResourceAdapter annotation in my MDB?

if my inbound resource adapter is correct, should I see it in the management console under "Connector" -> "Resource Adapters"?

Here are some more facts, that could be important:

use of JCA 1.6

only annotations, so I have no ra.xml or ironjacamar.xml

I have started the standalone-preview.xml without any modifications

I have checked the RA with the ironjacamar validator and ended up with a "Validation successful"

I have really no clue how to go on and hope that you can help me. To simplify matters I have attached the sources.

do I need an JBoss specific deployment descriptor for the resource adapter?

No, as your resource adapter is pure inflow you won't need that. Once you add a connection factory or an admin object you will need to add an ironjacamar.xml or define a <resource-adapter> entry in the subsystem.

do I have to modify the standalone-preview.xml also for an inbound resource adapter?

No, same as above.

do I need something like the @ResourceAdapter annotation in my MDB?

Yes, you will need to point it towards your deployment.

if my inbound resource adapter is correct, should I see it in the management console under "Connector" -> "Resource Adapters"?

Thank you for the answer - now the .jar-file resolves the dependencies correctly!

I have also added the @ResourceAdapter annotation to the MDB, but another exception occurs:

19:04:39,890 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."UDPMsgBean.jar".component.UDPMessageDrivenBean.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.unit."UDPMsgBean.jar".component.UDPMessageDrivenBean.CREATE: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1786)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.IllegalStateException: No resource adapter registered with resource adapter name RA_UDP
at org.jboss.as.ejb3.component.EJBUtilities.createActivationSpecs(EJBUtilities.java:115)
at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:76)
at org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:78)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
... 4 more

The same happens, if I deploy everything as an .ear-file.

Is there something incorrect with the value of the annotation? I have also tried "deployment.RA_UDP.rar", but it does not work.

@ResourceAdapter("RA_UDP.rar")

The exception says, that the resource adapter is not registered - isn't it done automatically?

I tried the nightly build just now, no luck to get it work. I think there are some problem on JBoss AS 7/IronJacamar working on JCA. Wish someone would spend time to investigate the JCA (inbound/outbound RA) problem, such as this problem and another problem http://community.jboss.org/message/622860