users@glassfish.java.net

Re: Glassfish 3.1 - glassfish-resources.xml && JMS Queues?

From: Andrew Hughes <ahhughes_at_gmail.com>
Date: Wed, 4 May 2011 14:57:02 +0930

Thanks for your help everyone, but it doesn't work :'( If I create the jms
Queue via the admin console, no problem. But the glassfish-resources.xml
fails.

Below is everything I have. The most useful doco so far is this blog
http://blogs.sun.com/JagadishPrasath/entry/application_scoped_resources_in_glassfish
but
I still can't get this working. I have tried both with and without the
"java:app/" jndi prefix but it seems to make no difference. Also, the blog
mentions a command that no longer works - it's supposed to lists
resources ($GF_HOME/bin/asadmin
list-applications --resources --subcomponents).


Thanks in advance for helping me out, its much appreciated!
--AH


The MDB:

@MessageDriven(*mappedName="jms.LogQueue*")
public class LogMDB.....


and ear's ./META-INF/glassfish-resources.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application
Server 3.1 Resource Definitions//EN" "
http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
  <!-- tried both with and without the java:app/ -->
  <admin-object-resource enabled="true"
*jndi-name="java:app/jms.LogQueue"* object-type="user"
res-adapter="jmsra" res-type="javax.jms.Queue">
    <description/>
    <property name="Name" value="jms.LogQueue"/>
  </admin-object-resource>
</resources>



The exception I get when deploying is:

[#|2011-05-04T14:19:32.558+0930|INFO|glassfish3.0.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=28;_ThreadName=Thread-1;|logging-ear-5.1.0-SNPSHOT
was successfully deployed in 594 milliseconds.|#]

[#|2011-05-04T14:19:33.886+0930|SEVERE|glassfish3.0.1|javax.enterprise.system.container.ejb.mdb.com.sun.ejb.containers|_ThreadID=28;_ThreadName=Thread-1;|MDB00017:
[LogMDB]: Excep
ion in creating message-driven bean container:
[com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:* JMS
resource not created : jms.LogQueue*]|#]

[#|2011-05-04T14:19:33.886+0930|SEVERE|glassfish3.0.1|javax.enterprise.system.container.ejb.mdb.com.sun.ejb.containers|_ThreadID=28;_ThreadName=Thread-1;|com.sun.appserv.connector
.internal.api.ConnectorRuntimeException
com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: JMS
resource not created : jms.LogQueue
        at
com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter.getPhysicalDestinationFromConfiguration(ActiveJmsResourceAdapter.java:1907)
        at
com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter.updateMDBRuntimeInfo(ActiveJmsResourceAdapter.java:1716)
        at
com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:182)
        at
com.sun.ejb.containers.MessageBeanContainer.<init>(MessageBeanContainer.java:199)
        at
com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:115)
        at
org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:207)
        at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:197)
        at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:63)
        at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:175)
        at
org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:216)
        at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
        at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at
org.glassfish.deployment.admin.EnableCommand.execute(EnableCommand.java:174)
        at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
        at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
        at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
        at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
        at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:619)
Caused by:
com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: JMS
resource not created : jms.LogQueue
        at
com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter.getPhysicalDestinationFromConfiguration(ActiveJmsResourceAdapter.java:1901)
        ... 37 more



On Tue, May 3, 2011 at 11:09 PM, Nigel Deakin <nigel.deakin_at_oracle.com>wrote:

> On 02/05/2011 08:06, Andrew Hughes wrote:
>
> Hi,
>
> I can see several references that suggest a JMS Queue can be configured
> in *.ear:./WEB-INF/glassfish-resources.xml ....
>
> For example: http://download.oracle.com/javaee/6/tutorial/doc/bnceh.html
> says....
>
> With GlassFish Server, you can use the asadmin create-jms-resource command
> or the Administration Console to create JMS administered objects in the form
> of connector resources. *You can also specify the resources in a file
> named glassfish-resources.xml that you can bundle with an application*.
>
>
> But I can't see any documentation or examples on how this is done. I feel
> like I've exhausted all avenues I know :'( so help would be very much
> appreciated.
>
>
> This page in the Oracle GlassFish Server 3.1 Application Deployment Guide
> lists the element hierarchy
> http://download.oracle.com/docs/cd/E18930_01/html/821-2417/giyhh.html
>
> However this is a bit cryptic, so here's a simple example which defines a
> administered queue resource which has a JNDI name of "jms/inboundQueue" and
> a physical destination name of "inboundQueue".
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application
> Server 9.0 Resource Definitions //EN"
> "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd"<http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd>
> >
> <resources>
> <admin-object-resource enabled="true" jndi-name="jms/inboundQueue"
> object-type="user" res-adapter="jmsra" res-type="javax.jms.Queue">
> <description/>
> <property name="Name" value="inboundQueue"/>
> </admin-object-resource>
> </resources>
>
> Nigel
>