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.
1. Create the PetCatalog sample 2. Follow the instructions in setup/SETUP_INSTRUCTIONS.html => When you deploy the JDBC driver will not be deployed to domain1/lib, so the deployment will fail.
Assigning to myself
This is still stopper for 7.1.1 release or am I wrong?
Hmmm. I think Petr would have filed this against 7.1 or 7.1.1 if he felt that it should be a release stopper for 7.1.1... He probably would have set the priority to P1, also. Since he did not, I figured that this was not release stopper.
Well, the original issue 208706 was marked by QA engineer as release stopper for 7.1.1, so I don't see any reason why this shouldn't be a stopper as well (from the user point of view it's working in the same incorrect way - PetCatalog sample cannot be deployed to a GF 3.1.2). We should either fix the GF problem or comment the PetCatalog sample out.
Well, this bug has a workaround: create an application from scratch that uses a MySQL datasource (e.g. through JPA) and deploy it. This will correctly deploy the driver, so a subsequent deployment of the sample will succeed. So I don't think this is a stopper for 7.1.1.
It's up to you Petr. I don't think that user want to do all these stuffs just to be able to run one sample (and to be honest I don't believe that someone will be looking how-to workarround a sample). But that's just my opinion. Anyway feel free to remove '71patch1-candidate' tag.
I think we don't want to delay 7.1.1 (which is supposed to be out on Wednesday) just for this bug - right now the final build is available internally and there is no plan to rebuild. Of course if 7.1.1 is delayed, then we may want to consider it, but for that this would first need to be fixed in the trunk.
Created attachment 116145 [details] Exception shown when trying to run on GF 3.1.1 I've just tried to reproduce the issue with GF 3.1.1. Application could be build and deployed (which is not possible in GF 3.1.2), but after so there is an exception shown when trying to run the sample. See attached file for exception log.
Hmm, regarding issue 208747, comment 5 it might be a problem with my local setup. I'll look into this a little bit more.
Tomas, I'm sorry but I still can't get to the point when the sample will be runnable with GF 3.1.1., so I'm not able to say how it behave in 7.1 with GF 3.1.1. I can successfully deploy application, however it can't be run (because of the attached exception). Not sure if it's just because of my (somehow broken) configuration or if it wasn't working at all.
I was able to build and deploy sample on both GF 3.1.1 and 3.1.2 when I added mysql JDBC driver manually into the project (e.g. JDBC jar was in PetCatalog/build/web/WEB-INF/lib - project deployment directory). On GF 3.1.1 I was able to run sample without any problems. On GF 3.1.2 I saw Illegal state exception when running this sample and copying JDBC jar into domain1/lib fixed this problem. Also verified that JDBC driver library is not copied into domain1/lib by glassfish module with both GF 3.1.1 and 3.1.2. I'll try to debug and fix this.
I did some more testing and debugging with the help of local netbeans team. Finally we were able to get JDBC driver deployment working. We saw following issues: 1) org.netbeans.modules.glassfish.javaee.db.Hk2DatasourceManager.getDatasources(...) is searching for NetBeansProjects/PetCatalog/setup/glassfish-resources.xml But there is old sun-resources.xml file in sample project. 2) org.netbeans.modules.j2ee.common.DatasourceHelper.findDatabaseConnections(...) is trying to match database URL from application resources - jdbc:mysql://127.0.0.1:3306/petcatalog against database connections in Services:Databases where the same connection with the same URL must exist. Only then JDBC driver is deployed. I had to open this Services:Databases database connection with the same URL manually. Looks like there is no problem in JDBC driver deployment itself but PetCatalog sample may need some update to contain valid glassfish-resources.xml descriptor file and also to automatically open database connection with the same URL in netbeans.
> But there is old sun-resources.xml file in sample project. But should not the GlassFish plugin also consider this file for compatibility reasons? Shouldn't this continue to be supported even though it's old style? (Of course, we can update the sample as well.) > trying to match database URL from application resources ... against database connections in > Services:Databases We should at least print some information message if the URL can not be matched, so the user has some idea where the problem is. But I can understand why the IDE tried to match it - using Services:Databases, it can find the driver file location on the disk based on the database URL.
I checked deployment guide for 3.1.1 and there is glassfish-resources.xml listed. But I'm not the one who can decide if sun-resources.xml is still supported or not. Technically it's simple to try old file name when glassfish-resources.xml was not found. But PetCatalog sample should be updated to contain actual file name anyway. ad 2) Is it possible to open this database connection from sample project? If not, then setup/SETUP_INSTRUCTIONS.html should contain some information about JDBC driver deployment.
> Is it possible to open this database connection from sample project? The important question is whether the IDE can find the driver jar file. I see that the sample contains the following in the connection pool declaration: datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" Based on this, could we figure out that we need ide/modules/ext/mysql-connector-java-5.1.18-bin.jar? I see that org.netbeans.modules.j2ee.common.DatasourceHelper.findDatabaseConnections(...) works with org.netbeans.modules.j2ee.deployment.common.api.Datasource, which has getDriverClassName(), which is related, but not the same. Can this somehow be used to improve the detection? The j2ee.common module does not have a permanent owner, but Sergey Petrov is probably closest to this area, cc'ing Sergey. Sergey, any thoughts on how to do this?
(In reply to comment #14) > I checked deployment guide for 3.1.1 and there is glassfish-resources.xml > listed. > But I'm not the one who can decide if sun-resources.xml is still supported or > not. the sun-resources.xml file in the sample is not being used by the server... it is being used by the plugin, right? So the limitation of the deployment guide for 3.1.1 are not a final arbiter of the correct answer in this case. > Technically it's simple to try old file name when glassfish-resources.xml was > not found. We should do this. > But PetCatalog sample should be updated to contain actual file name > anyway. That should also happen.
(In reply to comment #15) > > Is it possible to open this database connection from sample project? > > The important question is whether the IDE can find the driver jar file. I see > that the sample contains the following in the connection pool declaration: > datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" > > Based on this, could we figure out that we need > ide/modules/ext/mysql-connector-java-5.1.18-bin.jar? > > I see that > org.netbeans.modules.j2ee.common.DatasourceHelper.findDatabaseConnections(...) > works with org.netbeans.modules.j2ee.deployment.common.api.Datasource, which > has getDriverClassName(), which is related, but not the same. Can this somehow > be used to improve the detection? > > The j2ee.common module does not have a permanent owner, but Sergey Petrov is > probably closest to this area, cc'ing Sergey. Sergey, any thoughts on how to do > this? It looks like the GF plugin expects the DB Connection to be registered in the IDE... If the DB Connection isn't registered the plugin cannot conjure up the connection between a classname and a jar file. The primary plugin files for this is glassfish.javaee/.../JDBCDriverDeployerImpl.java, glassfish.eecommon/.../JDBCDriverDeployHelper.java
So what do I need to do? I mean from the Samples point of view. I understand that sun-resources.xml need to be change to glassfish-resources.xml. But I'm not so sure if it's only file name which need to changed or if I have to update the descriptor itself as well.
Regarding requirement to have connection registered, quite a lot of code require connections to be registered as registered connection contain full information required to connect db. But sometimes it's possible to request connection registration from user with appropriate dialog but I'm not sure it's possible from samples infrastructure as I'm not sure how samples are handled by nb.
As NB 7.1 Patch 1 is above to be releases, re-targeting for Patch 2
2nd point regarding connection, if connection isn't properly registered there should be warning about problems with datasource resource registration, and resolve action should be available. But I see an issue here as after petCatalog creation I saw two isssues with server and with datasource but after server resolve I see no issues and datasource warning reapear only after ide restart (I'm in 7.1+gf3.1.1)
Reopened bug# 208747 to request rename of sun-resources.xml and to add information about database connection that is required for JDBC driver deployment into setup/SETUP_INSTRUCTIONS.html I implemented some changes into GF module to make this code a bit more foolproof. Now waiting for Vince to review the diffs.
changeset: 215310:9391432a9f3d user: Tomas Kraus <TomasKraus@netbeans.org> files: glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2Configuration.java glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Three1Configuration.java glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/db/Hk2DatasourceManager.java glassfish.javaee/test/unit/src/org/netbeans/modules/glassfish/javaee/db/Hk2DatasourceManagerTest.java description: Bug# 208747 - Resource files may be both glassfish-resources.xml and sun-resources.xml. File sun-resources.xml is read only when glassfish-resources.xml was not found. changeset: 215311:72e0f41ae047 user: Tomas Kraus <TomasKraus@netbeans.org> files: glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/JDBCDriverDeployHelper.java description: Bug# 208747 - Fallback JDBC driver deployment using resource driver class without configured database connection. changeset: 215312:322cecaaf29a user: Tomas Kraus <TomasKraus@netbeans.org> files: glassfish.javaee/test/unit/data/178776/glassfish-resources.xml glassfish.javaee/test/unit/data/178776/sun-resources.xml description: Bug# 208747 - Rename sun-resources.xml to glassfish-resources.xml in GlassFish Java EE module test
Switching to resolved state to get trunk verification.
Verified in trunk build 201203210400.
Tomas, please proceed with integration into release71_fixes branch and follow http://wiki.netbeans.org/NetBeansPatchesProcess . Thanks in advance.
changeset: 224305:529caa69e87d branch: release71_fixes user: Tomas Kraus <TomasKraus@netbeans.org> date: Mon Apr 02 18:04:29 2012 +0200 summary: Bug# 208830 - Module version number increased and Long Description updated. changeset: 224187:d15ca2c6c69d branch: release71_fixes parent: 224019:1cd789733390 user: Tomas Kraus <TomasKraus@netbeans.org> date: Mon Apr 02 17:16:51 2012 +0200 summary: Bug# 208830 - JDBC driver deployment does not work for sample project pushing to https://TomasKraus:***@hg.netbeans.org/releases searching for changes remote: added 4 changesets with 3 changes to 3 files