dev@glassfish.java.net

Re: Message linking...

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Sun, 02 Mar 2008 22:04:23 -0500

Hi,

Your configuration looks right. One thing to check is your
sun-ejb-jar.xml. It should have an element to bind the
message-destination-name (defined in ejb-jar.xml) to its global
jndi-name (created administratively in glassfish server):

<?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>
    <ejb>
      <ejb-name>your timerbean</ejb-name>
      <jndi-name>global-jndi-name-in-glassfish-server</jndi-name>
    </ejb>

    <message-destination>
      
<message-destination-name>InternalBootstrapQueue</message-destination-name>
      <jndi-name>global-jndi-name-in-glassfish-server</jndi-name>
    </message-destination>
  </enterprise-beans>
</sun-ejb-jar>

-cheng

Erik Brakkee wrote:
> Hi,
>
>
> What I am trying to do is from a servlet context listener in a webapp
> send a message to an MDB deployed in the same ear. I have one setup
> working but this requires configuration of the queue in glassfish.
> Instead I am trying to use message linking now.
>
> In the ejb-jar file I have the following ejb-jar.xml:
>
> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
> version="3.0">
>
> <enterprise-beans>
> <message-driven>
> <ejb-name>TimerBean</ejb-name>
> <ejb-class>org.wamblee.timer.TimerBean</ejb-class>
> <messaging-type>javax.jms.MessageListener</messaging-type>
>
> <message-destination-type>javax.jms.Queue</message-destination-type>
>
> <message-destination-link>InternalBootstrapQueue</message-destination-link>
> </message-driven>
> </enterprise-beans>
> <assembly-descriptor>
> <message-destination>
>
> <message-destination-name>InternalBootstrapQueue</message-destination-name>
> </message-destination>
> </assembly-descriptor>
> </ejb-jar>
>
>
> In other words, there is a message destination InternalBootstrapQueue
> which is linked to by a message-destination-link element.
>
> In my web.xml, I am referring to this message destination as follows:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>
> <listener>
> <listener-class>org.wamblee.mythtv.Application</listener-class>
> </listener>
>
> <persistence-context-ref>
>
> <persistence-context-ref-name>persistence/mythtv</persistence-context-ref-name>
> </persistence-context-ref>
>
> <message-destination-ref>
>
> <message-destination-ref-name>MythtvTimer</message-destination-ref-name>
> <message-destination-type>javax.jms.Queue</message-destination-type>
> <message-destination-usage>Produces</message-destination-usage>
>
> <message-destination-link>InternalBootstrapQueue</message-destination-link>
> </message-destination-ref>
>
> </web-app>
>
> In the servlet context listener I am using
>
> @Resource(name = "MythtvTimer")
> private Queue timerQueue;
>
> to refer to the queue.
>
> Nevertheless, at a deploy I am getting the following exception:
>
> [#|2008-02-23T21:42:16.953+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.core.classloading|_ThreadID=14;_ThreadName=Timer-7;_RequestID=f04e24a9-f966-45f4-ab51-c014e6afb763;|LDR5004:
>
> UnExpected error occured while creating ejb container
> com.sun.enterprise.connectors.ConnectorRuntimeException: JMS resource
> not created :
> at
> com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.getPhysicalDestinationFromConfiguration(ActiveJmsResourceAdapter.java:1528)
> at
> com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.updateMDBRuntimeInfo(ActiveJmsResourceAdapter.java:1379)
> at
> com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:170)
> at
> com.sun.ejb.containers.MessageBeanContainer.<init>(MessageBeanContainer.java:209)
> at
> com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:280)
>
> What am I doing wrong? Should message linking work in this way?
>
> Cheers
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>