java.lang.NullPointerException

Hibernate JIRA | Kim Dykeman | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    For the case where no --config arg is specified in the invocation of CodeGenerator.main (i.e. calling the Hbm2JavaTask with no value for the "config" attribute), BasicRenderer fails at the point where it calls isPropertySet("generate-concrete-empty-classes") since the "properties" member is null. Stack Trace: java.lang.NullPointerException at net.sf.hibernate.tool.hbm2java.BasicRenderer.isPropertySet(BasicRenderer.java:611) at net.sf.hibernate.tool.hbm2java.BasicRenderer.generateConcreteEmptyClasses(BasicRenderer.java:332) at net.sf.hibernate.tool.hbm2java.BasicRenderer.render(BasicRenderer.java:59) at net.sf.hibernate.tool.hbm2java.Generator.write(Generator.java:138) at net.sf.hibernate.tool.hbm2java.Generator.writeRecur(Generator.java:115) at net.sf.hibernate.tool.hbm2java.Generator.generate(Generator.java:104) at net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:125) at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145) at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.impl.DynamicTag.doTag(DynamicTag.java:125) at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:145) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:128) at com.werken.werkz.Goal.fire(Goal.java:639) at com.werken.werkz.Goal.attain(Goal.java:575) at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193) at com.werken.werkz.jelly.AttainGoalTag.doTag(AttainGoalTag.java:134) at org.apache.maven.jelly.tags.werkz.LazyAttainGoalTag.doTag(LazyAttainGoalTag.java:107) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at com.werken.werkz.jelly.PreGoalTag$1.firePreGoal(PreGoalTag.java:87) at com.werken.werkz.Goal.firePreGoalCallbacks(Goal.java:691) at com.werken.werkz.Goal.fire(Goal.java:616) at com.werken.werkz.Goal.attain(Goal.java:575) at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:448) at org.apache.maven.MavenSession.attainGoals(MavenSession.java:348) at org.apache.maven.cli.App.doMain(App.java:543) at org.apache.maven.cli.App.main(App.java:1109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) I've applied a simple patch to my local copy that seems to work. Index: Generator.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/net/sf/hibernate/tool/hbm2java/Generator.java,v retrieving revision 1.3 diff -u -r1.3 Generator.java --- Generator.java 29 Mar 2004 18:07:16 -0000 1.3 +++ Generator.java 13 Apr 2004 23:41:51 -0000 @@ -36,7 +36,9 @@ /** * Constructs a new Generator using the defaults. */ - public Generator () {} + public Generator () { + params = new Properties(); + } /** * Constructs a new Generator, configured from XML.

    Hibernate JIRA | 1 decade ago | Kim Dykeman
    java.lang.NullPointerException
  2. 0

    For the case where no --config arg is specified in the invocation of CodeGenerator.main (i.e. calling the Hbm2JavaTask with no value for the "config" attribute), BasicRenderer fails at the point where it calls isPropertySet("generate-concrete-empty-classes") since the "properties" member is null. Stack Trace: java.lang.NullPointerException at net.sf.hibernate.tool.hbm2java.BasicRenderer.isPropertySet(BasicRenderer.java:611) at net.sf.hibernate.tool.hbm2java.BasicRenderer.generateConcreteEmptyClasses(BasicRenderer.java:332) at net.sf.hibernate.tool.hbm2java.BasicRenderer.render(BasicRenderer.java:59) at net.sf.hibernate.tool.hbm2java.Generator.write(Generator.java:138) at net.sf.hibernate.tool.hbm2java.Generator.writeRecur(Generator.java:115) at net.sf.hibernate.tool.hbm2java.Generator.generate(Generator.java:104) at net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:125) at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145) at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.impl.DynamicTag.doTag(DynamicTag.java:125) at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:145) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:128) at com.werken.werkz.Goal.fire(Goal.java:639) at com.werken.werkz.Goal.attain(Goal.java:575) at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193) at com.werken.werkz.jelly.AttainGoalTag.doTag(AttainGoalTag.java:134) at org.apache.maven.jelly.tags.werkz.LazyAttainGoalTag.doTag(LazyAttainGoalTag.java:107) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) at com.werken.werkz.jelly.PreGoalTag$1.firePreGoal(PreGoalTag.java:87) at com.werken.werkz.Goal.firePreGoalCallbacks(Goal.java:691) at com.werken.werkz.Goal.fire(Goal.java:616) at com.werken.werkz.Goal.attain(Goal.java:575) at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:448) at org.apache.maven.MavenSession.attainGoals(MavenSession.java:348) at org.apache.maven.cli.App.doMain(App.java:543) at org.apache.maven.cli.App.main(App.java:1109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) I've applied a simple patch to my local copy that seems to work. Index: Generator.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/net/sf/hibernate/tool/hbm2java/Generator.java,v retrieving revision 1.3 diff -u -r1.3 Generator.java --- Generator.java 29 Mar 2004 18:07:16 -0000 1.3 +++ Generator.java 13 Apr 2004 23:41:51 -0000 @@ -36,7 +36,9 @@ /** * Constructs a new Generator using the defaults. */ - public Generator () {} + public Generator () { + params = new Properties(); + } /** * Constructs a new Generator, configured from XML.

    Hibernate JIRA | 1 decade ago | Kim Dykeman
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at net.sf.hibernate.tool.hbm2java.BasicRenderer.isPropertySet()
    2. net.sf.hibernate
      Hbm2JavaTask.execute
      1. net.sf.hibernate.tool.hbm2java.BasicRenderer.isPropertySet(BasicRenderer.java:611)
      2. net.sf.hibernate.tool.hbm2java.BasicRenderer.generateConcreteEmptyClasses(BasicRenderer.java:332)
      3. net.sf.hibernate.tool.hbm2java.BasicRenderer.render(BasicRenderer.java:59)
      4. net.sf.hibernate.tool.hbm2java.Generator.write(Generator.java:138)
      5. net.sf.hibernate.tool.hbm2java.Generator.writeRecur(Generator.java:115)
      6. net.sf.hibernate.tool.hbm2java.Generator.generate(Generator.java:104)
      7. net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:125)
      8. net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)
      9. net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
      9 frames
    3. Ant
      Task.perform
      1. org.apache.tools.ant.Task.perform(Task.java:341)
      1 frame
    4. commons-jelly-tags-antlr
      AntTag.doTag
      1. org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)
      1 frame
    5. commons-jelly
      TagSupport.invokeBody
      1. org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
      2. org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
      3. org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
      4. org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)
      5. org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
      6. org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
      7. org.apache.commons.jelly.impl.DynamicTag.doTag(DynamicTag.java:125)
      8. org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:145)
      9. org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
      10. org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
      10 frames
    6. com.werken.werkz
      AttainGoalTag.doTag
      1. com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:128)
      2. com.werken.werkz.Goal.fire(Goal.java:639)
      3. com.werken.werkz.Goal.attain(Goal.java:575)
      4. com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
      5. com.werken.werkz.jelly.AttainGoalTag.doTag(AttainGoalTag.java:134)
      5 frames
    7. org.apache.maven
      LazyAttainGoalTag.doTag
      1. org.apache.maven.jelly.tags.werkz.LazyAttainGoalTag.doTag(LazyAttainGoalTag.java:107)
      1 frame
    8. commons-jelly
      TagSupport.invokeBody
      1. org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
      2. org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
      3. org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
      3 frames
    9. com.werken.werkz
      Goal.attain
      1. com.werken.werkz.jelly.PreGoalTag$1.firePreGoal(PreGoalTag.java:87)
      2. com.werken.werkz.Goal.firePreGoalCallbacks(Goal.java:691)
      3. com.werken.werkz.Goal.fire(Goal.java:616)
      4. com.werken.werkz.Goal.attain(Goal.java:575)
      4 frames
    10. Maven Plugin
      PluginManager.attainGoals
      1. org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:448)
      1 frame
    11. Maven Core
      MavenSession.attainGoals
      1. org.apache.maven.MavenSession.attainGoals(MavenSession.java:348)
      1 frame
    12. M3 Interceptor
      App.main
      1. org.apache.maven.cli.App.doMain(App.java:543)
      2. org.apache.maven.cli.App.main(App.java:1109)
      2 frames
    13. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:324)
      4 frames