-->
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.  [ 9 posts ] 
Author Message
 Post subject: org.hibernate.HibernateException: Dialect class not found
PostPosted: Thu Mar 18, 2010 10:07 pm 
Newbie

Joined: Thu Mar 18, 2010 6:57 pm
Posts: 8
reading the 2008 Harnessing Hibernate

the first example

when I ran and db (which requires the classpath) or ant prepare - it ran OK

but when I ran ant schema - got the following error

BUILD FAILED
org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.HSQLDialect hibernate.connection.driver_class=org.hsqldb.jdbcDriver
at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:239)
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:228)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:86)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
at org.hibernate.tool.hbm2x.Hbm2DDLExporter.doStart(Hbm2DDLExporter.java:78)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

in build.xml
<artifact:dependencies pathId="dependency.classpath">
<dependency groupId="hsqldb" artifactId="hsqldb" version="1.8.0.7"/>
<dependency groupId="org.hibernate" artifactId="hibernate"
version="3.2.6.ga">
<exclusion groupId="javax.transaction" artifactId="jta"/>
</dependency>
<dependency groupId="org.hibernate" artifactId="hibernate-tools"
version="3.2.3.GA"/>
<dependency groupId="org.apache.geronimo.specs"
artifactId="geronimo-jta_1.1_spec" version="1.1"/>
<dependency groupId="log4j" artifactId="log4j" version="1.2.14"/>
</artifact:dependencies>
<!-- Set up the class path for compilation and execution -->
<path id="project.class.path">
<pathelement location="${class.root}" />
<path refid="dependency.classpath"/>
</path>

<!-- Teach Ant how to use the Hibernate Tools -->
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.class.path"/>

/>

this obviously set the classpath

can you please let me know what is wrong?


Thanks


Report this post
Top
Profile
Edit post Reply with quote
Display posts from previous: Sort by
Post new topic Reply to topic Page 1 of 1
[ 1 post ]

Board index » Various » The Book Forum

All times are UTC - 5 hours [ DST ]

Who is online

Users browsing this forum: puma123 and 0 guests

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

Search for:

© Copyright 2009, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Fri Mar 19, 2010 6:26 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
There's something wrong in your hibernate configuration file where you define the dialect.
Please check the syntax.


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Fri Mar 19, 2010 4:23 pm 
Newbie

Joined: Thu Mar 18, 2010 6:57 pm
Posts: 8
The only file I changed is build.xml...what is the configure file you are talking about.

Thanks a lot.


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Wed Mar 24, 2010 1:07 am 
Newbie

Joined: Thu Mar 18, 2010 6:57 pm
Posts: 8
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:data/music
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.shutdown=true


This is property file - it is exactly the same as the book example


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Wed Mar 24, 2010 3:07 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi puma123,

Quote:
Dialect class not found: org.hibernate.dialect.HSQLDialect hibernate.connection.driver_class=org.hsqldb.jdbcDriver


Instead to search for class "org.hibernate.dialect.HSQLDialect"
hibernate searches for class
"org.hibernate.dialect.HSQLDialect hibernate.connection.driver_class=org.hsqldb.jdbcDriver"
which obvious doesn't correspond to a class.
This means that in your configuration file the value for the dialect "org.hibernate.dialect.HSQLDialect"
isn't clearly delimited so hibernate takes, consider also as value that what is following immediately after,
which is "hibernate.connection.driver_class=org.hsqldb.jdbcDriver".
Therefore there must be an error in the syntax.
How is the name of your hibernate configuration file?
(If it has suffix .xml then your current syntax is wrong)


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Thu Mar 25, 2010 6:16 pm 
Newbie

Joined: Thu Mar 18, 2010 6:57 pm
Posts: 8
good observation - now I have the following error ( the wierd thing is I have to put hibernate.jar, log4j.jar. commons-logging.jar etc. into Classpath to even reach here and the ant build.xml already have classpath dependency defined for ant!)

the configuration file is hibernate.properties and I have to put it on system classpath too... can you give further advice

Thanks.

- id=central, url=http://repo1.maven.org/maven2, releases=enabled, snapshots=disabled
org.apache.maven:super-pom:jar:2.0 (selected)

