users@glassfish.java.net

Re: Please help: Exception in creating message-driven bean container

From: <glassfish_at_javadesktop.org>
Date: Mon, 15 Sep 2008 10:28:25 PDT

Hi,

You have to use "sun-ejb-jar.xml" with "mdb-resource-adapter" and "resource-adapter-mid" elements, to bind the MDB with the RA.

For example:

[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
  <enterprise-beans>
    <name/>
    <ejb>
      <ejb-name>TestBean</ejb-name>
      <jndi-name>TestBean</jndi-name>
      <pass-by-reference>false</pass-by-reference>
      <mdb-resource-adapter>
        <resource-adapter-mid>TheRAnameYouSeeInAdminConsole</resource-adapter-mid>
      </mdb-resource-adapter>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>
[/code]

Note: In case you are deploying an EAR archive with the RA implementation embedded with the MDB, you have to change "TheRAnameYouSeeInAdminConsole" for "YourEarNameWithoutExtension#YourRarNameWithoutExtension".


But, althought the RA is implementing "javax.resource.cci.ConnectionFactory" , you won't directly receive asynchronous messages (because "javax.resource.cci.Connection" is only "opened" on demand by your applications).
Remember that the "subscribed" MDBs will only activate a MessageEndpointFactory in the RA, and the RA can use the MessageEndpointFactory to "create" an MDB instance (endpoint) to invoke the onRequest() method when it receive a message from the physical connection.


I hope it works for your project.
[Message sent by forum member 'jmarine' (jmarine)]

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