-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problems running eg example with iSeries JDBC driver
PostPosted: Thu Jul 01, 2004 9:37 am 
Newbie

Joined: Thu Jul 01, 2004 9:19 am
Posts: 2
I am having problems running the example 'eg' (Hibernate version 2.1) with the iSeries Toolbox for Java JDBC driver (V5R2).

I have copied the jt400.jar file (that contains the JDBC driver classes) into the lib directory, but when I run build eg from the command prompt, I get the following:


Code:
E:\Program Files\Hibernate\hibernate-2.1>build eg

E:\Program Files\Hibernate\hibernate-2.1>set JDBC_DRIVER=C:\mysql\mysql-connector-java-3.0.8-stable-bin.jar

E:\Program Files\Hibernate\hibernate-2.1>java -cp "lib/ant-1.5.3.jar;lib/ant-optional-1.5.3.jar;lib/junit-3.8.1.jar;lib/xerces-2.4.0
.jar;C:\PROGRA~1\Java\J2SDK1~1.1_0/lib/tools.jar" org.apache.tools.ant.Main -Ddriver.jar=C:\mysql\mysql-connector-java-3.0.8-stable-
bin.jar eg
Buildfile: build.xml
  [taskdef] Could not load definitions from resource clovertasks. It could not be found.

eg:
     [echo] remember to place your JDBC driver in the lib directory
     [java] 14:09:34,529  INFO Environment:462 - Hibernate 2.1.4
     [java] 14:09:34,576  INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_
class=com.ibm.as400.access.AS400JDBCDriver , hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.eh
cache.hibernate.Provider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dial
ect.DB2400Dialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, fa
lse 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=MyUser, hibernate.cache.region_prefix=hiberna
te.test, hibernate.connection.url=jdbc:as400://MyiSeries, hibernate.connection.password=MyPassword, hibernate.connection.pool_size=1}
     [java] 14:09:34,576  INFO Environment:521 - using java.io streams to persist binary types
     [java] 14:09:34,576  INFO Environment:522 - using CGLIB reflection optimizer
     [java] 14:09:34,591  INFO Configuration:347 - Mapping resource: org/hibernate/auction/AuctionItem.hbm.xml
     [java] 14:09:35,513  INFO Binder:229 - Mapping class: org.hibernate.auction.AuctionItem -> AuctionItem
     [java] 14:09:35,701  INFO Configuration:347 - Mapping resource: org/hibernate/auction/Bid.hbm.xml
     [java] 14:09:35,779  INFO Binder:229 - Mapping class: org.hibernate.auction.Bid -> Bid
     [java] 14:09:35,857  INFO Binder:169 - Mapping subclass: org.hibernate.auction.BuyNow -> Bid
     [java] 14:09:35,857  INFO Configuration:347 - Mapping resource: org/hibernate/auction/User.hbm.xml
     [java] 14:09:35,966  INFO Binder:229 - Mapping class: org.hibernate.auction.User -> AuctionUser
     [java] 14:09:36,279  INFO ReflectHelper:176 - reflection optimizer disabled for: org.hibernate.auction.Name, IllegalArgumentExc
eption: Cannot find matching method/constructor
     [java] 14:09:36,279  INFO Configuration:613 - processing one-to-many association mappings
     [java] 14:09:36,279  INFO Binder:1168 - Mapping collection: org.hibernate.auction.AuctionItem.bids -> Bid
     [java] 14:09:36,279  INFO Binder:1168 - Mapping collection: org.hibernate.auction.User.bids -> Bid
     [java] 14:09:36,295  INFO Binder:1168 - Mapping collection: org.hibernate.auction.User.auctions -> AuctionItem
     [java] 14:09:36,295  INFO Configuration:622 - processing one-to-one association property references
     [java] 14:09:36,295  INFO Configuration:647 - processing foreign key constraints
     [java] 14:09:36,326  INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.DB2400Dialect
     [java] 14:09:36,341  INFO SettingsFactory:58 - Maximim outer join fetch depth: 1
     [java] 14:09:36,341  INFO SettingsFactory:62 - Use outer join fetching: true
     [java] 14:09:36,357  INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use
