Hi guys,
I'm trying to run SchemaExport with ant and I keep getting a java.lang.NullPointerException. It seems to me that SchemaExport is looking for some foreign keys in the mapping file. I've commented out all the other mappings to simplify the schema generation but it doesn't seem to matter which mapping file i use. It still generates the same issue. Can you please help? Many thanks in advance.
Willy
Hibernate version: 3.1
Hibernate.cfg.xml: <?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.username">BAP</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@ldn2com1.ebrd.com:1521:inetdev</property> <!-- <property name="hibernate.connection.url">jdbc:oracle:thin:@(description=(address=(host=ldn2com1.ebrd.com)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=inetdev)))</property> --> <property name="hibernate.connection.password">inetdev</property> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <!-- Echo executed SQL statements --> <property name="hibernate.show_sql">true</property> <!-- SQL Dialect --> <!--<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>--> <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property> <!-- JDBC connection ppool (use the built-in) --> <property name="hibernate.connection.pool.size">1</property> <!-- Disable the second level cache --> <!-- <property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property> --> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> <!-- mapping files --> <mapping resource="com/ebrd/map/hibernate/model/UserEventGroup.hbm.xml"/> <!-- <mapping resource="com/ebrd/map/hibernate/model/Config.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/Event.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/EventGroup.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/EventRole.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/EventSession.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/EventType.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/EventTypeRole.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/Location.hbm.xml"/>
<mapping resource="com/ebrd/map/hibernate/model/Item.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/ItemGroup.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/ItemRelation.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/ItemRole.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/ItemType.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/ItemTypeRelation.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/Notification.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/SessionTemplate.hbm.xml"/> <mapping resource="com/ebrd/map/hibernate/model/Location.hbm.xml"/> --> </session-factory> </hibernate-configuration>
Mapping Document:
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping> <class name="com.ebrd.map.hibernate.model.UserEventGroup" table="map2_user_event_groups"> <id name="eventGroupID" column="'event_group_id'" type="long" unsaved-value="null"> <generator class="seqhilo"> <param name="sequence">seq_user_event_id</param> <param name="max_lo">1000</param> </generator> </id> <property name="userName" type="string" column="'user_name'" not-null="true"></property> </class> </hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Buildfile: C:\Development\eclipse\workspace\Map2\src\build.xml
schema-export:
[schemaexport] 09:56:48,387 INFO Environment:495 - Hibernate 3.2 cr1
[schemaexport] 09:56:48,403 INFO Environment:528 - hibernate.properties not found
[schemaexport] 09:56:48,403 INFO Environment:662 - Bytecode provider name : cglib
[schemaexport] 09:56:48,419 INFO Environment:579 - using JDK 1.4 java.sql.Timestamp handling
[schemaexport] 09:56:48,590 INFO Configuration:1346 - configuring from file: hibernate.cfg.xml
[schemaexport] 09:56:48,668 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
[schemaexport] 09:56:48,684 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
[schemaexport] 09:56:48,684 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
[schemaexport] 09:56:48,746 DEBUG Configuration:1273 - hibernate.connection.username=BAP
[schemaexport] 09:56:48,746 DEBUG Configuration:1273 - hibernate.connection.url=jdbc:oracle:thin:@ldn2com1.ebrd.com:1521:inetdev
[schemaexport] 09:56:48,762 DEBUG Configuration:1273 - hibernate.connection.password=inetdev
[schemaexport] 09:56:48,762 DEBUG Configuration:1273 - hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
[schemaexport] 09:56:48,762 DEBUG Configuration:1273 - hibernate.show_sql=true
[schemaexport] 09:56:48,762 DEBUG Configuration:1273 - hibernate.dialect=org.hibernate.dialect.OracleDialect
[schemaexport] 09:56:48,762 DEBUG Configuration:1273 - hibernate.connection.pool.size=1
[schemaexport] 09:56:48,762 DEBUG Configuration:1273 - hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
[schemaexport] 09:56:48,762 DEBUG Configuration:1468 - null<-org.dom4j.tree.DefaultAttribute@11bed71 [Attribute: name resource value "com/ebrd/map/hibernate/model/UserEventGroup.hbm.xml"]
[schemaexport] 09:56:48,762 INFO Configuration:473 - Reading mappings from resource: com/ebrd/map/hibernate/model/UserEventGroup.hbm.xml
[schemaexport] 09:56:48,777 DEBUG DTDEntityResolver:22 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
[schemaexport] 09:56:48,777 DEBUG DTDEntityResolver:24 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
[schemaexport] 09:56:48,777 DEBUG DTDEntityResolver:34 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
[schemaexport] 09:56:49,027 INFO HbmBinder:309 - Mapping class: com.ebrd.map.hibernate.model.UserEventGroup -> map_user_event_groups
[schemaexport] 09:56:49,042 DEBUG HbmBinder:1261 - Mapped property: eventGroupID -> event_group_id
[schemaexport] 09:56:49,074 DEBUG HbmBinder:1261 - Mapped property: userName -> user_name
[schemaexport] 09:56:49,074 INFO Configuration:1423 - Configured SessionFactory: null
[schemaexport] 09:56:49,074 DEBUG Configuration:1424 - properties: {hibernate.connection.password=inetdev, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=C:\Program Files\Java\jre1.5.0_06\bin, java.vm.version=1.5.0_06-b05, hibernate.connection.username=BAP, ant.library.dir=c:\Eclipse\plugins\org.apache.ant_1.6.5\lib, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=GB, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Development\eclipse\workspace\Map2, java.runtime.version=1.5.0_06-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\jre1.5.0_06\lib\endorsed, os.arch=x86, java.io.tmpdir=c:\windows\temp\, line.separator=
[schemaexport] , java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, ant.home=c:\Eclipse\plugins\org.apache.ant_1.6.5, sun.jnu.encoding=Cp1252, java.library.path=C:\WINDOWS\system32;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;i:\dll;C:\progra~1\oracle\ora817\bin;C:\Progra~1\Oracle\jre\1.1.7\bin;C:\Program Files\cvsnt;c:\cygwin\bin;C:\apache-ant-1.6.5\bin;C:\Program Files\Java\jdk1.5.0_06\bin;C:\Program Files\Rational\common;C:\Program Files\Rational\ClearCase\bin;c:\Eclipse\configuration\org.eclipse.osgi\bundles\525\1\.cp, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, user.home=C:\Documents and Settings\MartineW, user.timezone=Europe/London, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, java.class.path=C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-antlr.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-apache-bcel.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-apache-bsf.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-apache-log4j.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-apache-oro.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-apache-regexp.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-apache-resolver.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-commons-logging.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-commons-net.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-icontract.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-jai.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-javamail.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-jdepend.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-jmf.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-jsch.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-junit.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-launcher.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-netrexx.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-nodeps.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-starteam.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-stylebook.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-swing.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-trax.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-vaj.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-weblogic.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-xalan1.jar;C:\Eclipse\plugins\org.apache.ant_1.6.5\lib\ant-xslp.jar;C:\Eclipse\configuration\org.eclipse.osgi\bundles\391\1\.cp\lib\remoteAnt.jar;C:\Program Files\Java\jdk1.5.0_06\lib\tools.jar;C:\Eclipse\plugins\org.eclipse.swt.win32.win32.x86_3.1.2.jar, user.name=martinew, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\Program Files\Java\jre1.5.0_06, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.OracleDialect, hibernate.connection.url=jdbc:oracle:thin:@ldn2com1.ebrd.com:1521:inetdev, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.5.0_06, java.ext.dirs=C:\Program Files\Java\jre1.5.0_06\lib\ext, sun.boot.class.path=C:\Program Files\Java\jre1.5.0_06\lib\rt.jar;C:\Program Files\Java\jre1.5.0_06\lib\i18n.jar;C:\Program Files\Java\jre1.5.0_06\lib\sunrsasign.jar;C:\Program Files\Java\jre1.5.0_06\lib\jsse.jar;C:\Program Files\Java\jre1.5.0_06\lib\jce.jar;C:\Program Files\Java\jre1.5.0_06\lib\charsets.jar;C:\Program Files\Java\jre1.5.0_06\classes, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.connection.pool.size=1, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=}
[schemaexport] 09:56:49,136 INFO Dialect:106 - Using dialect: org.hibernate.dialect.OracleDialect
[schemaexport] 09:56:49,245 DEBUG Configuration:1006 - processing extends queue
[schemaexport] 09:56:49,245 DEBUG Configuration:1010 - processing collection mappings
[schemaexport] 09:56:49,245 DEBUG Configuration:1021 - processing native query and ResultSetMapping mappings
[schemaexport] 09:56:49,245 DEBUG Configuration:1029 - processing association property references
[schemaexport] 09:56:49,245 DEBUG Configuration:1051 - processing foreign key constraints
[schemaexport] 09:56:49,354 DEBUG Configuration:1006 - processing extends queue
[schemaexport] 09:56:49,354 DEBUG Configuration:1010 - processing collection mappings
[schemaexport] 09:56:49,354 DEBUG Configuration:1021 - processing native query and ResultSetMapping mappings
[schemaexport] 09:56:49,354 DEBUG Configuration:1029 - processing association property references
[schemaexport] 09:56:49,354 DEBUG Configuration:1051 - processing foreign key constraints
BUILD FAILED
C:\Development\eclipse\workspace\Map2\src\build.xml:64: java.lang.NullPointerException
|