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.
[ BUILD # : 200905080201 ] [ JDK VERSION : 1.6.* ] 0) register external copy of GlassFish 2.1 in NetBeans 1) create Postgres database, create JDBC resource in GlassFish 2) create enterprise project in NetBeans 3) in EJB sub-project, create persistence unit: take TopLink as default persistence provider, GlassFish JDBC data source is recognized and used 4) right-click EJB sub-project and select "Entity classes from database". 5) select same JDBC data source from step 3) 6) error dialog appears: "Unable to find the driver. Register this driver in the databases tab." The driver in NetBeans (ide11/modules/ext/postgresql-8.3-603.jdbc3.jar) is the same one I put in the lib/ directory of my GlassFish install.
I noticed something unusual in the tooltip I see when I hover over the selection I am about to make (see attached screenshot). Note that the database URL starts with "null" and has no name for that JDBC driver class name. What does this mean?
Created attachment 82006 [details] screen shot
postrge installed failed to install database on my system, may need more time for evaluation.
I'm able to reproduce on 6.7 but with another error message (with 8.4-701 driver), but in nb 6.8 I'm able to create entities from postresql database. Seems fixed for me, resoleve as worksforme, but feel free to reopen, can you try 6.8 to verify?
I mean 8.4-701 in gf environment, but nb still use 8.3-603. so it may work with 8.3-603 in both places.
I still see the same behavior with build 200910100201 (just like the screenshot I posted).
ok, thanks, have you tried newer driver? can you provide information regarding your database and you settings in glassfish resources? (may be all steps to create resource on gf side). I will try again later too.
I am still seeing this problem with Netbeans 7.0 and Glassfish 3.1. I tried updating the JDBC driver to the latest version (9.0-801.jdbc4) because of comment #7, but this made no difference. I saw the problem after following essentially the same steps as the original poster, except: - I used the version of Glassfish that is bundled with Netbeans. - I created a Java EE 6 web project rather than an enterprise project. I'm not sure what specific information comment #7 is requesting, but basically I created the resource through the Glassfish web admin system. I created a JDBC resource jdbc/myresource pointing to MyResourcePool and with no additional properties. The pool's properties are all defaults except: Resource Type: javax.sql.DataSource Datasource Classname: org.postgresql.ds.PGSimpleDataSource I also set the User, DatabaseName, Password, and ServerName properties. (I tried setting the resource type to other things, but that didn't help.)
Is "org.postgresql.ds.PGSimpleDataSource" present in supplied driver? can you attach message.log?
Yes "org.postgresql.ds.PGSimpleDataSource" is present in postgresql-8.3-603.jdbc3.jar. I'll attach message.log. Thanks for your help.
Created attachment 108627 [details] messages.log This messages.log was generated when I: 1. opened the IDE, 2. opened the Java EE project that was showing the problem before, 3. attempted to add entity classes from the database, causing the bug to manifest, and 4. closed the project and the IDE.
ok, looks like datasource url either isn't configured properly or can't be calculated or just ide can't calculate and it's an issue as there is [glassfish-javaee]: Unable to compute database vendor name for datasource url. and it's likely have null: in url, as a woraround it may work to add full datasource url to db resources configuration on gf side. also as this is a warning from gf module, cc vkraemer@netbeans.org
I added a new property called URL, with value jdbc:postgresql:postgres. When I did that, the problem went away. Thanks! (IMHO this is still a bug that should be fixed, but this work-around makes it much less of a problem for me personally.)
What further information is needed for this issue?
please provide message.log if possible, and list of all propertied in datasource configuration, except password
When trying to reproduce it again, I was able to make it work by adding the URL parameter. I suppose I hadn't restarted either NetBeans or GlassFish when I tried that a few minutes ago. Is there any way to let the user know that this property must be added? The message "The name of the driver class for the datasource is missing" doesn't give any idea of what needs to be done to make it work. This is what I have (the URL parameter was added manually): <jdbc-connection-pool datasource-classname="org.postgresql.ds.PGPoolingDataSource" res-type="javax.sql.DataSource" name="hendrix"> <property name="User" value="cenbe"></property> <property name="DatabaseName" value="hendrix"></property> <property name="LogLevel" value="0"></property> <property name="Password" value="********"></property> <property name="Ssl" value="false"></property> <property name="ServerName" value="localhost"></property> <property name="ProtocolVersion" value="0"></property> <property name="MaxConnections" value="0"></property> <property name="InitialConnections" value="0"></property> <property name="TcpKeepAlive" value="false"></property> <property name="SocketTimeout" value="0"></property> <property name="PortNumber" value="5432"></property> <property name="LoginTimeout" value="0"></property> <property name="UnknownLength" value="2147483647"></property> <property name="PrepareThreshold" value="5"></property> <property name="URL" value="jdbc:postgresql://localhost:5432/hendrix"></property> </jdbc-connection-pool> <jdbc-resource pool-name="hendrix" jndi-name="jdbc/hendrix"></jdbc-resource> I've also attached a NetBeans log file generated during a failed attempt to create the entity classes (without the URL property in the GlassFish connection pool).
Created attachment 140059 [details] NetBeans log file
yes, message need to be changed, I'll reevaluate the issue a bit later. url is just another way to specify datasource, nb can handle it two ways.
some wizards should already contain expected url, some other messages like jpql editor may be another issue but with the same user side solution. for example for jpql message can be changed to "You need to register database connection on Services tab (expected url: {value}) or add URL property to your datasource with already registered jdbc url)" driver message is a bit anbother
org.netbeans.modules.glassfish.javaee.db.DbUtil may be more smart in url contruction for postgre etc. currently if tries to create missed url in case of derby only. but in fact persistence need more smart message and it's nice to have a better hint, as server plugin may always miss support for some db vendor and in this case fallback to url property should be required.
org.postgresql.ds.PGPoolingDataSour is recognized now and may be used with gf, I need more details for other cases, and may be filed as separate issues, I hope <jdbc-connection-pool datasource-classname="org.postgresql.ds.PGPoolingDataSource" res-type="javax.sql.DataSource" name="hendrix"> <property name="User" value="cenbe"></property> <property name="DatabaseName" value="hendrix"></property> <property name="LogLevel" value="0"></property> <property name="Password" value="********"></property> <property name="Ssl" value="false"></property> <property name="ServerName" value="localhost"></property> <property name="ProtocolVersion" value="0"></property> <property name="MaxConnections" value="0"></property> <property name="InitialConnections" value="0"></property> <property name="TcpKeepAlive" value="false"></property> <property name="SocketTimeout" value="0"></property> <property name="PortNumber" value="5432"></property> <property name="LoginTimeout" value="0"></property> <property name="UnknownLength" value="2147483647"></property> <property name="PrepareThreshold" value="5"></property> <property name="URL" value="jdbc:postgresql://localhost:5432/hendrix"></property> </jdbc-connection-pool> <jdbc-resource pool-name="hendrix" jndi-name="jdbc/hendrix"></jdbc-resource> should work now as I see proper url in tooltip, feel free to reopen if this configuration will not work. I decide to avoid general solution for now and support what should be supported in my opinion instead.
Integrated into 'main-silver', will be available in build *201312270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/4b4376b25aa4 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #164814 add "org.postgresql.ds.PGPoolingDataSource" as recognized by gf plugin