...........................
hsqldb:hsqldb:jar:1.8.0.7:compile (selected)
org.hibernate:hibernate:jar:3.2.5.ga:compile (selected)
net.sf.ehcache:ehcache:jar:1.2.3:compile (selected)
commons-logging:commons-logging:jar:1.0.4:compile (selected)
commons-collections:commons-collections:jar:2.1:compile (selected)
commons-logging:commons-logging:jar:1.0.4:compile (removed - nearer found: 1.0.4)
commons-logging:commons-logging:jar:1.0.4:compile (selected)
asm:asm-attrs:jar:1.5.3:compile (selected)
dom4j:dom4j:jar:1.6.1:compile (selected)
antlr:antlr:jar:2.7.6:compile (selected)
cglib:cglib:jar:2.1_3:compile (selected)
asm:asm:jar:1.5.3:compile (selected)
asm:asm:jar:1.5.3:compile (removed - nearer found: 1.5.3)
asm:asm:jar:1.5.3:compile (selected)
commons-collections:commons-collections:jar:2.1:compile (removed - nearer found: 2.1.1)
commons-collections:commons-collections:jar:2.1.1:compile (selected)
org.hibernate:hibernate-tools:jar:3.2.0.beta9a:compile (selected)
org.hibernate:hibernate:jar:3.2.0.cr5:compile (removed - nearer found: 3.2.5.ga)
freemarker:freemarker:jar:2.3.4:compile (selected)
org.hibernate:jtidy:jar:r8-20060801:compile (selected)
org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1:compile (selected)
log4j:log4j:jar:1.2.14:compile (selected)
Build sequence for target(s) `schema' is [prepare, schema]
Complete build sequence is [prepare, schema, db, codegen, ]

prepare:
.......................................................

schema:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.HSQLDialect

BUILD FAILED
org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.HSQLDialect
at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:239)
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:228)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:86)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
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:288)
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.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 2 seconds


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Thu Mar 25, 2010 6:41 pm 
Newbie

Joined: Thu Mar 18, 2010 6:57 pm
Posts: 8
The class is on classpath since the following test found the class (just there is no a main method in that class)....

~/study/examples/ch02$ java org.hibernate.dialect.HSQLDialect
Exception in thread "main" java.lang.NoSuchMethodError: main


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Fri Mar 26, 2010 3:41 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
The class is on classpath


Yes.
org.hibernate.dialect.HSQLDialect is in hiberante3.jar
and hiberante3.jar is definitely contained in classpath, because it finds other classes for example
org.hibernate.dialect.Dialect which is also contained in hibernate3.jar
Code:
at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:239)


The problem is probably that you specified a additional blank before or after the class specification.
I believe you specified
Code:
"org.hibernate.dialect.HSQLDialect "


(=with a dangling blank) instead to

Code:
"org.hibernate.dialect.HSQLDialect"


Top
 Profile  
 
 Post subject: Re: org.hibernate.HibernateException: Dialect class not found
PostPosted: Fri Apr 30, 2010 1:39 am 
Newbie

Joined: Thu Mar 18, 2010 6:57 pm
Posts: 8
Thanks.

Now I got this in Chap10.

/examples/ch10/src/com/oreilly/hh/CreateTest.java:73: cannot find symbol
[javac] symbol : constructor Track(java.lang.String,java.lang.String,java.sql.Time,java.util.HashSet<com.oreilly.hh.data.Artist>,java.util.Date,com.oreilly.hh.StereoVolume,com.oreilly.hh.SourceMedia,java.util.HashSet<java.lang.String>)
[javac] location: class com.oreilly.hh.data.Track
[javac] track = new Track("Video Killed the Radio Star",


The signature of constructor in Track.java generated from Track.hbm.xml is
public Track(String title, String filePath, Date playTime, Set<Artist> artists, Date added, StereoVolumeType volume, SourceMediaType sourceMedia, Set<String> comments) {^M



The constructor in Track.java is like this

Track track = new Track(title, file, length, new HashSet<Artist>(),
new Date(), new StereoVolume(), SourceMedia.CD,
new HashSet<String>());


the type of new StereoVolume(), SourceMedia.CD are incompatiblet...

why will this happen and how to fix it?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.