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 133124

Summary: NullPointerException at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardPanel.fillDatabaseTable
Product: javaee Reporter: csmart <csmart>
Component: HibernateAssignee: Vadiraj Deshpande <vadirajvd>
Status: RESOLVED FIXED    
Severity: blocker CC: alcmontejo, gowri, kganfield, psysephiroth
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=43598
Issue Type: DEFECT Exception Reporter: 43598
Attachments: stacktrace
stacktrace
stacktrace
stacktrace

Description csmart 2008-04-17 15:54:08 UTC
Build: NetBeans IDE 6.1 RC1 (Build 200804100130)
VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_05-b13
OS: Windows XP, 5.1, x86

User Comments:
Comment 1 csmart 2008-04-17 15:54:12 UTC
Created attachment 60350 [details]
stacktrace
Comment 2 Vadiraj Deshpande 2008-05-11 10:00:19 UTC
I guess this is in case of creating a mapping file with malformed configuration.
Can you please attach your configuration (.cfg.xml) file that you selected on the wizard ? Thnx
Comment 3 josiahhaswell 2008-05-29 19:55:11 UTC
Created attachment 62135 [details]
stacktrace
Comment 4 _ gowri 2008-05-29 23:08:10 UTC
reassigning...
Comment 5 Exceptions Reporter 2008-06-04 18:04:35 UTC
This issue has already 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=43598
Comment 6 _ gowri 2008-06-04 18:57:26 UTC
I am not able to reproduce this bug. Please attach either the project or the steps to reproduce. 
I want to know what db you are using and hibernate.cfg.xml file. It could be possible that you have a corrupted
configuration. Please open it with some steps. Till then marking it as works for me.

Comment 7 psysephiroth 2008-08-12 16:31:26 UTC
I have been experiencing this as well. For me, this problem persists after reinstall of the entire IDE. I am using
Netbeans 6.1 with the hibernate plugin and hibernate 3 library. Upon trying to add a mapping file this error is thrown.
The config xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory name="newsession">
    <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@linus:1521:02</property>
    <property name="hibernate.connection.username">wiped for security</property>
    <property name="hibernate.connection.password">wiped for security</property>
  </session-factory>
</hibernate-configuration>

which is a direct result of the design view. I am connecting to an oracle 9i R2 database via the oracle 9i driver in
ojdbc14.jar. I think there is a problem with interpreting some kind of oracle request or response. The services tab
works perfectly; however, there is no success with the mapping file wizard.
Comment 8 psysephiroth 2008-08-12 16:57:23 UTC
This may be a database setup issue, digging through the data shows an oracle error "Maximum open cursors exceeded". How
many connections does netbeans open when using this plugin?
Comment 9 psysephiroth 2008-08-12 19:36:28 UTC
Build: NetBeans IDE 6.1 (Build 200805300101)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-b02, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b02
OS: Windows XP, 5.1, x86

User Comments: 
I believe I have discovered the root of the problem.

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardPanel.fillDatabaseTable(HibernateMappingWizardPanel.java:107)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardPanel.<init>(HibernateMappingWizardPanel.java:88)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardDescriptor.getComponent(HibernateMappingWizardDescriptor.java:74)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.createSteps(HibernateMappingWizard.java:265)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.getPanels(HibernateMappingWizard.java:103)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.current(HibernateMappingWizard.java:240)
Comment 10 psysephiroth 2008-08-12 19:36:38 UTC
Created attachment 67169 [details]
stacktrace
Comment 11 psysephiroth 2008-08-12 19:40:21 UTC
I have discovered the root of this issue. It is a problem when connecting to large databases. The hibernate plugin
attempts to read from all tables in the database at once (not just the schema to which you are connected) with a slew of
open cursors. This causes the user to exceed the maximum cursor limit and the database refuses further connections. The
solution is to ensure tables are only queried from a specific schema when trying to add a mapping file. This is a
serious error for users working with production level databases as the table count can reach the ten thousands and no
amount of system DBA settings will solve the problem.
Comment 12 psysephiroth 2008-08-12 20:01:33 UTC
I have attempted to discover a workaround by setting various hibernate properties, these have no effect on resolving the
error. I have also tried changing the syntax of the connection string and using the Oracle oci driver, no workaround was
found here either.
Comment 13 Vadiraj Deshpande 2008-08-12 20:25:29 UTC
There appears to be a bug in finding the correct schema for the given database details (from cfg file). Will provide the fix. 
Thanks for reporting the issue.
Comment 14 Vadiraj Deshpande 2008-08-12 20:27:57 UTC
There's unfortunately, no work around exists for this bug.
Comment 15 psysephiroth 2008-08-12 21:49:34 UTC
Wow speedy response, thanks
Comment 16 psysephiroth 2008-08-14 21:03:39 UTC
I have found a second problem in Netbeans 6.5 Beta that I believe is related to this issue. I have been unable to submit
an issue for it due to some error communicating with issuezilla; however, the exception is exception #: 64090. I was
trying to see if I would have any more luck with the hibernate module in netbeans 6.5 beta and tested the generation of
POJOs and mapping files. Unfortunately it threw an error (although it managed to complete the reveng.xml anyway, no
POJOs or mappings though, but I believe it is mentioned that this is not implemented yet). Delving into the errors the
two problems I saw were the "MAXIMUM CURSORS EXCEEDED" error as well as an insufficient privileges error. The first
error suggests the initial schema issue and the second error is very common to querying tables that do not belong to a
user. I suspect the schema selection is the problem again. Have you had any success with solving this?
Comment 17 alcmontejo 2008-09-19 11:19:26 UTC
Build: NetBeans IDE Dev (Build 200809180201)
VM: Java HotSpot(TM) Client VM, 1.6.0_02-b06, Java(TM) SE Runtime Environment, 1.6.0_02-b06
OS: Windows XP, 5.1, x86

