Hi,
I've created a utility class from which I'll obtain my sessionFactory which look as follows:
...................
static final Configuration configuration = new Configuration().configure();
System.out.println("PRE-CONFIGURE");
sessionFactory = configuration.buildSessionFactory();
System.out.println("POST-CONFIGURE");
................
I've also created my hibernate.cfg.xml file which I've placed in the conf dir of my Jonas appln server. When I call a method from my sessionBean which looks as follows:
..................
public void createUser() throws Exception
{
Session session = HibernateUtil.currentSession();
...............
...............
}
...............
I got a null pointer exception in Jonas. When I try to debug it I found that the jonas display my msg: PRE-CONFIGURE and then throws the nullpointer exception. So, it means there is something wrong in the line:
sessionFactory = configuration.buildSessionFactory();
Here is the msg from Jonas console:
2005-04-19 11:17:49,964 : Configuration.configure : configuring from resource: /hibernate.cfg.xml
2005-04-19 11:17:49,964 : Configuration.getConfigurationInputStream : Configuration resource: /hibernate.cfg.xml
2005-04-19 11:17:50,808 : Configuration.addResource : Mapping resource: org/objectweb/alarm/beans/GlopUser.hbm.xml
2005-04-19 11:17:53,104 : HbmBinder.bindRootPersistentClassCommonValues : Mapping class: org.objectweb.alarm.beans.GlopUser -> glop_user
2005-04-19 11:17:53,120 : Configuration.addResource : Mapping resource: org/objectweb/alarm/beans/AlarmData.hbm.xml
2005-04-19 11:17:55,698 : HbmBinder.bindRootPersistentClassCommonValues : Mapping class: org.objectweb.alarm.beans.AlarmData -> alarm_data
2005-04-19 11:17:55,698 : Configuration.doConfigure : Configured SessionFactory: null
PRE-CONFIGURE
2005-04-19 11:17:55,698 : Configuration.secondPassCompile : processing extends queue
2005-04-19 11:17:55,714 : Configuration.secondPassCompile : processing collection mappings
2005-04-19 11:17:55,714 : Configuration.secondPassCompile : processing association property references
2005-04-19 11:17:55,714 : Configuration.secondPassCompile : processing foreign key constraints
2005-04-19 11:17:55,714 : Dialect.<init> : Using dialect: org.hibernate.dialect.PostgreSQLDialect
2005-04-19 11:17:55,714 : SettingsFactory.buildSettings : Default batch fetch size: 1
2005-04-19 11:17:55,714 : SettingsFactory.buildSettings : Generate SQL with comments: disabled
2005-04-19 11:17:55,714 : SettingsFactory.buildSettings : Order SQL updates by primary key: disabled
2005-04-19 11:17:55,714 : SettingsFactory.createQueryTranslatorFactory : Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2005-04-19 11:17:55,729 : ASTQueryTranslatorFactory.<init> : Using ASTQueryTranslatorFactory
2005-04-19 11:17:55,729 : SettingsFactory.buildSettings : Query language substitutions: {}
2005-04-19 11:17:55,729 : NamingHelper.getInitialContext : JNDI InitialContext properties:{}
2005-04-19 11:17:55,761 : DatasourceConnectionProvider.configure : Using datasource: jdbc_hibernate
2005-04-19 11:17:55,761 : SettingsFactory.buildSettings : JDBC batch size: 15
2005-04-19 11:17:55,761 : SettingsFactory.buildSettings : JDBC batch updates for versioned data: disabled
2005-04-19 11:17:55,776 : SettingsFactory.buildSettings : Scrollable result sets: enabled
2005-04-19 11:17:55,776 : SettingsFactory.buildSettings : JDBC3 getGeneratedKeys(): disabled
2005-04-19 11:17:55,776 : TransactionFactoryFactory.buildTransactionFactory : Using default transaction strategy (direct JDBC transactions)
2005-04-19 11:17:55,776 : TransactionManagerLookupFactory.getTransactionManagerLookup : No TransactionManagerLookup configured (in JTA envi
onment, use of read-write or transactional second-level cache is not recommended)
2005-04-19 11:17:55,776 : SettingsFactory.buildSettings : Automatic flush during beforeCompletion(): disabled
2005-04-19 11:17:55,792 : SettingsFactory.buildSettings : Automatic session close at end of transaction: disabled
2005-04-19 11:17:55,792 : SettingsFactory.createCacheProvider : Cache provider: org.hibernate.cache.EhCacheProvider
2005-04-19 11:17:55,792 : SettingsFactory.buildSettings : Second-level cache: enabled
2005-04-19 11:17:55,792 : SettingsFactory.buildSettings : Optimize cache for minimal puts: disabled
2005-04-19 11:17:55,792 : SettingsFactory.buildSettings : Structured second-level cache entries: enabled
2005-04-19 11:17:55,792 : SettingsFactory.buildSettings : Query cache: disabled
2005-04-19 11:17:55,792 : SettingsFactory.buildSettings : Statistics: disabled
2005-04-19 11:17:55,808 : SettingsFactory.buildSettings : Deleted entity synthetic identifier rollback: disabled
2005-04-19 11:17:55,808 : SettingsFactory.buildSettings : Default entity-mode: pojo
2005-04-19 11:17:55,808 : JFactory.postInvoke : system exception in business method:
java.lang.NullPointerException
at org.objectweb.alarm.beans.SessionTataBean.createUser(Unknown Source)
at org.objectweb.alarm.beans.JOnASSessionTata437579213Remote.createUser(JOnASSessionTata437579213Remote.java:57)
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:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.runDispatch(JUnicastServerRef.java:160)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:145)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
Can anyone please help me solve my problem.
thanks in advance
|