-->
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.  [ 7 posts ] 
Author Message
 Post subject: Ant; Velocity engine could not be initialized
PostPosted: Wed Jun 15, 2005 9:02 am 
Newbie

Joined: Wed Jun 15, 2005 8:51 am
Posts: 11
Hello,

I try to create some ant tasks for Hibernate 3.0.5 with Hibernate tools 3.0 alpha 4a.
I also used the eclipse plugin succesfull, but rather have it in an ant file, so I can repeat it.
Using <hbm2ddl> was also succesfull; but when I try <hbm2java> I get:
build.xml:116: org.hibernate.tool.hbm2x.ExporterException: Velocity engine could not be initialized

What am I doing wrong????
Thanx in advance!!!
Marcel


Here my antfile:
....
<!-- ===================================== -->
<!-- Hibernate -->
<!-- ===================================== -->
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="lib/hibernate-tools.jar; lib/velocity-1.4.jar; lib/velocity-tools-generic-1.4.jar; lib/jtidy-r8-21122004.jar; lib/hibernate3.jar; lib/classes12_9.1.0.4.zip;lib/commons-logging-1.0.4.jar; lib/dom4j-1.6.jar;lib/commons-collections-2.1.1.jar;lib/cglib-2.1.jar;lib/jta.jar;lib/ehcache-1.1.jar" />

<target name="hibernateJava" depends="init">
<hibernatetool destdir="${source}">
<classpath>
<path location="${classes}" />
</classpath>
<jdbcconfiguration configurationfile="hibernate.cfg.xml" packagename="com.xxx.domain" revengfile="hibernate.reveng.xml"/>
<hbm2java generics="true" />
<cfg2cfgXml/>
</hibernatetool>
</target>
....

My hibernate.cfg.xml:
<hibernate-configuration>
<session-factory name="PPS">
<property name="hibernate.show_sql">true</property>
<property name="hibernate.connection.username">xxx</property>
<property name="hibernate.connection.password">xxx</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@xxx:1521:xxx</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
</session-factory>
</hibernate-configuration>

My hibernate.reveng.xml:
<hibernate-reverse-engineering>
<table-filter match-schema="xxx" match-name=".*"/>
<table-filter match-schema=".*" match-name=".*" exclude="true" />
</hibernate-reverse-engineering>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 10:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what is the execption ?

use -verbose to get it (or -debug)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 10:07 am 
Newbie

Joined: Wed Jun 15, 2005 8:51 am
Posts: 11
an org.hibernate.tool.hbm2x.ExporterException...

see:
Buildfile: C:\eclipse\workspace\xxx\build.xml
init:
hibernateJava:
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] 15-jun-2005 16:03:38 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.0.5
[hibernatetool] 15-jun-2005 16:03:38 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 15-jun-2005 16:03:38 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using CGLIB reflection optimizer
[hibernatetool] 15-jun-2005 16:03:38 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 15-jun-2005 16:03:38 org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] 15-jun-2005 16:03:38 org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: PPS
[hibernatetool] 15-jun-2005 16:03:38 org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernatetool] INFO: Override file: C:\eclipse\workspace\xxx\hibernate.reveng.xml
[hibernatetool] 15-jun-2005 16:03:39 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] 15-jun-2005 16:03:39 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] 15-jun-2005 16:03:39 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] 15-jun-2005 16:03:39 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: oracle.jdbc.OracleDriver at URL: jdbc:oracle:thin:@xxx:1521:xxx
[hibernatetool] 15-jun-2005 16:03:39 org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=xxx, password=****}
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: RDBMS: Oracle, version: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
[hibernatetool] With the Partitioning, OLAP and Oracle Data Mining options
[hibernatetool] JServer Release 9.2.0.1.0 - Production
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC driver: Oracle JDBC driver, version: 9.0.1.4.0
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.OracleDialect
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernatetool] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernatetool] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic flush during beforeCompletion(): disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic session close at end of transaction: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC batch size: 15
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC batch updates for versioned data: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Scrollable result sets: enabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC3 getGeneratedKeys(): disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Connection release mode: null
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default batch fetch size: 1
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Generate SQL with comments: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Order SQL updates by primary key: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernatetool] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernatetool] INFO: Using ASTQueryTranslatorFactory
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query language substitutions: {}
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Second-level cache: enabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query cache: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernatetool] INFO: Cache provider: org.hibernate.cache.EhCacheProvider
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Optimize cache for minimal puts: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Structured second-level cache entries: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Echoing all SQL to stdout
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Statistics: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernatetool] 15-jun-2005 16:03:41 org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default entity-mode: pojo
[hibernatetool] 15-jun-2005 16:03:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing extends queue
[hibernatetool] 15-jun-2005 16:03:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing collection mappings
[hibernatetool] 15-jun-2005 16:03:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing association property references
[hibernatetool] 15-jun-2005 16:03:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing foreign key constraints

BUILD FAILED
C:\eclipse\workspace\LabSpEx\build.xml:116: org.hibernate.tool.hbm2x.ExporterException: Velocity engine could not be initialized

Total time: 13 seconds


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 10:12 am 
Newbie

Joined: Wed Jun 15, 2005 8:51 am
Posts: 11
and the exception:

C:\eclipse\workspace\xxx\build.xml:116: org.hibernate.tool.hbm2x.ExporterException: Velocity engine could not be initialized
at org.apache.tools.ant.Task.perform(Task.java:373)
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.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: org.hibernate.tool.hbm2x.ExporterException: Velocity engine could not be initialized
at org.hibernate.tool.hbm2x.TemplateHelper.init(TemplateHelper.java:69)
at org.hibernate.tool.hbm2x.AbstractExporter.setupTemplates(AbstractExporter.java:94)
at org.hibernate.tool.hbm2x.POJOExporter.start(POJOExporter.java:101)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:33)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.apache.velocity.tools.generic.log.CommonsLogLogSystem
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.velocity.runtime.log.LogManager.createLogSystem(LogManager.java:123)
at org.apache.velocity.runtime.RuntimeInstance.initializeLogger(RuntimeInstance.java:553)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:226)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461)
at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:106)
at org.hibernate.tool.hbm2x.TemplateHelper.init(TemplateHelper.java:66)
... 14 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Velocity engine could not be initialized
at org.hibernate.tool.hbm2x.TemplateHelper.init(TemplateHelper.java:69)
at org.hibernate.tool.hbm2x.AbstractExporter.setupTemplates(AbstractExporter.java:94)
at org.hibernate.tool.hbm2x.POJOExporter.start(POJOExporter.java:101)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:33)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
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.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: java.lang.ClassNotFoundException: org.apache.velocity.tools.generic.log.CommonsLogLogSystem
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.velocity.runtime.log.LogManager.createLogSystem(LogManager.java:123)
at org.apache.velocity.runtime.RuntimeInstance.initializeLogger(RuntimeInstance.java:553)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:226)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461)
at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:106)
at org.hibernate.tool.hbm2x.TemplateHelper.init(TemplateHelper.java:66)
... 14 more


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 10:13 am 
Newbie

Joined: Thu Jun 09, 2005 10:34 am
Posts: 10
The velocity tools that comes with hibernate-tools is velocity-tools-generic-1.1.jar, not velocity-tools-generic-1.4.jar. Try changing that in your classpath.

This appears to be a bug in the docs.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 10:15 am 
Newbie

Joined: Wed Jun 15, 2005 8:51 am
Posts: 11
fantastic!

Thanx for your help


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 3:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you think there is a bug in the docs please add it to the 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.  [ 7 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.