-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Problem in hbm2java----ExceptionInInitializerError
PostPosted: Mon Feb 06, 2006 3:40 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
Hibernate Version : 3.1

Hibernate-Tools Version : 3.1.0.beta3

Using the following ant task i m trying generate POJOS....

<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.class.path"/>
<target name="javacode" depends="init">
<hibernatetool destdir="${src.dir}">
<configuration configurationfile="Mapping/hibernate.cfg.xml">
<fileset dir="${hibernate.mappings}">
<include name="*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java />
</hibernatetool>
</target>

it gives the follwing output:


init:

javacode:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)

BUILD FAILED
java.lang.ExceptionInInitializerError

Total time: 1 second

can anyone help me to figure out the problem????

_________________
Regards,
Nims.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
run it with ant -v to get a full stacktrace.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:26 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
Hi Max...

Thanx for the reply....

Here is the full stack trace....




init:

javacode:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)

BUILD FAILED
java.lang.ExceptionInInitializerError
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at oracle.jdevimpl.ant.runner.AntLauncher.launch(AntLauncher.java:321)
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:585)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.runAnt(InProcessAntStarter.java:298)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.mav$runAnt(InProcessAntStarter.java)
at oracle.jdevimpl.ant.runner.InProcessAntStarter$1.run(InProcessAntStarter.java:74)
Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.tool.ant.Hbm2JavaExporterTask.createExporter(Hbm2JavaExporterTask.java:41)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:38)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
... 11 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:509)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:285)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:255)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:381)
at org.hibernate.tool.hbm2x.POJOExporter.<clinit>(POJOExporter.java:19)
... 19 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:420)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:502)
... 23 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.getConstructor(Class.java:1629)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:417)
... 24 more
--- Nested Exception ---
java.lang.ExceptionInInitializerError
at org.hibernate.tool.ant.Hbm2JavaExporterTask.createExporter(Hbm2JavaExporterTask.java:41)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:38)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at oracle.jdevimpl.ant.runner.AntLauncher.launch(AntLauncher.java:321)
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:585)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.runAnt(InProcessAntStarter.java:298)
at oracle.jdevimpl.ant.runner.InProcessAntStarter.mav$runAnt(InProcessAntStarter.java)
at oracle.jdevimpl.ant.runner.InProcessAntStarter$1.run(InProcessAntStarter.java:74)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:509)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:285)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:255)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:381)
at org.hibernate.tool.hbm2x.POJOExporter.<clinit>(POJOExporter.java:19)
... 19 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:420)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:502)
... 23 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.getConstructor(Class.java:1629)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:417)
... 24 more

Total time: 16 seconds

_________________
Regards,
Nims.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so:

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.getConstructor(Class.java:1629)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:417)

you are missing log4j ...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:32 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
ya...i noticed that and i placed log4j-1.2.11.jar in my class path....but still i m getting tha same exception

_________________
Regards,
Nims.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it should be in the classpath of the taskdef

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:41 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
it is there in the class path of taskdef only


<path id="project.class.path">
<pathelement location="${classes.dir}" />
<fileset dir="${hibernate}">
<include name="hibernate3.jar"/>
</fileset>
<fileset dir="${hibernate}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${hibernate.extensions}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${hibernate.extensions}/plugins/org.hibernate.eclipse_3.1.0.beta3/lib/tools">
<include name="hibernate-tools.jar"/>
</fileset>

<fileset dir="${hibernate.extensions}/plugins/org.hibernate.eclipse_3.1.0.beta3/lib/hibernate">
<include name="log4j-1.2.11.jar"/>
</fileset>
</path>

_________________
Regards,
Nims.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and where do you use this $project.classpath ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:51 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.class.path"/>
<target name="javacode" depends="init">
<hibernatetool destdir="${src.dir}">
<configuration configurationfile="Mapping/hibernate.cfg.xml">
<fileset dir="${hibernate.mappings}">
<include name="*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java />
</hibernatetool>
</target>

_________________
Regards,
Nims.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you should not put project specific classes into <taskdef>. so remove the classes.dir from this classpath and put that into the <hibernatetool>

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 5:13 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
can you please be specific..........
how to specify and where to specify.......

As i m fresher i dont know much about ant and tasks ......etc.....

_________________
Regards,
Nims.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 5:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
<hibernatetool> can have a <classpath> element too.

<hibernatetool ....>
<classpath ...>

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 5:25 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
i specified like this.........

still the same exception........


<hibernatetool destdir="${src.dir}">
<configuration configurationfile="Mapping/hibernate.cfg.xml">
<fileset dir="${hibernate.mappings}">
<include name="*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java />
<classpath refid="project.class.path">
</classpath>
</hibernatetool>

_________________
Regards,
Nims.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 5:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you don't understand me ;)

You should not specify the same classpath here!

You need to seperate the classpaths for what they should be used for or otherwise class loading problems will occur.

the <taskdef> classpath just needs the general libraries for making the tools/hibernate run. No user specific stuff there.

The <hibernatetool> classpath is where you put user specific classes, e.g. your classes directory.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 5:36 am 
Newbie

Joined: Tue Dec 13, 2005 2:13 am
Posts: 8
i hope i understood!!!!!!!!!!

u mean to say that i need to have different class path which includes all supported jar files for this specific task.......am i???

i am sorry for putting you in trouble(i mean making me to understand)....

_________________
Regards,
Nims.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.