JBoss Community

class loading of an inbound resource adapter?

created by Kai Grunert in IronJacamar - View the full discussion

Hello,

 

 

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:

 

...
import de.RATest.UDPMessageListener;
 
@MessageDriven(messageListenerInterface = UDPMessageListener.class,
    activationConfig={
        @ActivationConfigProperty(propertyName = "port", propertyValue="15660")
})
public class UDPMessageDrivenBean implements UDPMessageListener{
    
     public void onMessage(String str){
        ...
    }
}

 

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.

Reply to this message by going to Community

Start a new discussion in IronJacamar at Community