Search code examples
javajakarta-eejbossjboss-mdbejb-2.x

JBoss Error in ejb-jar.xml for Message Driven Bean TextMDB: expected one res-ref-name tag


I've copied and pasted the example ejb-jar.xml and jboss.xml file from http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch6.chapt.html#ch6.mdbejbjar.ex and I'm receiving the following error when JBoss attempts to deploy it:

ERROR [ScannerThread] deployment.MainDeployer (MainDeployer.java:943) - Could not create deployment: file:/...-ejb2.jar
org.jboss.deployment.DeploymentException: Error in ejb-jar.xml for Message Driven Bean TextMDB: expected one res-ref-name tag
    at org.jboss.metadata.ApplicationMetaData.importEjbJarXml(ApplicationMetaData.java:403)
    at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:151)
    at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:506)

Also, I've noticed in Eclipse that the sample ejb-jar.xml file I'm using doesn't conform to it's dtd. Is there a better sample ejb2 mdb I could look at?


Solution

  • Why don't you fix the deployment descriptor? Try this ejb-jar.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC 
              "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
              "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
        <enterprise-beans>
            <message-driven>
                <ejb-name>TextMDB</ejb-name>
                <ejb-class>org.jboss.chap6.ex2.TextMDB</ejb-class>
                <transaction-type>Container</transaction-type>
                <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
                <message-driven-destination>
                    <destination-type>javax.jms.Queue</destination-type>
                </message-driven-destination>
                <resource-ref>
                    <res-ref-name>jms/QCF</res-ref-name>
                    <res-type>javax.jms.QueueConnectionFactory</res-type>
                    <res-auth>Container</res-auth>
                </resource-ref>
            </message-driven>
        </enterprise-beans>
    </ejb-jar>