users@glassfish.java.net

Define two instances of same bean in ejb-jar and sun-ejb-jar

From: <glassfish_at_javadesktop.org>
Date: Wed, 10 Jun 2009 06:15:54 PDT

Hi,

I have a question regarding deployment of beans. I have a MDB class which I want to deploy with different configurations. I.e. both instances should listen on different queues and should have different env-entries. I have one EJB jar which contains the bean class and the deployment descriptor. On JBoss this worked like a charm but now I'm running into problems.
My DDs look as follows:

Excerpt from ejb-jar.xml:

<enterprise-beans>
<message-driven>
<ejb-name>Bean-1</ejb-name>
<ejb-class>some.package.MDB</ejb-class>

.....
</message-driven>

<message-driven>
<ejb-name>Bean-2</ejb-name>
<ejb-class>some.package.MDB</ejb-class>

.....
</message-driven>

</enterprise-beans>



Excerpt from sun-ejb-jar.xml

    <enterprise-beans>
        <ejb>
                <ejb-name>Bean-1</ejb-name>
            <jndi-name>queue/Bean-1</jndi-name>
        </ejb>
        <ejb>
                <ejb-name>Bean-2</ejb-name>
            <jndi-name>queue/Bean-2</jndi-name>
        </ejb>
    </enterprise-beans>


My understanding is that I can pretty much put any name in the ejb-name field. But to my surprise it only works if ejb-name is the same as the EJB class name. E.g. if ejb-class is "some.package.Bean" the ejb-name has to be "Bean" otherwise the deployment fails with the strange error:
"com.sun.enterprise.connectors.ConnectorRuntimeException: JMS resource not created : "

The resource is not named, there is just a blank space after the colon.
I also have created the queues that I refer to by jndi-name.

Because of the above error I cannot deploy both beans. I cannot even deploy one bean as long as I have not the class name of the bean in "ejb-name" property.

I'm stuck, can anyone shed some light on this?
Thanks,
Chris
[Message sent by forum member 'chrjohn' (chrjohn)]

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