Hi Andrew,
Looks like the mappedName is specified as :
@MessageDriven(mappedName="jms.SimpleQueue")
and the resource name in glassfish-resources.xml as
"java:app/jms.SimpleQueue".
Making the following change will help to deploy the application
successfully :
@MessageDriven(mappedName="java:app/jms.SimpleQueue")
--
Thanks,
-Jagadish
Sun, an Oracle Company.
On Thu, 2011-05-12 at 12:30 +0930, Andrew Hughes wrote:
> Hi Again,
>
>
> It has take me a few days to find the time to write and example, but
> this I have done. The example so far is 1xMDB that needs a jms queue
> called "jms.SimpleQueue".
>
>
> The example is a maven project and I have put this on github here:
> https://github.com/ahhughes/glassfish3x.resources.xml.example
>
>
>
>
> If anyone can tell me what's wrong I'd appreciated it a lot.
>
>
> Thanks Heaps!
>
>
> p.s. FYI, when deploying the application the following exception is
> thrown:
>
>
> [#|2011-05-12T12:23:35.545+0930|WARNING|glassfish3.0.1|
> org.apache.catalina.connector.Request|
> _ThreadID=26;_ThreadName=Thread-1;|PWC4011: Unable to set request
> character encoding to UTF-8 from context , because request parameters
> have already been read, or ServletRequest.getReader() has already been
> called|#]
>
>
> [#|2011-05-12T12:23:35.623+0930|INFO|glassfish3.0.1|
> org.glassfish.admingui|_ThreadID=26;_ThreadName=Thread-1;|admin
> console: initSessionAttributes()|#]
>
>
> [#|2011-05-12T12:23:36.529+0930|SEVERE|glassfish3.0.1|
> javax.enterprise.system.container.ejb.mdb.com.sun.ejb.containers|
> _ThreadID=26;_ThreadName=Thread-1;|MDB00017: [SimpleMDB]: Exception in
> creating message-driven bean container:
> [com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:
> JMS resource not created : jms.SimpleQueue]|#]
>
>
> [#|2011-05-12T12:23:36.529+0930|SEVERE|glassfish3.0.1|
> javax.enterprise.system.container.ejb.mdb.com.sun.ejb.containers|
> _ThreadID=26;_ThreadName=Thread-1;|com.sun.appserv.connectors
> .internal.api.ConnectorRuntimeException
> com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: JMS
> resource not created : jms.SimpleQueue
> 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.DeployCommand.execute(DeployCommand.java:272)
> 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 org.glassfish.admingui.common.util.LocalDeploymentFacility
> $LocalDFCommandRunner.run(LocalDeploymentFacility.java:138)
> at
> org.glassfish.deployment.client.AbstractDeploymentFacility.deploy(AbstractDeploymentFacility.java:350)
> at
> org.glassfish.admingui.common.util.DeployUtil.invokeDeploymentFacility(DeployUtil.java:89)
> at
> org.glassfish.admingui.common.util.DeployUtil.deploy(DeployUtil.java:66)
> at
> org.glassfish.admingui.common.handlers.DeploymentHandler.deploy(DeploymentHandler.java:186)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> cont....
>
>
> On Thu, May 5, 2011 at 1:13 AM, Jagadish Prasath Ramu
> <jagadish.ramu_at_oracle.com> wrote:
> If you could provide a sample application (with the resources
> xml and
> resource-ref or resource-env-ref in deployment descriptors and
> source),
> we can look at what is going on.
>
> --
> Thanks,
> -Jagadish
> Sun, an Oracle Company.
>
>
>
>
> On Wed, 2011-05-04 at 14:57 +0930, Andrew Hughes wrote:
> > 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">
> > <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
> >
> >
> >
>
>
>
>