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 242081 - Generate entities from table broken for WildFly
Summary: Generate entities from table broken for WildFly
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: WildFly (show other bugs)
Version: 8.0
Hardware: Macintosh Mac OS X
: P1 normal with 1 vote (vote)
Assignee: ehsavoie
URL:
Keywords:
: 242916 243101 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-19 09:04 UTC by pggeldenhuys
Modified: 2014-03-24 02:24 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (78.54 KB, text/plain)
2014-02-19 09:05 UTC, pggeldenhuys
Details
After completing connection wizard (60.15 KB, image/png)
2014-02-19 09:06 UTC, pggeldenhuys
Details
Netbeans message log (24.66 KB, application/octet-stream)
2014-03-18 17:45 UTC, ronzon
Details
After creating new connection -- No tables show (64.11 KB, image/pjpeg)
2014-03-18 17:48 UTC, ronzon
Details
Database is present (57.16 KB, image/pjpeg)
2014-03-18 17:53 UTC, ronzon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pggeldenhuys 2014-02-19 09:04:58 UTC
I have a maven based ejb JavaEE7 project with WildFly 8.0-Final registered as the app server.

I am unable to generate enitities from tables. I have tried derby and postgres. I can generate entities from tables on my glassfish non maven based project for both db's.

Also note, in the wildfly maven project when I click on generate entities from tables, select one of the configured jndi datasources retrieved from wildfly (both derby and postgres), the new connection wizard pops up even if the connection exists already in the ide. 

The ide log throws the following error when I add the postgresql from the connection wizard:
WARNING [org.openide.filesystems.FileUtil]: Parameter file was not normalized. Was C:/Program Files/MySQL(class java.io.File) instead of /C:/Program Files/MySQL(class java.io.File)
INFO [org.openide.filesystems.FileUtil]: Parameter file was not normalized. Was C:/Program Files/MySQL(class java.io.File) instead of /C:/Program Files/MySQL(class java.io.File)
java.lang.IllegalArgumentException: Parameter file was not normalized. Was C:/Program Files/MySQL(class java.io.File) instead of /C:/Program Files/MySQL(class java.io.File)
	at org.openide.filesystems.FileUtil.toFileObject(FileUtil.java:869)
	at org.netbeans.modules.db.mysql.installations.WindowsStandaloneMultiInstallation.getInstallations(WindowsStandaloneMultiInstallation.java:70)
	at org.netbeans.modules.db.mysql.impl.InstallationManager.detectAllInstallations(InstallationManager.java:126)
	at org.netbeans.modules.db.mysql.impl.InstallationManager.detectInstallation(InstallationManager.java:154)
	at org.netbeans.modules.db.mysql.impl.ServerNodeProvider.findAndRegisterInstallation(ServerNodeProvider.java:156)
	at org.netbeans.modules.db.mysql.impl.ServerNodeProvider.findAndRegisterMySQL(ServerNodeProvider.java:145)
	at org.netbeans.modules.db.mysql.impl.ServerNodeProvider.initialize(ServerNodeProvider.java:105)
	at org.netbeans.api.db.explorer.node.NodeProvider.getNodes(NodeProvider.java:107)
	at org.netbeans.modules.db.explorer.node.NodeRegistry.getNodes(NodeRegistry.java:171)
	at org.netbeans.api.db.explorer.node.ChildNodeFactory.createKeys(ChildNodeFactory.java:108)
	at org.openide.nodes.AsynchChildren.run(AsynchChildren.java:209)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

Weird, since im on osx, looking at the windows based file paths and not registering a mysql driver/connection.

And this when I add the derby connection:
INFO [org.netbeans.modules.db.explorer.DatabaseConnection]: Unable to execute command:
set schema 
Syntax error: Encountered "<EOF>" at line 1, column 10.
org.netbeans.lib.ddl.DDLException: Unable to execute command:
set schema 
Syntax error: Encountered "<EOF>" at line 1, column 10.
	at org.netbeans.lib.ddl.impl.AbstractCommand.execute(AbstractCommand.java:244)
	at org.netbeans.modules.db.explorer.node.DDLHelper.setDefaultSchema(DDLHelper.java:62)
	at org.netbeans.modules.db.explorer.DatabaseConnection.setDefaultSchema(DatabaseConnection.java:647)
[catch] at org.netbeans.modules.db.explorer.DatabaseConnection.doConnect(DatabaseConnection.java:903)
	at org.netbeans.modules.db.explorer.DatabaseConnection.access$200(DatabaseConnection.java:103)
	at org.netbeans.modules.db.explorer.DatabaseConnection$3.run(DatabaseConnection.java:961)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
INFO [org.netbeans.modules.db.explorer.DatabaseConnection]: Unable to execute command:
set schema 
Syntax error: Encountered "<EOF>" at line 1, column 10.
org.netbeans.lib.ddl.DDLException: Unable to execute command:
set schema 
Syntax error: Encountered "<EOF>" at line 1, column 10.
	at org.netbeans.lib.ddl.impl.AbstractCommand.execute(AbstractCommand.java:244)
	at org.netbeans.modules.db.explorer.node.DDLHelper.setDefaultSchema(DDLHelper.java:62)
	at org.netbeans.modules.db.explorer.DatabaseConnection.setDefaultSchema(DatabaseConnection.java:647)
