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.
Product Version = NetBeans IDE Dev (Build 201307252300) Operating System = Windows 8 version 6.2 running on amd64 Java; VM; Vendor = 1.7.0_25 Runtime = Java HotSpot(TM) 64-Bit Server VM 23.25-b01 Trying to deploy a module will fail: SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method SEVERE: Exception while preparing the app SEVERE: Exception during lifecycle processing java.lang.RuntimeException: Invalid resource : jdbc/request__pm at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593) at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517) at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63) at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71) at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108) at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142) at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107) at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510) at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230) at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534) at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224) at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544) at java.lang.Thread.run(Thread.java:724) Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/request__pm at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81) at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62) at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136) at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589) ... 45 more java.lang.RuntimeException: Invalid resource : jdbc/request__pm Is this a generated resource? I have defined a resource "jdbc/request" which is used to access a MS SQL Server. The problem occurs on a project, which works fine using NB 7.3.1 or older versions. The problem only occurs in the 7.4 dev version (tested with the last 4 versions). Unfortunately I do not more information.
Created attachment 137856 [details] IDE log
Targeting to be fixed ASAP.
Product Version: NetBeans IDE Dev (Build 201307282300) Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04 Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b16 System: Mac OS X version 10.8.4 running on x86_64; UTF-8; en_US (nb) I think I am seeing something similar. Basically, I have an app that has some jdbc resources defined in glassfish-resources.xml but the resources are not created on the server when I deploy the application from the IDE. I can create the resources manually and ping the db using the Server Console.
maybe more related to(In reply to comment #3) > Product Version: NetBeans IDE Dev (Build 201307282300) > Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04 > Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b16 > System: Mac OS X version 10.8.4 running on x86_64; UTF-8; en_US (nb) > > I think I am seeing something similar. > Basically, I have an app that has some jdbc resources defined in > glassfish-resources.xml but the resources are not created on the server when I > deploy the application from the IDE. > > I can create the resources manually and ping the db using the Server Console. maybe more related to #230671
(In reply to comment #4) > maybe more related to(In reply to comment #3) > > Product Version: NetBeans IDE Dev (Build 201307282300) > > Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04 > > Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b16 > > System: Mac OS X version 10.8.4 running on x86_64; UTF-8; en_US (nb) > > > > I think I am seeing something similar. > > Basically, I have an app that has some jdbc resources defined in > > glassfish-resources.xml but the resources are not created on the server when I > > deploy the application from the IDE. > > > > I can create the resources manually and ping the db using the Server Console. > > maybe more related to > #230671 I created a new issue for the resources not created on deploy: #233679
Checked into web-main: ---------------------- changeset: 260167:a24634e3db3f commit message: #233679 - JDBC resources not created when app deployed to GF4 #233481 - [74cat] Cannot deploy module accessing SQL Server to GlassFish 4.0 I will not mark this as Bug# 233679 duplicate because ?I would like to get this issue verified too. I'm not 100% sure.
Fix is pushed, closing this bug.
Integrated into 'main-silver', will be available in build *201308022300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/a24634e3db3f User: Tomas Kraus <TomasKraus@netbeans.org> Log: #233679 - JDBC resources not created when app deployed to GF4 #233481 - [74cat] Cannot deploy module accessing SQL Server to GlassFish 4.0
ok. Thanks
Created attachment 149489 [details] Procedure to reproduce the problem.
A part of my comment doesn't appear: I think that the bug is not solved because I have just had the same problem with NetBeans 8.0.1, GlassFish 4.1 and Java DB (not MySQL). (In reply to ricg from comment #10) > Created attachment 149489 [details] > Procedure to reproduce the problem.
The cause of the problem: glassfish-resources.xml is not included by NetBeans in the WAR file.
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>
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.
Hi, I hace the same problem with NetBeans 8.0.1 un windows 7, I was using this with out troubles before NetBeans 7.4 but since 7.4 I still have the same trouble. There is any chance to help you?
*** Bug 250474 has been marked as a duplicate of this bug. ***
*** Bug 243034 has been marked as a duplicate of this bug. ***
First we have know how this should work properly. Here ia a link to GF JDBC code owner's blog where weverthing is described: https://blogs.oracle.com/JagadishPrasath/entry/application_scoped_resources_in_glassfish Second I tested this with full EE application (having .war and ejb.jar packaged in .ear archive). It works fine when deployment is done from NetBeans, because GF plugin takes care of adding glassfish-resources.xml content to GF. But yes, built archives do not contain glassfish-resources.xml. This file is not present even in build/classes/META-INF of ejb project (source for archiving) where it should be. I would blame ant build script which shall copy glassfish-resources.xml there during build phase.
Created attachment 152680 [details] Glassfish resources file can be stored in both setup and config folders
Pushed into web-main: --------------------- changeset: 284675:d075b556b189 user: Tomas Kraus <TomasKraus@netbeans.org> date: Tue Mar 17 16:39:16 2015 +0100 summary: #233481 - Glassfish resources file can be stored in both setup and config folders. URL: hg.netbeans.org/web-main/rev/d075b556b189 This allows at least workarount - let NetBeans create glassfish-resources.xml in project setup folder, but be able to move it into config folder where it's still recognized and used.
Pushed into web-main: --------------------- changeset: 285033:b22d9a2d6798 user: Tomas Kraus <TomasKraus@netbeans.org> date: Wed Mar 18 12:47:08 2015 +0100 summary: #233481 - GlassFish modules version update. URL: http://hg.netbeans.org/web-main/rev/b22d9a2d6798
Pushed into web-main: --------------------- changeset: 285037:bee6ba4169c5 user: Tomas Kraus <TomasKraus@netbeans.org> date: Wed Mar 18 14:54:29 2015 +0100 summary: #233481 - Module version update. URL: http://hg.netbeans.org/web-main/rev/bee6ba4169c5
Integrated into 'main-silver', will be available in build *201503190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/d075b556b189 User: Tomas Kraus <TomasKraus@netbeans.org> Log: #233481 - Glassfish resources file can be stored in both setup and config folders.
Pushed into web-main: --------------------- changeset: 285078:5040fcd5a1fa user: Tomas Kraus <TomasKraus@netbeans.org> date: Fri Mar 20 15:07:54 2015 +0100 summary: #233481 - Resources wizard modified to create new files in config directory. URL: http://hg.netbeans.org/web-main/rev/5040fcd5a1fa It should be OK now.
There was NPE during my local testing, so pushing one more simple fix into web-main: -------------------------------------------------------------------------- changeset: 285167:7566e39df8bc tag: tip user: Tomas Kraus <TomasKraus@netbeans.org> date: Fri Mar 20 15:53:02 2015 +0100 summary: #233481 - Fixed NPE. URL: http://hg.netbeans.org/web-main/rev/7566e39df8bc Both wizards (create resources and persistence unit) now put new files into proper directories for GF 3.1 and later. Closing this bug.
Integrated into 'main-silver', will be available in build *201503210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/5040fcd5a1fa User: Tomas Kraus <TomasKraus@netbeans.org> Log: #233481 - Resources wizard modified to create new files in config directory. Did some additional code cleanup in modified classes.
Integrated into 'main-silver', will be available in build *201503240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/7566e39df8bc User: Tomas Kraus <TomasKraus@netbeans.org> Log: #233481 - Fixed NPE.
I have just used the nightly build "Product Version: NetBeans IDE Dev (*Build 201505040001*)" and I still have had the same problem. I believed have understood in your message that the problem had been solved in this version but it seems it is not the case. I have created a Maven Enterprise project (following https://netbeans.org/kb/docs/javaee/maven-entapp.html with a new datasource "jdbc/test" with the database named "testmaven" (JavaDB database) at the step "Creating the Persistence Unit") and when I run the application I receive the error message com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/test__pm while the definition of test is in the file glassfish-resources.xml. If I replace jdbc/test by jdbc/sample (defined in GlassFish), all works well.
Hi, I teach Web services to the students and I confirm that getting the NetBeans IDE updated, this is not possible to work because the database resource connection is not working at deploying the project. A workaround is not applicable in industrial projects, I did not try the workaround, but I cannot teach this framework if it does not work. Thank you to help in students projects that end next week (on May, 13 2015). Best regards, Anne-Marie Lesas
I can confirm that the build 201503190001 Works without this bug (I had successfully deployed projects with this versión) have you tried to download this versión?
(In reply to david.chaves from comment #30) > I can confirm that the build 201503190001 Works without this bug (I had > successfully deployed projects with this versión) have you tried to download > this versión? The version I use (Build 201505040001) for this test is latter than build 201503190001, so the bug should have been fixed. I have just tried again the same Enterprise application without Maven and I have had the same error (java.lang.RuntimeException: Invalid resource : jdbc/test2__pm); I have created a new Persistence Unit named jdbc/test2. I noticed that glassfish-resources.xml was now put under META-INF (src/conf/META-INF) by the NetBeans wizard that creates the persistence unit. In the dist entry glassfish-resources.xml is put into the entry META-INF.META-INF (is it normal?) of the jar.
Hi all, I had the same error messages as you people with Glassfish 4.1, Netbeans 8.0.2, mysql 5.5.41 on Ubuntu server 14.04. The following sequence of steps worked for me: - Create a webapplication in Netbeans with JSF, add Entity class and JSF request bean to do a simple insert into an existing mysql database. During this process, I have created a new JDBC connection pool to my existing database on the server and JDBC resource. Almost all smooth and automatic, no glitches. - Build OK, but deploy: no-no, connection refused - Needed to fix my.cnf in /etc/mysql/ on the server to contain line: bind-address = 0.0.0.0 under: [mysqld] - Deploy again: no-no, server log says: invalid resource myJDBCresource__pm - OK, 1. manually created JDBC pool jdbc/myjdbcpool from Glassfish admin console through web browser 2. manually created JDBC resource jdbc/myresource__pm bound to that pool - Deploy again: no-no, server log says: invalid resource jdbc/myresource__nontx - OK, 3. manually created JDBC resrouce jdbc/myresource__nontx bound to the same pool - Deploy again: and it works, finally. So the bug is that Glassfish or Netbeans does not create the "__pm" resource on deploy properly. I tried moving the config files everywhere around with no effect, but manual create in Glassfish console did the job, so the config files were clearly taken from where they originally were placed by Netbeans (I removed all the moved around copies) Agree with Anne-Marie that it is kind of "fun" to see "reference implementation" behave this way, but thanks for the hints! Pavel.
I believe the issue is: When application scoped resources is being used (glassfish-resources.xml being bundled into the archive, not deployed separately) one has to use "java:app/" prefix for the JNDI name of the datasource. Thus in the persistence.xml, there should be for example java:app/jdbc/test. Can you confirm this?
Petr: not sure what you mean and if the question was for me. Now I have done the following steps from scratch: 1. on a server, from mysql console entered the following: mysql> create database glassfish charset utf8 collate utf8_slovak_ci; mysql> GRANT ALL ON glassfish.* TO 'glassfish'@'localhost' identified by mysql> GRANT ALL ON glassfish.* TO 'glassfish'@'%' identified by 'heslo'; mysql> create table glassfish (id int primary key auto_increment, label varchar(100), property varchar(100)); 2. created a simple web application in NetbeansEE, added new Persistence Unit and new connection to this database called jdbc/glassdb, all connections worked from Glassfish ok 3. automatically added Entity from table - Glassfish correctly connected to database and retrieved the structure of the table 4. added the jsf managed request-scope bean and implemented an insert() method addressed from the webapplication The resulting Netbeans project is here: http://kempelen.ii.fmph.uniba.sk/dbreport/GlassDB_first_version_that_glassfish_refuses.zip Attempt to deploy this project on the Glassfish server resulted in the following log: http://kempelen.ii.fmph.uniba.sk/dbreport/serverlog_after_first_deploy_that_glassfish_refuses.txt Based on your hint, I modified persistence.xml and replaced jdbc/glassdb with java:app/jdbc/glassdb Attempt to deploy ended up the same: http://kempelen.ii.fmph.uniba.sk/dbreport/serverlog_with_modifed_persistence.xml.txt Then I modified also the file glassfish-resources.xml, where jdbc/glassdb was replaced for java:app/jdbc/glassdb but the same outcome: http://kempelen.ii.fmph.uniba.sk/dbreport/serverlog_with_modified_glassfish-resources.xml.txt Of course, manually adding the jdbc pool and resource on the server through admin console will fix it, but I guess that is not how the things should work. Any other hints?
(In reply to PavelInNetbeans from comment #34) > Petr: not sure what you mean and if the question was for me. > Now I have done the following steps from scratch: > > 1. on a server, from mysql console entered the following: > > mysql> create database glassfish charset utf8 collate utf8_slovak_ci; > mysql> GRANT ALL ON glassfish.* TO 'glassfish'@'localhost' identified by > mysql> GRANT ALL ON glassfish.* TO 'glassfish'@'%' identified by 'heslo'; > > mysql> create table glassfish (id int primary key auto_increment, label > varchar(100), property varchar(100)); > > 2. created a simple web application in NetbeansEE, added new Persistence > Unit and new connection to this database called jdbc/glassdb, > all connections worked from Glassfish ok > > 3. automatically added Entity from table - Glassfish correctly connected > to database and retrieved the structure of the table > > 4. added the jsf managed request-scope bean and implemented an insert() > method addressed from the webapplication > > The resulting Netbeans project is here: > > http://kempelen.ii.fmph.uniba.sk/dbreport/ > GlassDB_first_version_that_glassfish_refuses.zip > > Attempt to deploy this project on the Glassfish server resulted in the > following log: > > http://kempelen.ii.fmph.uniba.sk/dbreport/ > serverlog_after_first_deploy_that_glassfish_refuses.txt > > Based on your hint, I modified persistence.xml and replaced > jdbc/glassdb > with > java:app/jdbc/glassdb > > Attempt to deploy ended up the same: > > http://kempelen.ii.fmph.uniba.sk/dbreport/serverlog_with_modifed_persistence. > xml.txt > > Then I modified also the file glassfish-resources.xml, where > jdbc/glassdb > was replaced for > java:app/jdbc/glassdb > > but the same outcome: > http://kempelen.ii.fmph.uniba.sk/dbreport/serverlog_with_modified_glassfish- > resources.xml.txt > > Of course, manually adding the jdbc pool and resource on the server through > admin console will fix it, but I guess that is not how the things should > work. > > Any other hints? I'll try that I have tested the test case in comment #28. BTW I believe it won't work in your step 2 theoretically. The persistence unit was not used so it wont fail, but I believe step 3 and 4 does not really change anything except actually using the DS.
Thanks. The same behavior as in comment #28 has been fixed at my setup by manually creating that whatever__pm resource and then also the whatever__nontx resource from Glassfish admin console. Somehow Netbeans fails to create these on deploy automatically.
(In reply to PavelInNetbeans from comment #36) > Thanks. The same behavior as in comment #28 has been fixed at my setup by > manually creating that whatever__pm resource and then also the > whatever__nontx resource from Glassfish admin console. Somehow Netbeans > fails to create these on deploy automatically. Well, I believe it is a problem of application scoped resources created by NB being prefixed by java:app/. If you are interested see: http://docs.oracle.com/cd/E18930_01/html/821-2417/giydj.html http://blog.pinateknoloji.com/glassfishapplication-scoped-resources
Interesting. Based on the second link I modified also the pool name as follows pool-name="java:app/mysql_glassfish_glassfishPool" in glassfish-resources.xml file, but still getting the same outcome.
*** Bug 245300 has been marked as a duplicate of this bug. ***
(In reply to PavelInNetbeans from comment #38) > Interesting. Based on the second link I modified also the pool name as > follows > > pool-name="java:app/mysql_glassfish_glassfishPool" > > in glassfish-resources.xml file, but still getting the same outcome. What server version and IDE version do you use?
(In reply to Petr Hejl from comment #40) > (In reply to PavelInNetbeans from comment #38) > > Interesting. Based on the second link I modified also the pool name as > > follows > > > > pool-name="java:app/mysql_glassfish_glassfishPool" > > > > in glassfish-resources.xml file, but still getting the same outcome. > > What server version and IDE version do you use? Ok now I see it in your previous post. Can you try the dev build? Your project works ok for me as it actually does not use the app scoped resources. It really might be a bug in resource deployment which has been fixed recently. Thanks in advance.
Fixed in web-main 547e9ea5d5dc. Please verify.
What is the meaning of "Fixed in web-main 547e9ea5d5dc"? The last dev version is 201505120001. As i said the bug was not fixed in the version 201505040001.
(In reply to ricg from comment #43) > What is the meaning of "Fixed in web-main 547e9ea5d5dc"? The last dev > version is 201505120001. Mercurial repository and revision.
Thanks Petr Hejl. So the fix is not yet included in the dev builds we can download from the Web site of NetBeans?
(In reply to ricg from comment #45) > Thanks Petr Hejl. So the fix is not yet included in the dev builds we can > download from the Web site of NetBeans? The message about integration to the daily build should appear here in a day or so. Let me know whether the fix works for you.
Reply to Petr comment #41: - uninstalled Netbeans from my win7 machine - downloaded and installed latest dev version (build 201505120001) of Netbeans - added my remote Glassfish server to this new installation, and updated the properties of the project - clean&build ok - deploy - same outcome - removed those java:app/ strings from the xml config files - clean&build - deploy - same outcome (java.lang.RuntimeException: Invalid resource : jdbc/glassdb__pm) do I have to reinstall also the Glassfish 4.1 on the Linux server (it is build13, 32bit)
(In reply to PavelInNetbeans from comment #47) > Reply to Petr comment #41: > > - uninstalled Netbeans from my win7 machine > - downloaded and installed latest dev version (build 201505120001) of > Netbeans > - added my remote Glassfish server to this new installation, and updated the > properties of the project > - clean&build ok > - deploy - same outcome > - removed those java:app/ strings from the xml config files > - clean&build > - deploy - same outcome > (java.lang.RuntimeException: Invalid resource : jdbc/glassdb__pm) > > do I have to reinstall also the Glassfish 4.1 on the Linux server > (it is build13, 32bit) Ok, I believe the key part may be the _remote_ instance. Can you test your project with local GF? Your project worked perfectly in such setup for me....
That is a bit strange, because it does the same thing also on the local Glassfish 4.1. that was bundled with the Netbeans that I have downloaded. I downloaded the full version of Netbeans. The server log when I select the local glassfish server is here: http://kempelen.ii.fmph.uniba.sk/dbreport/local_glassfish_server_log.txt
(In reply to PavelInNetbeans from comment #49) > That is a bit strange, because it does the same thing also on the local > Glassfish 4.1. that was bundled with the Netbeans that I have downloaded. > I downloaded the full version of Netbeans. > > The server log when I select the local glassfish server is here: > > http://kempelen.ii.fmph.uniba.sk/dbreport/local_glassfish_server_log.txt Believe me or not, it really worked for me. I'll try your project on Windows. Would be great if you could test your setup from scratch in daily build (creating the project in that build) with fresh GF.
of course I trust what you say, that is why it is strange. I did what you suggested, and here is the new server log: http://kempelen.ii.fmph.uniba.sk/dbreport/local_glassfish_server_log_created_with_new_Netbeans.txt and the project: http://kempelen.ii.fmph.uniba.sk/dbreport/GlassDB2.zip at least now we know we do not have to reinstall the Linux server to try to tackle the issue.
Integrated into 'main-silver', will be available in build *201505130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/547e9ea5d5dc User: Petr Hejl <phejl@netbeans.org> Log: #233481 - [74cat] Cannot deploy module accessing SQL Server to GlassFish 4.0
PavelInNetbeans can you test with 201505130001 dev build? I've just realized that you were testing with 8.0 where there was a bug possibly fixed by Tomas and later you have tested the dev build yet without my fix for app scoped resources. I've just tested your scenarion from scratch including creation of mysqldb and everything worked perfectly with 201505130001 dev build.
I have also tested the old setup without application scoped resources (glassfish-resources.xml in setup folder, presistence unit without java:app/ prefix) and it worked for me as well. Using dev build and local GF 4.1.
Created attachment 153630 [details] test project with app scoped resources My test setup for reference.
Have you tried on Windows?
Product Version: NetBeans IDE 8.0.2 (Build 201411181905) Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 1 Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02 Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14 System: Mac OS X version 10.10.3 running on x86_64; UTF-8; en_US (nb) GlassFish Server 4.1 Same issue with a wizard generated Web Application + RESTsful Web Services from Database. As explained in http://docs.oracle.com/cd/E18930_01/html/821-2417/giydj.html I know this doc is about GF 3.1 but seems to apply to 4.1: 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. According to this description, I moved manually the glassfish-resources.xml from setup/ directory to web/WEB-INF Then, the solution can be 1) The wizard RESTsful Web Services from Database detects it is working on a Web Application and places the glassfish-resources.xml in web/WEB-INF folder or 2) the deployment task takes care of this.
Downloaded Netbeans version from today (may13) and did the following: 1. deploying the project created yesterday on remote server: Exception while preparing the app : Invalid resource : jdbc/dbglass__pm 2. deploying at local Glassfish: same outcome. BTW. I get the following warning during build, not sure what this means: warning: Supported source version 'RELEASE_6' from annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' less than -source '1.8' 3. Trying with your linked project: It works, deploy OK!!! 4. Looking at the differences between the projects, and here it is: The "java:app/" prefix should only appear in persistence.xml. The same identifiers "jdbc/glassDB" should not be prefixed with "java:app/" in the attributes "jndi-name" and "pool-name" in the tag jdbc-resource in file glassfish-resources.xml. 5. making this only change also in my project from yesterday: Yes, it works, deploy OK! (then I get some transaction error when running, but that is something completely different I suppose, not related, not bug). Thanks for the help!. I should also try 1. if project created in this may13 version of Netbeans will behave ok automatically without manual edit of persistence.xml and 2. if this manual change will fix the issue also in usual Netbeans, older than from today. Will report here later.
Answer to question #1 from previous post: yes, doing exactly the same steps in Netbeans version from May 13 as was done in version from May 12 results in different outcome: version May 12: deploy unsuccessful, Exception in server log version May 13: deploy OK, application launched thanks.
(In reply to Javi12 from comment #57) > Then, the solution can be 1) The wizard RESTsful Web Services from Database > detects it is working on a Web Application and places the > glassfish-resources.xml in web/WEB-INF folder or 2) the deployment task > takes care of this. Both cases are implemented though there were bugs obviously. Please test with the latest build.
(In reply to PavelInNetbeans from comment #58) > 4. Looking at the differences between the projects, and here it is: > > The "java:app/" prefix should only appear in persistence.xml. > The same identifiers "jdbc/glassDB" should not be prefixed with > "java:app/" in the attributes "jndi-name" and "pool-name" in > the tag jdbc-resource in file glassfish-resources.xml. > Thanks a lot for all your testing! However I'm bit confused. In case the resources are app scoped (in WEB-INF) the java:app/ prefix in glassfish-resources.xml is optional and harmless - if it is not there GF prefixes it automatically. I've just tested that and it works with resource jndi name and pool name prefixed or not prefixed. The only case where it does not work for me is when there is unprefixed resource name in persistence.xml. Can you share the project from yesterday you refer to? Thanks a lot.
...and for completeness, the answer to question 2 from comment#58: - no, with the currently officially available Netbeans 8.0.2, prepending the jta-data-source in persistence.xml with java:app/ results in: Exception while preparing the app : Invalid resource : { ResourceInfo : (jndiName=java:app/jdbc/glassdb4__pm), (applicationName=glassdb4) } Thus the only workaround that worked for me for the officially released Netbeans is in comment#32. Hoping for a new official release soon as this has serious impact on using ORM for many JavaEE learners. In fact, we were stuck on this for several months. Have a nice day.
(In reply to Petr Hejl from comment #61) > (In reply to PavelInNetbeans from comment #58) > > 4. Looking at the differences between the projects, and here it is: > > > > The "java:app/" prefix should only appear in persistence.xml. > > The same identifiers "jdbc/glassDB" should not be prefixed with > > "java:app/" in the attributes "jndi-name" and "pool-name" in > > the tag jdbc-resource in file glassfish-resources.xml. > > > Thanks a lot for all your testing! However I'm bit confused. In case the > resources are app scoped (in WEB-INF) the java:app/ prefix in > glassfish-resources.xml is optional and harmless - if it is not there GF > prefixes it automatically. I've just tested that and it works with resource > jndi name and pool name prefixed or not prefixed. The only case where it > does not work for me is when there is unprefixed resource name in > persistence.xml. Can you share the project from yesterday you refer to? > Thanks a lot. You are right, that's really funny, but when I ran the old project after install of May13 version, it could not deploy, I editted based on the difference I found, and then it did deploy in May13 version. Obviously, I did rebuild the project in point 1 and 2 in comment#58, and really the only change I made was as mentioned, but now putting it back still leads to a running project. I suppose the rebuild in step 1 and 2 did not rebuild everything until there was a modification in that source xml file (?). Not sure what happened, but I confirm: yes when the prefix "java:app/" is in glassfish-resources.xml in front of both the jndi resource and pool, it deploys and runs ok. So this falsifies the inductive conclusions made in pt.4 of comment#58, thanks.
And a final note on pt.5 in comment#58 about that transaction problem: it was only due to the missing name="glassfish" (capitalization difference!) in @Table annotation. In fact this is also a sort of bug, because that annotation was done through wizzard (Entity class from database), so the wizzard should have noticed the capitalization difference in the table name and should have added the name="glassfish" attribute to the @Table association (it only made @Table(catalog = "glassfish", schema = "") which was not sufficient, and there was an error in server.log that table named GLASSFISH was not found. But that is all another story, and after all one should not expect too much from a wizzard. So all in all, if I understand of what happened in the fix: There were two problems: 1. wizzard placing the glassfish-resources.xml in a different folder 2. missing java:app/ in persistence.xml Many thanks for fixing it.
(In reply to PavelInNetbeans from comment #64) > And a final note on pt.5 in comment#58 about that transaction problem: it > was only due to the missing name="glassfish" (capitalization difference!) in > @Table annotation. > In fact this is also a sort of bug, because that annotation was done through > wizzard (Entity class from database), so the wizzard should have noticed the > capitalization difference in the table name and should have added the > name="glassfish" attribute to the @Table association (it only made > @Table(catalog = "glassfish", schema = "") > which was not sufficient, and there was an error in server.log that table > named GLASSFISH was not found. But that is all another story, and after all > one should not expect too much from a wizzard. I believe I saw this already reported but IIRC it was not really easy to fix. > > So all in all, if I understand of what happened in the fix: > There were two problems: > 1. wizzard placing the glassfish-resources.xml in a different folder > 2. missing java:app/ in persistence.xml > Many thanks for fixing it. I'm glad it works now. Thanks for your help. Closing as fixed. Others please verify as well.
Hi, Unfortunately, the last built loaded on may 12, 2015 was not working yet :( I have 25 students not convinced about Nebtbeans and they choose another way (not so easy and not professional as well) but it was a good way to identify students who are enough invested to understand the underlying technology. Hopping next time, I will be able to propose Netbeans as IDE. Many thanks for your work. Regards, Anne-Marie
Anne-Marie, can you try the 13 May version (see comment 59)?
Integrated into 'main-silver', will be available in build *201505210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/abcbf6ca434c User: Petr Hejl <phejl@netbeans.org> Log: #233481 - [74cat] Cannot deploy module accessing SQL Server to GlassFish 4.0
I have just tried and it is better but not perfect. If I reproduce the procedure written in the attachment "Procedure to reproduce the problem", the jndi-name used in glassfish-resources.xml and persistence.xml (both generated automatically by NetBeans) is prefixed with **java:module** and I receive this error message when I deploy the project : org.glassfish.deployment.common.DeploymentException: Failue while processing glassfish-resources.xml(s) in the archive -- Resource [ java:module/jdbc/TestBugResource-glassfish ] is not allowed to specify the scope [ java:module/ ]. Acceptable scope for this resource is [ java:app/ ] at org.glassfish.resources.admin.cli.ResourcesXMLParser.getScopedName(ResourcesXMLParser.java:529) ... No error during the deployment if I replace java:module by java:app in both files.
(In reply to ricg from comment #69) > I have just tried and it is better but not perfect. > > If I reproduce the procedure written in the attachment "Procedure to > reproduce the problem", the jndi-name used in glassfish-resources.xml and > persistence.xml (both generated automatically by NetBeans) is prefixed with > **java:module** and I receive this error message when I deploy the project : > org.glassfish.deployment.common.DeploymentException: Failue while processing > glassfish-resources.xml(s) in the archive -- Resource [ > java:module/jdbc/TestBugResource-glassfish ] is not allowed to specify the > scope [ java:module/ ]. Acceptable scope for this resource is [ java:app/ ] > at > org.glassfish.resources.admin.cli.ResourcesXMLParser. > getScopedName(ResourcesXMLParser.java:529) > ... > > No error during the deployment if I replace java:module by java:app in both > files. Do you use EAR or WAR/JAR? The trouble is that if it is not prefixed it is being resolved on deployment depending whether it is module inside EAR or standalone app. I guess we will need some user interaction regarding JNDI namespaces.
I created a Web project. And if you prefixed by java:app (instead of java:module), are there cases where it does not work?
(In reply to ricg from comment #71) > I created a Web project. > > And if you prefixed by java:app (instead of java:module), are there cases > where it does not work? Unfortunately yes. The web project inside EAR can't define java:app scoped resources.
Ok, while the GF doc is not clear about that it works this way: - If module is part of the EAR it can define resource in java:module and must not define resource in java:app - If module is standalone it can define resource in java:app and must not define resource in java:module. The trouble is IDE does not know it as the user may deploy the module as part of the EAR or standalone.
I have changed the default to java:app for now as usage of standalone module is much more common - web-main c7a0ea4b4c46.
Integrated into 'main-silver', will be available in build *201506040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/c7a0ea4b4c46 User: Petr Hejl <phejl@netbeans.org> Log: #233481 - [74cat] Cannot deploy module accessing SQL Server to GlassFish 4.0
I have improved heuristic of determining the default namespace - web-main cc705aac08b7.
Integrated into 'main-silver', will be available in build *201506110001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/cc705aac08b7 User: Petr Hejl <phejl@netbeans.org> Log: #233481 - [74cat] Cannot deploy module accessing SQL Server to GlassFish 4.0
One more improvement b3944dddef3d.
Hopefully good enough fix - web-main fe7bd1e23fec.
Integrated into 'main-silver', will be available in build *201506121907* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/b3944dddef3d User: Petr Hejl <phejl@netbeans.org> Log: #233481 - [74cat] Cannot deploy module accessing SQL Server to GlassFish 4.0
I believe it is not fixed. I faced the same problem when following this tutorial steps. https://netbeans.org/kb/docs/web/mysql-webapp.html After step 7 in section Preparing Communication between the Application and Database where we check the resources tree in Glassfish, I don't see the web application defined data source and connection pool. I then use teh asadmin to deploy those resources and then I could see the resources.
Sorry forgot to add environment details Product Version: NetBeans IDE Dev (Build 201509140002) Java: 1.8.0_60-ea; Java HotSpot(TM) 64-Bit Server VM 25.60-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_60-ea-b25 System: Mac OS X version 10.10.5 running on x86_64; UTF-8; en_US (nb)
(In reply to manikantannaren from comment #81) > I believe it is not fixed. I faced the same problem when following this > tutorial steps. https://netbeans.org/kb/docs/web/mysql-webapp.html > > > After step 7 in section Preparing Communication between the Application and > Database where we check the resources tree in Glassfish, I don't see the web > application defined data source and connection pool. These are now application scoped (placed in WEB-INF) and thus not visible in the tree although they are deployed successfully. I filed issue #255304.