User Comments:
alcmontejo: Occurs when I Click the Create hibernate mapping file on submenu.

Steps.
1. Right click the package.
2. Select Create Hibernate Mapping file on submenu.

GUEST: Tried to create a new Hibernate mapping file

GUEST: creating a new Hibernate mapping file from the menu.

GUEST: ${buildday}

GUEST: Attempting to create a new hibernate mapping file via the wizard results in this error.

GUEST: This problem persists after reinstall. I am using Netbeans 6.1 with the hibernate plugin and hibernate 3 library. Upon trying to add a mapping file this error is thrown. The config xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory name="newsession">
    <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@linus:1521:02</property>
    <property name="hibernate.connection.username">wiped for security</property>
    <property name="hibernate.connection.password">wiped for security</property>
  </session-factory>
</hibernate-configuration>

which is a direct result of the design view. I am co

psysephiroth: Attempting to apply a default schema still results in failure

psysephiroth: I believe I have discovered the root of the problem.

alcmontejo: Occurs when I Click the Create hibernate mapping file on submenu.

Steps.
1. Right click the package.
2. Select Create Hibernate Mapping file on submenu.



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardPanel.fillDatabaseTable(HibernateMappingWizardPanel.java:108)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardPanel.<init>(HibernateMappingWizardPanel.java:89)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardDescriptor.getComponent(HibernateMappingWizardDescriptor.java:74)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.createSteps(HibernateMappingWizard.java:297)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.getPanels(HibernateMappingWizard.java:115)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.current(HibernateMappingWizard.java:271)
Comment 18 Kenneth Ganfield 2008-09-23 16:38:24 UTC
Build: NetBeans IDE Dev (Build 200809220201)
VM: Java HotSpot(TM) 64-Bit Server VM, 1.6.0_05-b13-52, Java(TM) SE Runtime Environment, 1.6.0_05-b13-120
OS: Mac OS X, 10.5.4, x86_64

User Comments: 
using the new file wizard to create a hibernate mapping file

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardPanel.fillDatabaseTable(HibernateMappingWizardPanel.java:108)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardPanel.<init>(HibernateMappingWizardPanel.java:89)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizardDescriptor.getComponent(HibernateMappingWizardDescriptor.java:74)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.createSteps(HibernateMappingWizard.java:297)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.getPanels(HibernateMappingWizard.java:115)
        at org.netbeans.modules.hibernate.wizards.HibernateMappingWizard.current(HibernateMappingWizard.java:271)
Comment 19 Kenneth Ganfield 2008-09-23 16:38:29 UTC
Created attachment 70341 [details]
stacktrace
Comment 20 Vadiraj Deshpande 2008-09-24 13:36:56 UTC
There are two problems associated with this bug :
- Reading all database tables should be modified to query only tables under the given schema/catalog.
- Graceful handling of database operation exceptions and notification.
Comment 21 Vadiraj Deshpande 2008-09-25 19:19:14 UTC
Need to be fixed for 6.5
Comment 22 Vadiraj Deshpande 2008-10-07 22:58:36 UTC
Fixed : http://hg.netbeans.org/main/rev/2ee445f42d6a

Now the database tables are read using db api.