[catch] at org.netbeans.modules.db.explorer.DatabaseConnection.doConnect(DatabaseConnection.java:903)
	at org.netbeans.modules.db.explorer.DatabaseConnection.access$200(DatabaseConnection.java:103)
	at org.netbeans.modules.db.explorer.DatabaseConnection$3.run(DatabaseConnection.java:961)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
INFO [glassfish]: Requested Entity: public id = -//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN, system id = http://glassfish.org/dtds/glassfish-resources_1_5.dtd

Product Version = NetBeans IDE 8.0 Beta (Build 201401141042)
Operating System = Mac OS X version 10.9.1 running on x86_64
Java; VM; Vendor = 1.7.0_45
Runtime = Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Comment 1 pggeldenhuys 2014-02-19 09:05:03 UTC
Created attachment 145390 [details]
IDE log
Comment 2 pggeldenhuys 2014-02-19 09:06:02 UTC
Created attachment 145391 [details]
After completing connection wizard
Comment 3 ronzon 2014-03-18 16:21:10 UTC
I am experiencing the same issue using Netbeans 8 RC1 - WildFLy 8.Final - and  a MySQL database.  It is set up as a Maven project and I have the Wildfly plugin installed.  I have tried on both a Windows 7 machine and Windows 8.1.  SAME results each time.

Doesn't someone have an answer to this ???

Thank you.
Comment 4 ehsavoie 2014-03-18 16:31:39 UTC
To have this to 'work' you 'll have to define the driver in the netbeans database explorer and have the datasource dfined in Wildfly.
I try to 'guess' the driver since most of the time wildfly will use a datasource and not the 'pure' jbdc driver so the defined class name might be wrong.
Could you share your configuration so I could try to reproduce this ?
Comment 5 ronzon 2014-03-18 17:08:16 UTC
Using this page as reference:  http://wildfly.org/news/2014/02/06/GlassFish-to-WildFly-migration/
I first tried deploying the mysql driver to Wildfly. I was able to add the datasource, and it was visible in Netbeans, but when you try to select it in the "Create entity classes from database" -- it would come up and say driver was missing.

So....  I tried the second method instead:  I created the folder: WILDFLY_HOME/modules/system/layers/base/com/mysql/main   and placed the mysql-connector-java-5.1.23-bin.jar file there.

I created module.xml:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-5.1.23-bin.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

And executed this command via the Wildfly CLI:  

[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=mysql:add(
    driver-name=mysql,
    driver-module-name=com.mysql,
    driver-class-name=com.mysql.jdbc.Driver
)

It was successful.  

THEN, Using Wildfly management,  I was then able to add the JDBC datasource:  java:/jdbc/rdcapp20
This is now visible in Netbeans as a datasource.
When I try to add "Entity classes from database":
it does not automatically select any datasources, so I select (java:/jdbc/rdcapp20) and it immediately pops up with new connection wizard.  It does not have the password present, so I add that.  Next page -- Mysql doesn't have schemas, so that option is greyed out.  And I can create the new connection.  BUT --- It still does not populate with any available tables.
Comment 6 ronzon 2014-03-18 17:11:45 UTC
ALSO:  Just to be clear
I am using:
Netbeans 8.0 RC1
Wildfly plugin 1.0.10
Wildfly 8.0.0.Final Server
MySQL Community version 5.6.16

( I have already created a sample database in MySql called rdcapp20 )
Comment 7 ehsavoie 2014-03-18 17:13:15 UTC
Is the driver also installed in netbeans database explorer ?
Comment 8 ronzon 2014-03-18 17:21:25 UTC
Under Services, Databases, Drivers:
MySQL (Connector / J Driver) already shows there as standard.

Do I have to add the driver in again ?
Comment 9 ehsavoie 2014-03-18 17:32:16 UTC
I'm not sure as I tried with postgresql and h2 but not mysql.
Could you attach your log file ?
Comment 10 ronzon 2014-03-18 17:45:13 UTC
Created attachment 146118 [details]
Netbeans message log
Comment 11 ronzon 2014-03-18 17:45:58 UTC
I attached the message log...  BUT,  there aren't any errors that pop up.
I simply do not get any tables from the database showing up.
Comment 12 ronzon 2014-03-18 17:48:35 UTC
Created attachment 146120 [details]
After creating new connection -- No tables show
Comment 13 ronzon 2014-03-18 17:53:21 UTC
Created attachment 146122 [details]
Database is present

The database IS present.  If I choose CONNECT on the MySql server -- rdcapp20.  I can browse the database tables.

But, I believe this connection is DIRECT to MySQL, where I NEED it to be through the Wildfly Server connection pool, correct ????
Comment 14 ronzon 2014-03-18 18:37:28 UTC
I tried with a PostGreSQL database,  I get the same issue....
I must be missing something.
Comment 15 ehsavoie 2014-03-20 10:28:55 UTC
*** Bug 242916 has been marked as a duplicate of this bug. ***
Comment 16 ehsavoie 2014-03-20 15:22:54 UTC
*** Bug 243101 has been marked as a duplicate of this bug. ***
Comment 17 ehsavoie 2014-03-23 15:05:25 UTC
The XML parsing of the wildfly datasource missed the username thus preventing the correct working of this wizard.
Comment 18 Quality Engineering 2014-03-24 02:24:05 UTC
Integrated into 'main-silver', will be available in build *201403240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2a82bebb044b
User: Emmanuel Hugonnet <ehsavoie@netbeans.org>
Log: Fixing issue #242081 where not having the username blocks the JNDI datasource usge for generating Entities from schema.