!)
     [java] net.sf.hibernate.HibernateException: JDBC Driver class not found: com.ibm.as400.access.AS400JDBCDriver
     [java] 14:09:36,357  INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 1
     [java]     at net.sf.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:63)
     [java] 14:09:36,357 FATAL DriverManagerConnectionProvider:62 - JDBC Driver class not found: com.ibm.as400.access.AS400JDBCDrive
r
     [java]     at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
     [java]     at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:64)
     [java]     at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
     [java]     at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
     [java]     at org.hibernate.auction.Main.main(Main.java:363)
     [java] Exception in thread "main"

BUILD FAILED
file:E:/Program%20Files/Hibernate/hibernate-2.1/build.xml:458: Java returned: 1

Total time: 4 seconds


The root error appears to be : -

Code:
[java] net.sf.hibernate.HibernateException: JDBC Driver class not found: com.ibm.as400.access.AS400JDBCDriver


which indicates that it cannot find the driver class.

My hibernate.properties file contains the following:

Code:
######################
### Query Language ###
######################

## define query language constants / function names

hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'



#################
### Platforms ###
#################

## JNDI Datasource

#hibernate.connection.datasource jdbc/test
#hibernate.connection.username db2
#hibernate.connection.password db2


## HypersonicSQL

#hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
#hibernate.connection.driver_class org.hsqldb.jdbcDriver
#hibernate.connection.username sa
#hibernate.connection.password
#hibernate.connection.url jdbc:hsqldb:hsql://localhost
#hibernate.connection.url jdbc:hsqldb:test
#hibernate.connection.url jdbc:hsqldb:.


## PostgreSQL

#hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
#hibernate.connection.driver_class org.postgresql.Driver
#hibernate.connection.url jdbc:postgresql:template1
#hibernate.connection.username pg
#hibernate.connection.password
#hibernate.query.substitutions yes 'Y', no 'N'


## DB2

#hibernate.dialect net.sf.hibernate.dialect.DB2Dialect
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
#hibernate.connection.url jdbc:db2:test
#hibernate.connection.username db2
#hibernate.connection.password db2


## DB2/400

hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect
hibernate.connection.username MyUser
hibernate.connection.password MyPassword

## Native driver
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
#hibernate.connection.url jdbc:db2://systemname

## Toolbox driver
hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
hibernate.connection.url jdbc:as400://MyiSeries


## MySQL

#hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
#hibernate.connection.driver_class org.gjt.mm.mysql.Driver
#hibernate.connection.driver_class com.mysql.jdbc.Driver
#hibernate.connection.url jdbc:mysql:///test
#hibernate.connection.username root
#hibernate.connection.password


## Oracle

#hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect
#hibernate.dialect net.sf.hibernate.dialect.OracleDialect
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
#hibernate.connection.username ora
#hibernate.connection.password ora
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test


## Sybase

#hibernate.dialect net.sf.hibernate.dialect.SybaseDialect
#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
#hibernate.connection.username sa
#hibernate.connection.password sasasa
#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb


## Mckoi SQL

#hibernate.dialect net.sf.hibernate.dialect.MckoiDialect
#hibernate.connection.driver_class com.mckoi.JDBCDriver
#hibernate.connection.url jdbc:mckoi:///
#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
#hibernate.connection.username admin
#hibernate.connection.password nimda


## SAP DB

#hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect
#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
#hibernate.connection.url jdbc:sapdb://localhost/TST
#hibernate.connection.username TEST
#hibernate.connection.password TEST
#hibernate.query.substitutions yes 'Y', no 'N'


## MS SQL Server

#hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
#hibernate.connection.username sa
#hibernate.connection.password sa

## JSQL Driver
#hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
#hibernate.connection.url jdbc:JSQLConnect://1E1/test

## JTURBO Driver
#hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
#hibernate.connection.url jdbc:JTurbo://1E1:1433/test

## WebLogic Driver
#hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
#hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433

## Microsoft Driver (not recommended!)
#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor

## jTDS
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor
#hibernate.jdbc.use_scrollable_resultset false

## Interbase

#hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect
#hibernate.connection.username sysdba
#hibernate.connection.password masterkey

## DO NOT specify hibernate.connection.sqlDialect

## InterClient

#hibernate.connection.driver_class interbase.interclient.Driver
#hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb

## Pure Java

#hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
#hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb


## Pointbase

#hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect
#hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
#hibernate.connection.url jdbc:pointbase:embedded:sample
#hibernate.connection.username PBPUBLIC
#hibernate.connection.password PBPUBLIC



#################################
### Hibernate Connection Pool ###
#################################

hibernate.connection.pool_size 1



###########################
### C3P0 Connection Pool###
###########################

#hibernate.c3p0.max_size 2
#hibernate.c3p0.min_size 2
#hibernate.c3p0.timeout 5000
#hibernate.c3p0.max_statements 100
#hibernate.c3p0.idle_test_period 3000
#hibernate.c3p0.acquire_increment 2
##hibernate.c3p0.validate false



###################################
### Apache DBCP Connection Pool ###
###################################

## connection pool

#hibernate.dbcp.maxActive 100
#hibernate.dbcp.whenExhaustedAction 1
#hibernate.dbcp.maxWait 120000
#hibernate.dbcp.maxIdle 10

## prepared statement cache

#hibernate.dbcp.ps.maxActive 100
#hibernate.dbcp.ps.whenExhaustedAction 1
#hibernate.dbcp.ps.maxWait 120000
#hibernate.dbcp.ps.maxIdle 10

## optional query to validate pooled connections:

#hibernate.dbcp.validationQuery select 1 from dual
#hibernate.dbcp.testOnBorrow true
#hibernate.dbcp.testOnReturn false



##############################
### Proxool Connection Pool###
##############################

## Properties for external configuration of Proxool

hibernate.proxool.pool_alias pool1

## Only need one of the following

#hibernate.proxool.existing_pool true
#hibernate.proxool.xml proxool.xml
#hibernate.proxool.properties proxool.properties



#################################
### Plugin ConnectionProvider ###
#################################

## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)

#hibernate.connection.provider_class net.sf.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.C3P0ConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.DBCPConnectionProvider
#hibernate.connection.provider_class net.sf.hibernate.connection.ProxoolConnectionProvider



#######################
### Transaction API ###
#######################

## the Transaction API abstracts application code from the underlying JTA or JDBC transactions

#hibernate.transaction.factory_class net.sf.hibernate.transaction.JTATransactionFactory
#hibernate.transaction.factory_class net.sf.hibernate.transaction.JDBCTransactionFactory


## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
## default is java:comp/UserTransaction
## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class

#jta.UserTransaction jta/usertransaction
#jta.UserTransaction javax.transaction.UserTransaction
#jta.UserTransaction UserTransaction


## to use JCS caching with JTA, Hibernate must be able to obtain the JTA TransactionManager

#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.JBossTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.OrionTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.ResinTransactionManagerLookup



##############################
### Miscellaneous Settings ###
##############################

## print all generated SQL to the console

#hibernate.show_sql true


## auto schema export

#hibernate.hbm2ddl.auto create-drop
#hibernate.hbm2ddl.auto create
#hibernate.hbm2ddl.auto update


## specify a JDBC isolation level

#hibernate.connection.isolation 4


## set the JDBC fetch size

#hibernate.jdbc.fetch_size 25


## set the maximum JDBC 2 batch size (a nonzero value enables batching)

hibernate.jdbc.batch_size 0


## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)

#hibernate.jdbc.use_scrollable_resultset true


## use streams when writing binary types to / from JDBC

hibernate.jdbc.use_streams_for_binary true


## use JDBC 3 PreparedStatement.getGeneratedKeys to get the identifier of an inserted row

#hibernate.jdbc.use_get_generated_keys true


## specify a default schema for unqualified tablenames

#hibernate.default_schema test


## use a custom stylesheet for XML generation (if not specified, hibernate-default.xslt will be used)

#hibernate.xml.output_stylesheet C:/Hibernate/net/sf/hibernate/hibernate-default.xslt


## enable outerjoin fetching (specifying a Dialect will cause Hibernate to use sensible default)

#hibernate.use_outer_join false


## set the maximum depth of the outer join fetch tree

hibernate.max_fetch_depth 1


## enable CGLIB reflection optimizer (enabled by default)

#hibernate.cglib.use_reflection_optimizer false



##########################
### Second-level Cache ###
##########################

## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)

#hibernate.cache.use_minimal_puts true


## set a prefix for cache region names

hibernate.cache.region_prefix hibernate.test


