users@glassfish.java.net

RE: Glassfish 4 reads, but does not use my glassfish-resources.xml

From: Dan Kaplan <dank_at_mirthcorp.com>
Date: Wed, 12 Mar 2014 19:08:52 -0700

Ok where do I put the application scoped resource? Also shouldnt it give me
a warning if I make this mistake? And why does this work fine if I use
add-resources? I guess I need more explanation of the terminology. I
thought putting it in the ear meant application scope.
On Mar 12, 2014 7:03 PM, "David Zhao" <liang.x.zhao_at_oracle.com> wrote:

> Hi Dan,
> The wiki is talking about Application Scoped Resources, but you are trying
> to create global resources in the resource xml file which is packaged into
> application - it is not supported.
>
> Please refer to the glassfish documentation
> http://docs.oracle.com/cd/E18930_01/html/821-2417/giydj.html for more
> details:
>
>
>
> · An application-scoped resource is defined in the
> glassfish-resources.xml deployment descriptor file. This file is placed in
> the META-INF directory of the module or application archive.
>
> · Global resources -- Defining java:global JNDI names is not
> supported.
>
>
>
> Thanks,
>
> David Zhao
>
>
>
> *From:* Dan Kaplan [mailto:dank_at_mirthcorp.com]
> *Sent:* Thursday, March 13, 2014 5:56 AM
> *To:* users_at_glassfish.java.net
> *Subject:* Glassfish 4 reads, but does not use my glassfish-resources.xml
>
>
>
> Here's my glassfish-resources.xml file:
>
>
>
> <?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/glassfish-resources_1_5.dtd">
>
> <resources>
>
> <admin-object-resource enabled="true" jndi-name="jms/AgentMDB"
> object-type="user" res-adapter="jmsra"
>
> res-type="javax.jms.Queue">
>
> <description></description>
>
> <property name="Name" value="AgentMDB"/>
>
> </admin-object-resource>
>
> <admin-object-resource enabled="true"
> jndi-name="jms/DeliveryEvaluationMDB" object-type="user" res-adapter="jmsra"
>
> res-type="javax.jms.Queue">
>
> <description></description>
>
> <property name="Name" value="DeliveryEvaluationMDB"/>
>
> </admin-object-resource>
>
> <admin-object-resource enabled="true" jndi-name="jms/DeliverySendMDB"
> object-type="user" res-adapter="jmsra"
>
> res-type="javax.jms.Queue">
>
> <description></description>
>
> <property name="Name" value="DeliverySendMDB"/>
>
> </admin-object-resource>
>
> <admin-object-resource enabled="true" jndi-name="jms/AttachmentMDB"
> object-type="user" res-adapter="jmsra"
>
> res-type="javax.jms.Queue">
>
> <description></description>
>
> <property name="Name" value="AttachmentMDB"/>
>
> </admin-object-resource>
>
> </resources>
>
>
>
> This is being read, but it's not be used. I know it's being read, because
> if I put an xml syntax error in this file, glassfish will complain:
>
>
>
> [2014-03-12T14:46:50.405-0700] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026]
> [javax.enterprise.system.core] [tid: _ThreadID=481
> _ThreadName=admin-listener(15)] [timeMillis: 1394660810405] [levelValue:
> 1000] [[
>
> Exception during lifecycle processing
>
> org.glassfish.deployment.common.DeploymentException: Failue while
> processing glassfish-resources.xml(s) in the archive -- Element type
> "admin-object-resource" must be followed by either attribute
> specifications, ">" or "/>".
>
> at
> org.glassfish.resources.admin.cli.ResourcesXMLParser.initProperties(ResourcesXMLParser.java:277)
>
>
>
>
>
> But, the file is not used as described here:
> https://blogs.oracle.com/JagadishPrasath/entry/application_scoped_resources_in_glassfish
>
>
>
> I'm expecting glassfish to create these resources and it does not.
> Eventually I get a failure on deploy about how it can't find them. EG:
>
>
>
> [2014-03-12T14:53:34.746-0700] [glassfish 4.0] [SEVERE] []
> [javax.enterprise.system.container.ejb.mdb.org.glassfish.ejb.mdb] [tid:
> _ThreadID=99 _ThreadName=admin-listener(4)] [timeMillis: 1394661214746]
> [levelValue: 1000] [[
>
> com.sun.appserv.connectors.internal.api.ConnectorRuntimeException
>
> com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid
> destination jms/DeliveryEvaluationMDB for MDB: JNDI name not found
>
> at
> com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter.getPhysicalDestinationFromConfiguration(ActiveJmsResourceAdapter.java:2157)
>
> at
> com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter.updateMDBRuntimeInfo(ActiveJmsResourceAdapter.java:1991)
>
>
>
> But I know this file is valid because if I use asadmin add-resources on
> it, it works as I expect it to. I've tried putting the file in my ejb's
> META-INF and my ear's META-INF, and it doesn't make a difference. My
> coworker has also tried on a sample project and it doesn't work for him
> either. Why isn't glassfish creating these resources?
>
>
>
> I'm starting to think this is a glassfish bug. FWIW, it doesn't seem to
> work in GF3 either, but it does work in GF2.
>
>
>
>
>
> --
> Thanks,
> Dan
>
>
> CONFIDENTIALITY NOTICE: The information contained in this electronic
> transmission may be confidential. If you are not an intended recipient, be
> aware that any disclosure, copying, distribution or use of the information
> contained in this transmission is prohibited and may be unlawful. If you
> have received this transmission in error, please notify us by email reply
> and then erase it from your computer system.
>

-- 
CONFIDENTIALITY NOTICE: The information contained in this electronic 
transmission may be confidential. If you are not an intended recipient, be 
aware that any disclosure, copying, distribution or use of the information 
contained in this transmission is prohibited and may be unlawful. If you 
have received this transmission in error, please notify us by email reply 
and then erase it from your computer system.