File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate problem" Watch "Hibernate problem" New topic
Author

Hibernate problem

Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Hi,myself BUBI
I have started learning hibernate recently.I faced a strange error.I am using eclipse as the IDE.Please help me to fix the problem.





the error I am getting is....
Sep 21, 2009 2:51:09 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.4.sp1
Sep 21, 2009 2:51:09 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Sep 21, 2009 2:51:09 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Sep 21, 2009 2:51:09 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Sep 21, 2009 2:51:09 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Sep 21, 2009 2:51:09 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Sep 21, 2009 2:51:10 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : com/sample/Person.hbm.xml
Sep 21, 2009 2:51:10 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.sample.person -> Person
Sep 21, 2009 2:51:10 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Sep 21, 2009 2:51:10 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Sep 21, 2009 2:51:10 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Sep 21, 2009 2:51:10 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Sep 21, 2009 2:51:11 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:MySQL://127.0.0.1:3306/mysql
Sep 21, 2009 2:51:11 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.0.51b-community-nt
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.8 ( Revision: ${svn.Revision} )
Sep 21, 2009 2:51:11 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
Sep 21, 2009 2:51:11 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
Sep 21, 2009 2:51:11 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Sep 21, 2009 2:51:11 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.HashtableCacheProvider
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Sep 21, 2009 2:51:11 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Sep 21, 2009 2:51:12 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
at org.hibernate.bytecode.cglib.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:33)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:182)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:160)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.sample.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:18)
at com.sample.TestPerson.main(TestPerson.java:11)
Exception in thread "main" java.lang.NullPointerException
at com.sample.TestPerson.main(TestPerson.java:11)


Please help me to debug the program
Thanks in advance BUBI


Thanks a lot in advance for your support
BUBI gupta
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3881

You are missing some jar(s) (cglib-xx.jar) which causes the given exception. You will find it in the "lib" dir of hibernate distro.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Hi Vijitha,

Thank you so much for your reply.It has now got no problem with the SessionFactory.But I found a strange error...

Sep 21, 2009 11:11:11 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.DB2Dialect
Sep 21, 2009 11:11:12 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.DB2Dialect
Sep 21, 2009 11:11:12 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.DB2Dialect
Sep 21, 2009 11:11:12 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.DB2Dialect
/*foo*/ select * from ( select rownumber() over() as rownumber_, * from foos ) as temp_ where rownumber_ between ?+1 and ?
/*foo*/ select * from ( select rownumber() over() as rownumber_, row_.* from ( select distinct * from foos ) as row_ ) as temp_ where rownumber_ between ?+1 and ?
/*foo*/ select * from ( select rownumber() over(order by foo.bar, foo.baz) as rownumber_, * from foos foo order by foo.bar, foo.baz ) as temp_ where rownumber_ between ?+1 and ?
/*foo*/ select * from ( select rownumber() over() as rownumber_, row_.* from ( select distinct * from foos foo order by foo.bar, foo.baz ) as row_ ) as temp_ where rownumber_ between ?+1 and ?

Please help me out to fix the problem.I am actually a beginner in hibernate.Thanks a ton for your earnest support.

Thanking you
BUBI


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62286
    
  68

"bubi bubi", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Hi Vijitha,

The strange errors ultimately removed...But it was replaced by another errors.

Let me first tell you the jar files I am using are...

mysql.jar
slf4j-api-1.5.2.jar
slf4j-jdk14-1.5.2.jar
hibernate3.jar
dom4j-1.6.1.jar
javassist-3.4.ga.jar
commons-collections-3.2.1.jar
jta-1.1.jar
antlr-2.7.6.jar
commons-logging-1.1.1.jar
cglib-2.2.jar.

Now the files are..




The error I am getting is...
Sep 22, 2009 1:03:21 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.4.sp1
Sep 22, 2009 1:03:21 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Sep 22, 2009 1:03:21 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Sep 22, 2009 1:03:21 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Sep 22, 2009 1:03:21 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Sep 22, 2009 1:03:21 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Sep 22, 2009 1:03:21 AM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : com/sample/Person.hbm.xml
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.sample.person -> Person
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Sep 22, 2009 1:03:22 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Sep 22, 2009 1:03:22 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Sep 22, 2009 1:03:22 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Sep 22, 2009 1:03:22 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:MySQL://127.0.0.1:3306/mysql
Sep 22, 2009 1:03:22 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.0.51b-community-nt
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.8 ( Revision: ${svn.Revision} )
Sep 22, 2009 1:03:22 AM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
Sep 22, 2009 1:03:22 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
Sep 22, 2009 1:03:22 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Sep 22, 2009 1:03:22 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.HashtableCacheProvider
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Sep 22, 2009 1:03:22 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Sep 22, 2009 1:03:23 AM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/objectweb/asm/Type
java.lang.NoClassDefFoundError: org/objectweb/asm/Type
at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180)
at net.sf.cglib.core.KeyFactory.<clinit>(KeyFactory.java:66)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.sample.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:18)
at com.sample.TestPerson.main(TestPerson.java:11)
Exception in thread "main" java.lang.NullPointerException
at com.sample.TestPerson.main(TestPerson.java:11)

Please let me know if you find any solution.Thanks for your kind perusal.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62286
    
  68

"Bubi dg", please check your private messages for an important administrative matter. Again.
tabiul mahmood
Greenhorn

Joined: Sep 17, 2009
Posts: 18
Make sure you have

asm.jar
asm-attrs.jar

By the way next time you hit "Class Not Found" exception, always check this website www.findjar.com


Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Hi tabiul mahmood,

Thanks for your wonderful support.I have finally managed to complete the project by adding asm-jar file.But its really difficult to add the the exact jar files according to the project requirements if one doesnot know the jar files.


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate problem