## enable the query cache

hibernate.cache.use_query_cache true


## choose a cache implementation

hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider
#hibernate.cache.provider_class net.sf.hibernate.cache.EmptyCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.HashtableCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider
#hibernate.cache.provider_class net.sf.hibernate.cache.SwarmCacheProvider



############
### JNDI ###
############

## specify a JNDI name for the SessionFactory

#hibernate.session_factory_name hibernate/session_factory


## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
## is the best approach in an application server

#file system
#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
#hibernate.jndi.url file:/

#WebSphere
#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
#hibernate.jndi.url iiop://localhost:900/


Contents of lib directory:

Code:
E:\Program Files\Hibernate\hibernate-2.1>cd lib

E:\Program Files\Hibernate\hibernate-2.1\lib>dir
Volume in drive E is Data
Volume Serial Number is 7CC5-ABD5

Directory of E:\Program Files\Hibernate\hibernate-2.1\lib

01/07/2004  12:05    <DIR>          .
01/07/2004  12:05    <DIR>          ..
26/04/2004  01:57           737,884 ant-1.5.3.jar
26/04/2004  01:57           671,546 ant-optional-1.5.3.jar
26/04/2004  01:57             2,717 apache.license.txt
26/04/2004  01:57           348,666 c3p0-0.8.4.5.jar
26/04/2004  01:57            26,921 c3p0.license.txt
26/04/2004  01:57           300,056 cglib-full-2.0.1.jar
26/04/2004  01:57           165,119 commons-collections-2.1.jar
26/04/2004  01:57           100,776 commons-dbcp-1.1.jar
26/04/2004  01:57            63,980 commons-lang-1.0.1.jar
26/04/2004  01:57            31,605 commons-logging-1.0.3.jar
26/04/2004  01:57            39,523 commons-pool-1.1.jar
26/04/2004  01:57           171,071 concurrent-1.3.2.jar
26/04/2004  01:57            17,978 connector.jar
26/04/2004  01:57             9,790 connector.licence.txt
26/04/2004  01:57           486,522 dom4j-1.4.jar
26/04/2004  01:57            42,069 ehcache-0.7.jar
02/06/2004  14:15           539,731 hsqldb.jar
26/04/2004  01:57           104,359 jaas.jar
26/04/2004  01:57             9,863 jaas.licence.txt
26/04/2004  01:57           156,505 jboss-cache.jar
26/04/2004  01:57           287,213 jboss-common.jar
26/04/2004  01:57           576,871 jboss-jmx.jar
26/04/2004  01:57           170,923 jboss-system.jar
26/04/2004  01:57           293,789 jcs-1.0-dev.jar
26/04/2004  01:57             6,727 jdbc2_0-stdext.jar
26/04/2004  01:57             7,932 jdbc2_0-stdext.licence.txt
26/04/2004  01:57         1,614,796 jgroups-2.2.1.jar
[b]17/11/2003  20:54         3,466,770 jt400.jar[/b]
26/04/2004  01:57             8,812 jta.jar
26/04/2004  01:57             9,830 jta.licence.txt
26/04/2004  01:57           121,070 junit-3.8.1.jar
26/04/2004  01:57           352,668 log4j-1.2.8.jar
26/04/2004  01:57            13,091 odmg-3.0.jar
26/04/2004  01:57           110,208 oscache-2.0.jar
26/04/2004  01:57           475,943 proxool-0.8.3.jar
02/06/2004  14:15             2,070 README.txt
26/04/2004  01:57            30,602 swarmcache-1.0rc2.jar
26/04/2004  01:57           997,276 xalan-2.4.0.jar
26/04/2004  01:57           895,813 xerces-2.4.0.jar
26/04/2004  01:57           123,705 xml-apis.jar
              40 File(s)     13,592,790 bytes
               2 Dir(s)   2,385,346,560 bytes free


Thanks in advance for any help


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 01, 2004 9:40 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
There is a typo in the default properties of Hibernate <= 2.1.4: a simple whitespace after the driver name. You can see this in your log out. Remove it and all will be well.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 01, 2004 9:44 am 
Newbie

Joined: Thu Jul 01, 2004 9:19 am
Posts: 2
Yes, that's fixed it... many thanks for your (very fast) help.


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