• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernated Pojo Generator using config.xml for Oracle database

 
rama ganti
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please specify how to work with Hibernate Pojo Generator .

I have a hibernate dependancies jar file and i have created a config.xml file.

My database is Oracle

My config.xml has the following code

<?xml version="1.0" encoding="ISO-8859-1" ?>
<appconfig>
<dbType>Oracle</dbType>
<driver>sun.jdbc.odbc.JdbcOdbcDriver</driver>
<url>jdbcracle:thin:@ 192.168.64.137:1521:XE</url>
<username>scms</username>
<password>scms</password>
<sourceTarget>C:\workspace\TEST_POJ</sourceTarget>
<projectName>TESTPOJ</projectName>
<topLevel>JMBAXI</topLevel>
<libPath>libs</libPath>
<schemaStrategy>FULL</schemaStrategy>
</appconfig>




When I am running the code through command prompt I am getting a null pointer exception


C:\>java -jar hbnpojogen-core-1.4.4-jar-with-dependencies.jar config.xml
Hibernate POJO Generator

Reading from config: C:\\config.xml
java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:419)

generated a file called velocity.log which has the following contents

2012-03-03 09:38:55,177 - Log4JLogChute initialized using file 'velocity.log'
2012-03-03 09:38:55,177 - Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
2012-03-03 09:38:55,177 - Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
2012-03-03 09:38:55,177 - Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
2012-03-03 09:38:55,177 - Couldn't find class org.apache.velocity.runtime.log.AvalonLogChute or necessary supporting classes in classpath.
java.lang.NoClassDefFoundError: org/apache/log/format/Formatter
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:63)
at org.apache.velocity.util.ClassUtils.getNewInstance(ClassUtils.java:95)
at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:147)
at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:208)
at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:728)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:240)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:534)
at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:227)
at org.apache.velocity.app.Velocity.init(Velocity.java:111)
at com.felees.hbnpojogen.Config.parseConfig(Config.java:71)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:409)
Caused by: java.lang.ClassNotFoundException: org.apache.log.format.Formatter
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 13 more
2012-03-03 09:38:55,177 - Trying to use logger class org.apache.velocity.runtime.log.Log4JLogChute
2012-03-03 09:38:55,177 - Using logger class org.apache.velocity.runtime.log.Log4JLogChute
2012-03-03 09:38:55,193 - Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
2012-03-03 09:38:55,193 - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2012-03-03 09:38:55,224 - ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
2012-03-03 09:38:55,224 - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
2012-03-03 09:38:55,224 - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
2012-03-03 09:38:55,239 - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
2012-03-03 09:38:55,239 - Loaded System Directive: org.apache.velocity.runtime.directive.Include
2012-03-03 09:38:55,239 - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
2012-03-03 09:38:55,301 - Created '20' parsers.
2012-03-03 09:38:55,301 - Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
2012-03-03 09:38:55,301 - Velocimacro : Default library not found.
2012-03-03 09:38:55,301 - Velocimacro : allowInline = true : VMs can be defined inline in templates
2012-03-03 09:38:55,301 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
2012-03-03 09:38:55,301 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
2012-03-03 09:38:55,301 - Velocimacro : autoload off : VM system will not automatically reload global library macros
2012-03-03 09:38:55,333 - Velocimacro : added #doCalcFullType( ) : source = templates/class.vm
2012-03-03 09:38:55,333 - Velocimacro : added #lazyManyToMany( ) : source = templates/class.vm
2012-03-03 09:38:55,333 - Velocimacro : added #lazyOneToMany( ) : source = templates/class.vm
2012-03-03 09:38:55,333 - Velocimacro : added #lazyOneToOne( ) : source = templates/class.vm
2012-03-03 09:38:55,333 - Velocimacro : added #lazyManyToOne( ) : source = templates/class.vm
2012-03-03 09:38:55,348 - Velocimacro : added #doAnnotations( ) : source = templates/class.vm
2012-03-03 09:38:55,348 - Velocimacro : added #prefix( ) : source = templates/class.vm
2012-03-03 09:38:55,348 - Velocimacro : added #doClassType( ) : source = templates/class.vm
2012-03-03 09:38:55,364 - Velocimacro : added #doManyToMany( property ) : source = templates/class.vm
2012-03-03 09:38:55,364 - Velocimacro : added #oneToManyAnnotation( property ) : source = templates/class.vm
2012-03-03 09:38:55,364 - Velocimacro : added #manyToOneAnnotation( property ) : source = templates/class.vm
2012-03-03 09:38:55,379 - Velocimacro : added #OneToOneAnnotation( property ) : source = templates/class.vm
2012-03-03 09:38:55,379 - Velocimacro : added #doConstructorSignature( ) : source = templates/class.vm
2012-03-03 09:38:55,395 - Velocimacro : added #doClassMacros( ) : source = templates/class.vm
2012-03-03 09:38:55,519 - ResourceManager : found templates/class.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2012-03-03 09:38:55,519 - Velocimacro : VM addition rejected : prefix : inline not allowed to replace existing VM
2012-03-03 09:38:55,519 - Failed to add macro: #prefix( ) : source = templates/classIface.vm
2012-03-03 09:38:55,535 - ResourceManager : found templates/classIface.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2012-03-03 09:39:05,997 - Log4JLogChute initialized using file 'velocity.log'
2012-03-03 09:39:05,997 - Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
2012-03-03 09:39:05,997 - Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
2012-03-03 09:39:05,997 - Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
2012-03-03 09:39:05,997 - Couldn't find class org.apache.velocity.runtime.log.AvalonLogChute or necessary supporting classes in classpath.
java.lang.NoClassDefFoundError: org/apache/log/format/Formatter
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:63)
at org.apache.velocity.util.ClassUtils.getNewInstance(ClassUtils.java:95)
at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:147)
at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:208)
at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:728)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:240)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:534)
at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:227)
at org.apache.velocity.app.Velocity.init(Velocity.java:111)
at com.felees.hbnpojogen.Config.parseConfig(Config.java:71)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:409)
Caused by: java.lang.ClassNotFoundException: org.apache.log.format.Formatter
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 13 more
2012-03-03 09:39:06,013 - Trying to use logger class org.apache.velocity.runtime.log.Log4JLogChute
2012-03-03 09:39:06,013 - Using logger class org.apache.velocity.runtime.log.Log4JLogChute
2012-03-03 09:39:06,013 - Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
2012-03-03 09:39:06,013 - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2012-03-03 09:39:06,013 - ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
2012-03-03 09:39:06,028 - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
2012-03-03 09:39:06,028 - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
2012-03-03 09:39:06,028 - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
2012-03-03 09:39:06,028 - Loaded System Directive: org.apache.velocity.runtime.directive.Include
2012-03-03 09:39:06,028 - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
2012-03-03 09:39:06,091 - Created '20' parsers.
2012-03-03 09:39:06,091 - Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
2012-03-03 09:39:06,091 - Velocimacro : Default library not found.
2012-03-03 09:39:06,091 - Velocimacro : allowInline = true : VMs can be defined inline in templates
2012-03-03 09:39:06,091 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
2012-03-03 09:39:06,091 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
2012-03-03 09:39:06,091 - Velocimacro : autoload off : VM system will not automatically reload global library macros
2012-03-03 09:39:06,122 - Velocimacro : added #doCalcFullType( ) : source = templates/class.vm
2012-03-03 09:39:06,122 - Velocimacro : added #lazyManyToMany( ) : source = templates/class.vm
2012-03-03 09:39:06,122 - Velocimacro : added #lazyOneToMany( ) : source = templates/class.vm
2012-03-03 09:39:06,122 - Velocimacro : added #lazyOneToOne( ) : source = templates/class.vm
2012-03-03 09:39:06,122 - Velocimacro : added #lazyManyToOne( ) : source = templates/class.vm
2012-03-03 09:39:06,137 - Velocimacro : added #doAnnotations( ) : source = templates/class.vm
2012-03-03 09:39:06,137 - Velocimacro : added #prefix( ) : source = templates/class.vm
2012-03-03 09:39:06,137 - Velocimacro : added #doClassType( ) : source = templates/class.vm
2012-03-03 09:39:06,137 - Velocimacro : added #doManyToMany( property ) : source = templates/class.vm
2012-03-03 09:39:06,153 - Velocimacro : added #oneToManyAnnotation( property ) : source = templates/class.vm
2012-03-03 09:39:06,153 - Velocimacro : added #manyToOneAnnotation( property ) : source = templates/class.vm
2012-03-03 09:39:06,168 - Velocimacro : added #OneToOneAnnotation( property ) : source = templates/class.vm
2012-03-03 09:39:06,168 - Velocimacro : added #doConstructorSignature( ) : source = templates/class.vm
2012-03-03 09:39:06,184 - Velocimacro : added #doClassMacros( ) : source = templates/class.vm
2012-03-03 09:39:06,293 - ResourceManager : found templates/class.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2012-03-03 09:39:06,308 - Velocimacro : VM addition rejected : prefix : inline not allowed to replace existing VM
2012-03-03 09:39:06,308 - Failed to add macro: #prefix( ) : source = templates/classIface.vm
2012-03-03 09:39:06,308 - ResourceManager : found templates/classIface.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...When I am running the code through command prompt I am getting a null pointer exception...

