-->
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.  [ 10 posts ] 
Author Message
 Post subject: <hibernatetool> java.lang.IllegalAccessError
PostPosted: Fri Feb 23, 2007 2:23 pm 
Newbie

Joined: Wed May 03, 2006 7:35 pm
Posts: 2
Location: Canada
Hibernate version:

Hibernate 3.2.2 GA
Hibernate Annotations 3.2.1 GA
Hibernate Tools 3.2beta9

Mapping documents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<property name="connection.url">jdbc:postgresql://HOST/DB</property>
<property name="connection.username">USER</property>
<property name="connection.password">PASSWORD</property>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="current_session_context_class">thread</property>
</session-factory>
</hibernate-configuration>

Ant target:
<target name="generate-schema" depends="init">
<path id="hibernatetool.classpath">
<path location="${hibernate.dir}/hibernate3.jar"/>
<path location="${hibernate.dir}/lib/commons-logging-1.0.4.jar"/>
<path location="${hibernate.dir}/lib/dom4j-1.6.1.jar"/>
<path location="${hibernate.dir}/lib/c3p0-0.9.0.jar"/>
<path location="${hibernate.dir}/lib/cglib-2.1.3.jar"/>
<path location="${hibernate.annotations.dir}/hibernate-annotations.jar"/>
<path location="${hibernate.annotations.dir}/lib/ejb3-persistence.jar"/>
<path location="${org.postgresql.jdbc.dir}/postgresql-8.1-408.jdbc3.jar"/>
<path location="${hibernate.tools.dir}/hibernate-tools.jar"/>
<path location="${hibernate.tools.dir}/freemarker.jar"/>
<path location="${org.apache.log4j.dir}/log4j-1.2.14.jar"/>
</path>

<taskdef
name="hibernatetool"
classpathref="hibernatetool.classpath"
classname="org.hibernate.tool.ant.HibernateToolTask">
</taskdef>

<hibernatetool destdir="${src.dir}">
<annotationconfiguration configurationfile="${src.dir}/hibernate.cfg.xml">
<fileset dir="${src.dir}/com/vanbelle/hercales/data/entity/">
<include name="**.class"/>
</fileset>
</annotationconfiguration>
<hbm2ddl export="true" create="true" outputfilename="generated/hydra-create-tables.sql"/>
</hibernatetool>
</target>

Gives the following error:
BUILD FAILED
java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
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.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:655)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:271)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:140)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:123)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:109)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:299)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:183)
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)
... 6 more
--- Nested Exception ---
java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:655)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:271)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:140)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:123)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:109)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:299)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:183)
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.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 10:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you are mixing incompatible hibernate, hibernate-tools and hibernate-annotations jars.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Same error
PostPosted: Thu Mar 29, 2007 8:15 pm 
Newbie

Joined: Fri May 21, 2004 3:25 pm
Posts: 8
Location: Los Angeles
Hi,

Was this ever fixed? Iam running into the same problems:

Hibernate core 3.2.2 GA
Annotations: 3.3.0.GA

I have followed the compatibility matrix: http://www.hibernate.org/30.html

Please let me know.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory2' defined in class path resource [spring/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:712)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:679)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1112)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 1:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the same answer applies to yours.....use compatible jars.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 01, 2007 3:38 am 
Newbie

Joined: Fri May 21, 2004 3:25 pm
Posts: 8
Location: Los Angeles
Hi Max,

Thanks for the reply. Like I said in my post Iam following the compatibility matrix.
Is there somewhere else you want me to look ?
Please let me know what are the compatible jars?

My setup:

Hibernate core 3.2.2 GA
Annotations: 3.3.0.GA

I have followed the compatibility matrix: http://www.hibernate.org/30.html

Thanks,

Vamsi


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 01, 2007 3:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I don't can't see how you can be using the latest jar since you would only get an error about accessing that field if you are using an old version.

Plese double check you don't have other jars loaded first with older versions.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 02, 2007 4:41 pm 
Newbie

Joined: Fri May 21, 2004 3:25 pm
Posts: 8
Location: Los Angeles
Hi Max,
Nope, I only have the above mentioned jar files on my classpath. Iam using both annotated files and hbm.xml files, dont know if thats causing any problems.

Thanks.
Vamsi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 02, 2007 5:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
If you truely beleive this then please create a *small* testapp that doesn't do anything but start hibernate via AnnotationConfiguration (no spring or other code) and make it fail with just those jars in classpath.

If that still fails please report a bug against that compability matrix in our Hibernate Annotations JIRA

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 07, 2007 7:45 am 
Newbie

Joined: Sat Apr 07, 2007 7:41 am
Posts: 1
I have the same problem using Hibernate 3.2.2 GA, Annotations 3.2.1 GA and EntityManager 3.2.1 GA. According to the compatibility matrix these are compatible.

I only have this IllegalAccess problem when I deploy a webapp in a ear. If I deploy just a webapp, this error does not occur.

Any thoughts ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 07, 2007 8:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the answer is the same.

prove it by running a simple standalone app that launches hibernate only with hibernate code in it and submit it to jira.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.