This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243034 - The file glassfish-resources.xml in project is not executed on Glassfish in order to install a jdbc pool
Summary: The file glassfish-resources.xml in project is not executed on Glassfish in o...
Status: RESOLVED DUPLICATE of bug 233481
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal with 3 votes (vote)
Assignee: TomasKraus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-19 06:31 UTC by jpaul
Modified: 2015-03-10 15:23 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (66.60 KB, text/plain)
2014-03-19 06:31 UTC, jpaul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jpaul 2014-03-19 06:31:19 UTC
Product Version = NetBeans IDE 8.0 (Build 201403101706)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.8.0
Runtime = Java HotSpot(TM) Client VM 25.0-b70
Comment 1 jpaul 2014-03-19 06:31:25 UTC
Created attachment 146132 [details]
IDE log
Comment 2 nuxero 2014-06-01 14:47:47 UTC
Same here on GNU/Linux with NetBeans 8 and openjdk7. I hace to add manually the gglassfish-resource.xml file to glassfish 4.0 server
Comment 3 ricg 2014-09-25 15:46:22 UTC
The same problem with netbeans 8.0.1 and GlassFish 4.1. I have attached a file with a simple procedure to reproduce the problem for the (duplicate ?) bug 233481 https://netbeans.org/bugzilla/show_bug.cgi?id=233481
Comment 4 ricg 2014-09-26 06:44:33 UTC
The cause of the problem: glassfish-resources.xml is not included by NetBeans in the WAR file.
Comment 5 ricg 2014-09-27 05:50:36 UTC
The problem is that the target "-add-resources" is never executed. 

This target is used by the target -deploy-ant which is used itself by the target run-deploy.

run-deploy depends of a lot of targets and one of these targets executed before "-add-resources", "-run-deploy-nb", uses "nbdeploy" that throws an error when it is executed. The error message is not clear and I can't guess why there is a problem.

The code (in the file build-impl.xml):
<target if="netbeans.home" name="-run-deploy-nb">
   <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
Comment 6 jpaul 2014-09-27 12:51:04 UTC
Hey, @ricg Did you find the solution?

Is it a problem in the xml? Or, the component not running "-add-resources"?
Comment 7 ricg 2014-09-27 13:06:58 UTC
I didn't find the solution because I have not the code of <nbdeploy>.

No problem in glassfish-resources.xml (you can execute it with asadmin).

-add-resources is never executed (sure ; I have added an <echo> inside) because (not so sure...) nbdeploy is executed before (in the list of the "depends" of "run-deploy") and nbdeploy throws an error.

I am not an expert on NetBeans ; it is what I have understood by reading the ant files.
Comment 8 ricg 2014-09-27 13:13:03 UTC
@jpaul: perhaps you can consider that executing glassfish-resources.xml with asadmin  is a solution (at least you will not be blocked) but I consider it just as a workaround.

asadmin is a bat file in the bin directory of installation od glassfish.

An example to type within asadmin:
add-resources C:/Users/myname/Documents/NetBeansProjects/TestPbDS/setup/glassfish-resources.xml
Comment 9 jpaul 2014-09-27 13:22:05 UTC
Thank you for sharing. 

I find something similar in https://glassfish.java.net/docs/4.0/administration-guide.pdf -> Section 2.10 "To Add Resources From an XML File"

Hopefully NetBeans team solve this problem.
Comment 10 ricg 2014-09-28 09:13:35 UTC
I have made other tests.

If I use "add-resources a/b/c/glassfish-resources.xml" of asadmin (of GlassFish), it works: the resources declared in glassfish-resources.xml are added in GlassFish.

In NetBeans, if I add glassfish-resources.xml under META-INF in the WAR file by tweaking build.xml, it does not work: when I deploy the project I get the same error as when glassfish-resources.xml.

If I deploy the WAR file (the one which contains glassfish-resources.xml under META-INF) from the administration console of GlassFish, I still get the same error.

Is it a bug of NetBeans or a bug of GlassFish? I don't know what to think... I incline rather towards GlassFish but I am not sure.
Comment 11 jpaul 2014-09-28 19:28:29 UTC
With a WAR, did you tried this:

«Deployment Descriptor. 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. For web applications or modules, this file is placed in the WEB-INF directory. If any submodule archives of an enterprise application archive have their own glassfish-resources.xml files, the resource definitions are scoped to those modules only. For more information about the glassfish-resources.xml file, see GlassFish Server Deployment Descriptor Files and Elements of the GlassFish Server Deployment Descriptors.»

https://glassfish.java.net/docs/4.0/application-deployment-guide.pdf
Section 2-25 "Deploying Applications"
Comment 12 ricg 2014-09-28 22:54:24 UTC
Yes I added glassfish-resources.xml in several directories (to be sure :-) ) in particular in WEB-INF. It was not used by GlassFish to create the resources.
Comment 13 saber667 2015-01-23 01:43:28 UTC
I'm experiencing similar issues with NetBeans 8.0.2 and GlassFish 4.1.

I've found that renaming the xml file to sun-resources.xml results in proper deployment of the JDBC resources to GlassFish.
Comment 14 jpaul 2015-01-23 07:52:13 UTC
(In reply to saber667 from comment #13)
> I'm experiencing similar issues with NetBeans 8.0.2 and GlassFish 4.1.
> 
> I've found that renaming the xml file to sun-resources.xml results in proper
> deployment of the JDBC resources to GlassFish.

That's great! Thank you for sharing.
Comment 15 MackSix 2015-02-16 06:16:58 UTC
If I have a web project with glassfish-resource.xml in a folder called "setup" under the project directory, it works. Though, it is still not copied to the jar.
Comment 16 Petr Hejl 2015-03-10 15:23:35 UTC

*** This bug has been marked as a duplicate of bug 233481 ***