And the stack trace is....?
 
rama ganti
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:
...When I am running the code through command prompt I am getting a null pointer exception...

And the stack trace is....?


C:\>java -jar hbnpojogen-core-1.4.4-jar-with-dependencies.jar config.xml
Hibernate POJO Generator

Reading from config: C:\\config.xml
java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:419)
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for editing the original post to add the stack trace etc... But you also can add a reply instead modifying the original post.

To your question you have to check for those jars missing and add them to the classpath.

Couldn't find class org.apache.velocity.runtime.log.AvalonLogChute or necessary supporting classes in classpath.
java.lang.NoClassDefFoundError: org/apache/log/format/Formatter
 
Swapnil Kadu
Greenhorn
Posts: 2
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am ressolved the [ java.lang.NoClassDefFoundError: org/apache/log/format/Formatter ] Error;
but now i get following error on command prompt:

Stage 1: Copying skeletons
Stage 2: Getting commit order in 'PARTIAL' strategy
java.lang.NullPointerException
at com.felees.hbnpojogen.CaseInsensitiveComparator.compare(CaseInsensitiveComparator.java:19)
at com.felees.hbnpojogen.CaseInsensitiveComparator.compare(CaseInsensitiveComparator.java:10)
at java.util.TreeMap.getEntryUsingComparator(Unknown Source)
at java.util.TreeMap.getEntry(Unknown Source)
at java.util.TreeMap.containsKey(Unknown Source)
at java.util.TreeSet.contains(Unknown Source)
at com.felees.hbnpojogen.SyncUtils.getCommitOrder(SyncUtils.java:219)
at com.felees.hbnpojogen.SyncUtils.getCommitOrder(SyncUtils.java:439)
at com.felees.hbnpojogen.HbnPojoGen.sync(HbnPojoGen.java:169)
at com.felees.hbnpojogen.HbnPojoGen.main(HbnPojoGen.java:429)

