Menu

Problem

General
2009-05-23
2013-04-24
  • Odd Hogstad

    Odd Hogstad - 2009-05-23

    This seems like a great product, but unfourtunately I cannot get it to work.

    I get an error while trying to run java -jar hbnPojoGen.jar:

    log4j:WARN No appenders could be found for logger (org.apache.commons.configurat
    ion.ConfigurationUtils).
    log4j:WARN Please initialize the log4j system properly.
    org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource
    'class.vm'
            at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource
    (ResourceManagerImpl.java:452)
            at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(
    ResourceManagerImpl.java:335)
            at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstan
    ce.java:1102)
            at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstan
    ce.java:1077)
            at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingl
    eton.java:303)
            at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:503)
            at com.felees.hbnpojogen.Config.parseConfig(Config.java:63)
            at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:302)

    What is this, and how can I fix it?

    Thanks!

     
    • Wallace Wadge

      Wallace Wadge - 2009-05-24

      Hi!,

      Thanks for reporting that - it's been fixed now. I'll issue out a release first thing tomorrow (I have limited connectivity at the moment).

      W

       
    • Wallace Wadge

      Wallace Wadge - 2009-05-25

      Hi,

      Please try with the latest release (uploaded today):

      https://sourceforge.net/project/showfiles.php?group_id=212493&package_id=255588&release_id=576772

      Cheers,
      Wallace

       
    • Odd Hogstad

      Odd Hogstad - 2009-06-05

      Thanks, I've now got it running, and doing som eksperimenting.

      However I have discovered some strange behaviour. I have two tables, Site and Users. In users I have a foreign key, siteId. If I make this a composite key in Users, I get no errors. But if I don't make it a composite key, I get this error:

      Stage 1: Copying skeletons
      Stage 2: Getting commit order in 'PARTIAL' strategy
      Stage 3: Parsing tables
      Stage 4: Building object model
      Stage 5: Writing classes
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'g
      etNicePropertyName' in  class com.felees.hbnpojogen.obj.PropertyObj threw except
      ion java.lang.NullPointerException @ templates/class.vm[225,52]
              at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIden
      tifier.java:205)
              at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
      ence.java:203)
              at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTRefere
      nce.java:294)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
      :74)
              at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
      atement.java:88)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
      :74)
              at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448
      )
              at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirect
      ive.java:170)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
      java:318)
              at org.apache.velocity.Template.merge(Template.java:254)
              at com.felees.hbnpojogen.VelocityWriters.writeClass(VelocityWriters.java
      :442)
              at com.felees.hbnpojogen.VelocityWriters.writeClasses(VelocityWriters.ja
      va:558)
              at com.felees.hbnpojogen.HbnPojoGen.sync(HbnPojoGen.java:217)
              at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:421)
      Caused by: java.lang.NullPointerException
              at com.felees.hbnpojogen.SyncUtils.pluralize(SyncUtils.java:803)
              at com.felees.hbnpojogen.obj.PropertyObj.niceEnglish(PropertyObj.java:92
      1)
              at com.felees.hbnpojogen.obj.PropertyObj.getNicePropertyName(PropertyObj
      .java:906)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(Prop
      ertyExecutor.java:137)
              at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.in
      voke(UberspectImpl.java:350)
              at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIden
      tifier.java:180)
              ... 13 more

      Is it suppose to be like this?

      Thanks again!

       
      • Wallace Wadge

        Wallace Wadge - 2009-06-06

        Hi!

        No it's not meant to be crashing out like that. I plan to upload a new version on Monday that might fix your problem, meanwhile it would be nice if you could send me your db schema (or a snippet of it where the problem crops up) together with your generator config file. It would make fixing any problem simple :-)

        One thing you can try is disable english pluralization in the config file (there was a bug that's been fixed in the version I'll be uploading that only gets triggered if your locale is not set to English)

        Cheers,

        Wallace

        P.S. Send the schema/config to "wwadge at gmail dot com"

         
    • Odd Hogstad

      Odd Hogstad - 2009-06-06

      Thanks, I've now got it running, and doing som eksperimenting.

      However I have discovered some strange behaviour. I have two tables, Site and Users. In users I have a foreign key, siteId. If I make this a composite key in Users, I get no errors. But if I don't make it a composite key, I get this error:

      Stage 1: Copying skeletons
      Stage 2: Getting commit order in 'PARTIAL' strategy
      Stage 3: Parsing tables
      Stage 4: Building object model
      Stage 5: Writing classes
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'g
      etNicePropertyName' in  class com.felees.hbnpojogen.obj.PropertyObj threw except
      ion java.lang.NullPointerException @ templates/class.vm[225,52]
              at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIden
      tifier.java:205)
              at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
      ence.java:203)
              at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTRefere
      nce.java:294)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
      :74)
              at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
      atement.java:88)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
      :74)
              at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448
      )
              at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirect
      ive.java:170)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
      java:318)
              at org.apache.velocity.Template.merge(Template.java:254)
              at com.felees.hbnpojogen.VelocityWriters.writeClass(VelocityWriters.java
      :442)
              at com.felees.hbnpojogen.VelocityWriters.writeClasses(VelocityWriters.ja
      va:558)
              at com.felees.hbnpojogen.HbnPojoGen.sync(HbnPojoGen.java:217)
              at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:421)
      Caused by: java.lang.NullPointerException
              at com.felees.hbnpojogen.SyncUtils.pluralize(SyncUtils.java:803)
              at com.felees.hbnpojogen.obj.PropertyObj.niceEnglish(PropertyObj.java:92
      1)
              at com.felees.hbnpojogen.obj.PropertyObj.getNicePropertyName(PropertyObj
      .java:906)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(Prop
      ertyExecutor.java:137)
              at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.in
      voke(UberspectImpl.java:350)
              at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIden
      tifier.java:180)
              ... 13 more

      Is it suppose to be like this?

      Thanks again!

       
    • Odd Hogstad

      Odd Hogstad - 2009-06-06

      I've sent you some files now.

      I actually thougt of disabeling the plural englishs options, what is the propper syntax of doing so?

      Thanks!

      Odd-R.

       
      • Wallace Wadge

        Wallace Wadge - 2009-06-06

        Just enter:
        <disableEnglishPlural>true</disableEnglishPlural>

        in your config file.

        I recommend downloading the sample configuration file for future reference from here:
        http://garr.dl.sourceforge.net/sourceforge/hibernatepojoge/sample.xml

        Also: I have not received any files. Did you send them to wwadge @ gmail.com ?

        Let me know how it goes.

        Wallace

         

Log in to post a comment.