Exception in thread "main" java.lang.NullPointerException
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:36)
aruna sameera wrote:yes,i also know that .but i can't find where the error is?
that is mean it can't creat session.so where is the error?
first it stop at line number 20.
then i press F6.Then it jubp to 36 directly.
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0rc1
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: contact.hbm.xml
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: roseindia.tutorial.hibernate.Contact -> CONTACT
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Sep 13, 2009 11:36:19 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Sep 13, 2009 11:36:19 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Sep 13, 2009 11:36:20 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Sep 13, 2009 11:36:20 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Sep 13, 2009 11:36:20 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 10
Sep 13, 2009 11:36:20 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Sep 13, 2009 11:36:20 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/hibernatetutorial
Sep 13, 2009 11:36:20 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Sep 13, 2009 11:36:20 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Sep 13, 2009 11:36:20 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 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: enabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Sep 13, 2009 11:36:20 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Sep 13, 2009 11:36:20 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Sep 13, 2009 11:36:20 PM net.sf.ehcache.config.Configurator configure
WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/PROJECT/eclips/AAAAA/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/SystemException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.id.IdentifierGeneratorFactory.class$(IdentifierGeneratorFactory.java:25)
at org.hibernate.id.IdentifierGeneratorFactory.<clinit>(IdentifierGeneratorFactory.java:76)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:111)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:166)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:21)
aruna sameera wrote:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/SystemException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.id.IdentifierGeneratorFactory.class$(IdentifierGeneratorFactory.java:25)
at org.hibernate.id.IdentifierGeneratorFactory.<clinit>(IdentifierGeneratorFactory.java:76)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:111)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:166)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:21)
Gavi jadz Grandea wrote:
I agree. Your missing your driverclass ( com.mysql.jdbc.Driver ) and that's why you can't create a SessionFactory.
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Inserting Record
Done
Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?)
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|