my trace is :

Mon Mar 12 12:24:01 IST 2012 [debug] AvalonLogChute initialized using file 'velocity.log'
Mon Mar 12 12:24:01 IST 2012 [trace] *******************************************************************
Mon Mar 12 12:24:01 IST 2012 [debug] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
Mon Mar 12 12:24:01 IST 2012 [trace] RuntimeInstance initializing.
Mon Mar 12 12:24:01 IST 2012 [debug] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
Mon Mar 12 12:24:01 IST 2012 [debug] Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
Mon Mar 12 12:24:01 IST 2012 [debug] Using logger class org.apache.velocity.runtime.log.AvalonLogChute
Mon Mar 12 12:24:01 IST 2012 [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
Mon Mar 12 12:24:01 IST 2012 [debug] ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
Mon Mar 12 12:24:01 IST 2012 [trace] ClasspathResourceLoader : initialization complete.
Mon Mar 12 12:24:01 IST 2012 [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
Mon Mar 12 12:24:01 IST 2012 [trace] Default ResourceManager initialization complete.
Mon Mar 12 12:24:01 IST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
Mon Mar 12 12:24:01 IST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
Mon Mar 12 12:24:01 IST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
Mon Mar 12 12:24:01 IST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include
Mon Mar 12 12:24:01 IST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
Mon Mar 12 12:24:01 IST 2012 [debug] Created '20' parsers.
Mon Mar 12 12:24:01 IST 2012 [trace] Velocimacro : initialization starting.
Mon Mar 12 12:24:01 IST 2012 [debug] Velocimacro : adding VMs from VM library : templates/VM_global_library.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #quietnull( a ) : source = templates/VM_global_library.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #recurse( a ) : source = templates/VM_global_library.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #callrecurse( ) : source = templates/VM_global_library.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #testbool( b ) : source = templates/VM_global_library.vm
Mon Mar 12 12:24:01 IST 2012 [debug] ResourceManager : found templates/VM_global_library.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
Mon Mar 12 12:24:01 IST 2012 [trace] Velocimacro : VM library registration complete.
Mon Mar 12 12:24:01 IST 2012 [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : allowInlineToOverride = true : VMs defined inline may replace previous VM definitions
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : allowInlineLocal = true : VMs defined inline will be local to their defining template only.
Mon Mar 12 12:24:01 IST 2012 [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros
Mon Mar 12 12:24:01 IST 2012 [trace] Velocimacro : Velocimacro : initialization complete.
Mon Mar 12 12:24:01 IST 2012 [trace] RuntimeInstance successfully initialized.
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #doCalcFullType( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #lazyManyToMany( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #lazyOneToMany( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #lazyOneToOne( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #lazyManyToOne( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #doAnnotations( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #prefix( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #doClassType( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #doManyToMany( property ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #oneToManyAnnotation( property ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #manyToOneAnnotation( property ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #OneToOneAnnotation( property ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #doConstructorSignature( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #doClassMacros( ) : source = templates/class.vm
Mon Mar 12 12:24:01 IST 2012 [debug] ResourceManager : found templates/class.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
Mon Mar 12 12:24:01 IST 2012 [info] Velocimacro : added #prefix( ) : source = templates/classIface.vm
Mon Mar 12 12:24:01 IST 2012 [debug] ResourceManager : found templates/classIface.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Swapnil Kadu,

Welcome to the CodeRanch!,

What kind of application/environment is this (TellTheDetails)? Is this same as the Original poster's?

And what is the implementation in the code this exception is relate to (CaseInsensitiveComparator.java)?
 
Swapnil Kadu
Greenhorn
Posts: 2
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijitha Kumara,

application/environment is same as the Original poster's.

i want to use Hibernate pojo generator for Oracle Database, but when I use for Oracle db it shows above err.

but Hibernate pojo generator works fine for MySql.

is there any step i may forgot ?
please let me know!
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the code related to the above (as I asked in the previous reply) with the relevant configuration? And also with the steps you follow...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic