-->
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: Problem with hbm2ddl task
PostPosted: Sat Dec 03, 2005 6:45 pm 
Beginner
Beginner

Joined: Sat Dec 03, 2005 11:12 am
Posts: 27
Hi team,
I know it would be silly to ask this but i couldnt get rid of this problem. i am running hbm2ddl task of the build file which throws an exception java.lang.ClassNotFoundException:
oracle.jdbc.driver.OracleDriver but i am pretty sure that the jdbc dirvers (classes12.zip) are on the class path.

I have a hibenate application(standalone) which connects to database in the same project without throwing any exception but when i try to generate schema with ant it throws this exception. Please help me....

hbm2ddl:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] (cfg.Environment 474 ) Hibernate 3.1 rc1
[hibernatetool] (cfg.Environment 504 ) hibernate.properties not found
[hibernatetool] (cfg.Environment 520 ) using CGLIB reflection optimizer
[hibernatetool] (cfg.Environment 550 ) using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] (cfg.Configuration 1291) configuring from file: hibernate.cfg.xml
[hibernatetool] (cfg.Configuration 460 ) Reading mappings from resource: Customer.hbm.xml
[hibernatetool] (cfg.HbmBinder 266 ) Mapping class: Customer -> customer
[hibernatetool] (cfg.Configuration 1368) Configured SessionFactory: null
[hibernatetool] (cfg.Configuration 1014) processing extends queue
[hibernatetool] (cfg.Configuration 1018) processing collection mappings
[hibernatetool] (cfg.Configuration 1027) processing association property references
[hibernatetool] (cfg.Configuration 1049) processing foreign key constraints
[hibernatetool] (dialect.Dialect 100 ) Using dialect: org.hibernate.dialect.OracleDialect
[hibernatetool] (cfg.Configuration 1014) processing extends queue
[hibernatetool] (cfg.Configuration 1018) processing collection mappings
[hibernatetool] (cfg.Configuration 1027) processing association property references
[hibernatetool] (cfg.Configuration 1049) processing foreign key constraints
[hibernatetool] (cfg.Configuration 1014) processing extends queue
[hibernatetool] (cfg.Configuration 1018) processing collection mappings
[hibernatetool] (cfg.Configuration 1027) processing association property references
[hibernatetool] (cfg.Configuration 1049) processing foreign key constraints
[hibernatetool] (hbm2ddl.SchemaExport 153 ) Running hbm2ddl schema export
[hibernatetool] (hbm2ddl.SchemaExport 175 ) writing generated schema to file: E:\Java\eclipse\workspace\MyProjects\import\my-schema.ddl
[hibernatetool] (hbm2ddl.SchemaExport 180 ) exporting generated schema to database
[hibernatetool] (connection.DriverManagerConnectionProvider 41 ) Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] (connection.DriverManagerConnectionProvider 42 ) Hibernate connection pool size: 3
[hibernatetool] (connection.DriverManagerConnectionProvider 45 ) autocommit mode: false
[hibernatetool] (connection.DriverManagerConnectionProvider 65 ) JDBC Driver class not found: oracle.jdbc.driver.OracleDriver
[hibernatetool] java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
[hibernatetool] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1166)
[hibernatetool] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1107)
[hibernatetool] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977)
[hibernatetool] at java.lang.ClassLoader.loadClass(Unknown Source)
[hibernatetool] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[hibernatetool] at java.lang.Class.forName0(Native Method)
[hibernatetool] at java.lang.Class.forName(Unknown Source)
[hibernatetool] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[hibernatetool] at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:61)
[hibernatetool] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
[hibernatetool] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport$ProviderConnectionHelper.getConnection(SchemaExport.java:453)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:181)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
[hibernatetool] at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:48)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:144)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatetool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[hibernatetool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[hibernatetool] (hbm2ddl.SchemaExport 206 ) schema export unsuccessful
[hibernatetool] org.hibernate.HibernateException: JDBC Driver class not found: oracle.jdbc.driver.OracleDriver
[hibernatetool] at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:66)
[hibernatetool] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
[hibernatetool] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport$ProviderConnectionHelper.getConnection(SchemaExport.java:453)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:181)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
[hibernatetool] at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:48)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:144)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatetool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[hibernatetool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[hibernatetool] Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
[hibernatetool] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1166)
[hibernatetool] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1107)
[hibernatetool] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977)
[hibernatetool] at java.lang.ClassLoader.loadClass(Unknown Source)
[hibernatetool] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[hibernatetool] at java.lang.Class.forName0(Native Method)
[hibernatetool] at java.lang.Class.forName(Unknown Source)
[hibernatetool] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[hibernatetool] at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:61)
[hibernatetool] ... 18 more
(connection.DriverManagerConnectionProvider 147 ) cleaning up connection pool: null
BUILD SUCCESSFUL
Total time: 3 seconds


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 03, 2005 9:57 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
you need to put oracle.jdbc.driver.OracleDriver in the classpath. i don't know what classes12.zip is supposed to do but this typically is a file that ends with "jar" .


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 4:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
.zip is a .jar and a .jar is a .zip ;)

but since you do get a class not found exception then it is definitly not on the classpath when hbm2ddl is running.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 5:50 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
max wrote:
.zip is a .jar and a .jar is a .zip


I think it is safe to say Oracle doesn't distribute their drivers this way.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 11:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no - oracle *does* distribute classes12.zip. Their newer versions *also* include a *.jar.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 1:00 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
they really name it classes12 ? well, it fooled me. I've worked in a 10g shop for about 9 monthes now and I have only seen jars.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 1:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
go look in 10.1.0\Db_2\jdbc\lib and learn ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 5:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I usually rename classes12.zip to classes12.jar so you know all class loaders will find it as they don't always pickup a zip extension. The first time classes12.zip was around Oracle8 (from memory) and it was for the Java 1.2 JRE there was also classes11.zip for earlier JREs.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 8:47 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
apparently my client has a policy of renaming these to something descriptive ;)


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.