Hibernate version: 3.1 (final), Annotations 3.1 beta 7 (also tried beta 6, 5, and 4 -- and tried to compile from CVS but cannot compile)
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.url">jdbc:mysql:///ycomp</property>
<property name="hibernate.connection.username">yyuser</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping class="org.aitools.ycomp.Project"/>
</session-factory>
Code between sessionFactory.openSession() and session.close():None, doesn't get that far -- I get the stack trace below just when I do this:
Code:
SessionFactory sessionFactory;
// Create the Hibernate SessionFactory right away.
try
{
// Create the SessionFactory from hibernate.cfg.xml
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
}
catch (Throwable ex)
{
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
Full stack trace of any exception that occurs:Code:
SEVERE: Exception sending context initialized event to listener instance of class org.aitools.webapp.listener.ServletContextListener
java.lang.ExceptionInInitializerError
at org.aitools.webapp.listener.ServletContextListener.contextInitialized(ServletContextListener.java:26)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3692)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4127)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
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:680)
at org.apache.catalina.startup.Catalina.start(Catalina.java:536)
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)
Caused by: java.lang.NoSuchMethodError: org.hibernate.mapping.PersistentClass.setAbstract(Ljava/lang/Boolean;)V
at org.hibernate.cfg.annotations.EntityBinder.bindEntity(EntityBinder.java:141)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:475)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:266)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:199)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1145)
at org.aitools.webapp.listener.ServletContextListener.contextInitialized(ServletContextListener.java:20)
... 15 more
Name and version of the database you are using: MySQL 4.1.16
The generated SQL (show_sql=true): Doesn't get this far.
Debug level Hibernate log excerpt:Code:
Hibernate 3.1 rc3
hibernate.properties not found
using CGLIB reflection optimizer
using JDK 1.4 java.sql.Timestamp handling
configuring from resource: /hibernate.cfg.xml
Configuration resource: /hibernate.cfg.xml
trying to locate http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath under org/hibernate/
found http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.password=password
hibernate.connection.url=jdbc:mysql:///ycomp
hibernate.connection.username=yyuser
connection.pool_size=1
hibernate.dialect=org.hibernate.dialect.MySQLDialect
current_session_context_class=thread
cache.provider_class=org.hibernate.cache.NoCacheProvider
show_sql=true
hbm2ddl.auto=create
null<-org.dom4j.tree.DefaultAttribute@105d88a [Attribute: name class value "org.aitools.ycomp.Project"]
Configured SessionFactory: null
properties: {show_sql=true, java.vendor=Sun Microsystems Inc., catalina.base=/home/noel/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0, hibernate.connection.url=jdbc:mysql:///ycomp, sun.management.compiler=HotSpot Client Compiler, catalina.useNaming=true, hbm2ddl.auto=create, os.name=Linux, sun.boot.class.path=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/rt.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i18n.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/jsse.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/jce.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/charsets.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/classes, hibernate.current_session_context_class=thread, sun.desktop=gnome, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.5.0_05-b05, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, user.name=noel, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, tomcat.util.buf.StringCache.byte.enabled=true, current_session_context_class=thread, user.language=en, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386, java.version=1.5.0_05, user.timezone=America/New_York, sun.arch.data.model=32, java.endorsed.dirs=/usr/local/tomcat5/common/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., file.separator=/, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=49.0, user.country=US, java.home=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre, java.vm.info=mixed mode, sharing, os.version=2.6.14-1.1656_FC4, path.separator=:, java.vm.version=1.5.0_05-b05, hibernate.connection.password=password, java.awt.printerjob=sun.print.PSPrinterJob, sun.io.unicode.encoding=UnicodeLittle, hibernate.connection.username=bm, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper., java.naming.factory.url.pkgs=org.apache.naming, user.home=/home/noel, java.specification.vendor=Sun Microsystems Inc., hibernate.hbm2ddl.auto=create, java.library.path=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386/client:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/../lib/i386:/usr/lib/mozilla-1.7.12, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=com.mysql.jdbc.Driver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.MySQLDialect, common.loader=${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=/usr/local/tomcat5/bin/bootstrap.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/lib/tools.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=/usr/local/tomcat5, sun.cpu.endian=little, sun.os.patch.level=unknown, connection.pool_size=1, java.io.tmpdir=/tmp, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar, os.arch=i386, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.ext.dirs=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/ext, user.dir=/home/noel, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, cache.provider_class=org.hibernate.cache.NoCacheProvider, file.encoding=UTF-8, java.specification.version=1.5, hibernate.show_sql=true, hibernate.connection.pool_size=1}
Preparing to build session factory with filters : {}
Execute first pass mapping processing
Process hbm files
Process annotated classes
Binding entity from annotated class: java.lang.Class
Binding column TYPE unique false
Initial SessionFactory creation failed.java.lang.NoSuchMethodError: org.hibernate.mapping.PersistentClass.setAbstract(Ljava/lang/Boolean;)V
Looks like the key lines are
Code:
null<-org.dom4j.tree.DefaultAttribute@105d88a [Attribute: name class value "org.aitools.ycomp.Project"]
Configured SessionFactory: null
But I don't know how to interpret them. At first, I tried having a "mapping" element in the hibernate.cfg.xml file for the "org.aitools.ycomp" package, but then I got a complaint about "Package not found or wo package-info.java". I couldn't figure out from the documentation whether I need to create some kind of config file for the package....