java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by 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.
    via by Joseph Marques,
    • 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)
    No Bugmate found.