[hibernate-issues] [Hibernate-JIRA] Created: (HBX-918) Trouble configuring Hibernate Console Configuration

Joseph Marques (JIRA) noreply at atlassian.com
Thu Mar 15 20:33:09 EDT 2007


Trouble configuring Hibernate Console Configuration
---------------------------------------------------

         Key: HBX-918
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-918
     Project: Hibernate Tools
        Type: Bug

    Versions: 3.2beta10    
 Environment: HibernateTools-nodeps-3.2.0.200703151752-nightly
    Reporter: Joseph Marques


After I create the Hibernate Console Configuration, right-click it, and select "Create Session Factory" I get:

java.lang.NullPointerException
	at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:192)
	at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
	at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
	at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
	at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:54)
	at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:63)

After reading the source, it seems that line 192 expects the "Property file" element on the "Main" tab of the configuration to be present.  However, this does not seem to be a required field  in the UI, and ideally shouldn't be required.  A dummy properties object could be used if none is specified, so the rest of the block executes normally.

Nevertheless, to appease the code I created a dummy properties file with nothing in it, and reconfigured the HCC.  Then, I tried to reopen / recreate the session factory, but this time I got another exception:

java.lang.NullPointerException
	at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:193)
	at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
	at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
	at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
	at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:54)
	at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:63)

Lines 192-195 seems to imply that a dummy hibernate.transaction.manager_lookup_class will be provided if not specified in the file, but the code checks for existence with trim().length().  The javadoc for Properties reads that it will return null if the item is not found, not a zero-length string.  The length() check is fine and quite reasonable, but it needs to be done after a null check.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list