I am facing exceptions when I try to use JTA from within Hibernate. My source code is as follows:-
static {
try
{
cfg = new Configuration();
cfg.setProperty("hibernate.dialect", "net.sf.hibernate.dialect.OracleDialect");
cfg.setProperty("hibernate.cglib.use_reflection_optimizer", "true");
cfg.setProperty(
"hibernate.transaction.manager_lookup_class",
"net.sf.hibernate.transaction.WeblogicTransactionManagerLookup");
cfg.setProperty(
"hibernate.transaction.factory_class",
"net.sf.hibernate.transaction.JTATransactionFactory");
}
------------------------
However, when the class loads I get the following exception stacktrace for the transaction related properties being set. wHY IS THE EXCEPTION OCCURRING?:-
19:07:29,616 INFO Environment:462 - Hibernate 2.1.2
19:07:29,616 INFO Environment:491 - hibernate.properties not found
19:07:29,616 INFO Environment:519 - using CGLIB reflection optimizer
19:07:29,616 INFO Environment:530 - JVM does not support Statement.getGeneratedKeys()
19:07:29,616 INFO Environment:541 - JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled
19:07:29,616 INFO Environment:544 - using workaround for JVM bug in java.sql.Timestamp
19:07:29,616 INFO Configuration:166 - Mapping file: D:/OilXL/CodeBase/Dolphin/hbm_files/RefPerson.hbm.xml
19:07:30,131 INFO Binder:229 - Mapping class: com.tpt.oilxl.referencedata.valueobject.RefPerson -> REF_PERSON
19:07:30,194 INFO Configuration:166 - Mapping file: D:/OilXL/CodeBase/Dolphin/hbm_files/RefEquipment.hbm.xml
19:07:30,225 INFO Binder:229 - Mapping class: com.tpt.oilxl.referencedata.valueobject.RefEquipment -> REF_EQUIPMENT
19:07:30,413 INFO Configuration:166 - Mapping file: D:/OilXL/CodeBase/Dolphin/hbm_files/RefBarge.hbm.xml
19:07:30,460 INFO Binder:229 - Mapping class: com.tpt.oilxl.referencedata.valueobject.RefBarge -> REF_BARGE
19:07:30,475 INFO Configuration:595 - processing one-to-many association mappings
19:07:30,475 INFO Configuration:604 - processing one-to-one association property references
19:07:30,475 INFO Configuration:629 - processing foreign key constraints
19:07:30,506 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.OracleDialect
19:07:30,506 INFO SettingsFactory:62 - Use outer join fetching: true
19:07:30,506 WARN UserSuppliedConnectionProvider:25 - No connection properties specified - the user must supply JDBC connections
19:07:30,506 INFO TransactionManagerLookupFactory:38 - instantiating TransactionManagerLookup: net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
19:07:30,506 INFO TransactionManagerLookupFactory:42 - instantiated TransactionManagerLookup
19:07:30,522 INFO SettingsFactory:102 - Use scrollable result sets: false
19:07:30,522 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false
19:07:30,522 INFO SettingsFactory:108 - Optimize cache for minimal puts: false
19:07:30,522 INFO SettingsFactory:117 - Query language substitutions: {}
19:07:30,522 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider
19:07:30,522 INFO Configuration:1080 - instantiating and configuring caches
19:07:30,553 INFO SessionFactoryImpl:119 - building session factory
19:07:31,085 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
19:07:31,100 INFO NamingHelper:26 - JNDI InitialContext properties:{}
java.io.FileNotFoundException: D:\OilXL\CodeBase\Dolphin\config\security.properties (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:64)
at java.io.FileInputStream.<init>(FileInputStream.java:95)
at com.sun.enterprise.util.Utility.getPropertiesFromFile(Utility.java:42)
at com.sun.enterprise.iiop.POAEJBORB.<clinit>(POAEJBORB.java:78)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at org.omg.CORBA.ORB.create_impl(ORB.java:284)
at org.omg.CORBA.ORB.init(ORB.java:328)
at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:138)
at com.sun.enterprise.util.ORBManager.init(ORBManager.java:65)
at com.sun.enterprise.naming.SerialInitContextFactory.<init>(SerialInitContextFactory.java:31)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.init(InitialContext.java:222)
at javax.naming.InitialContext.<init>(InitialContext.java:178)
at net.sf.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:28)
at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:204)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750)
at com.tpt.dolphin.persistenceimpl.HibernateDBPersistenceManager.<clinit>(HibernateDBPersistenceManager.java:87)
at com.tpt.oilxl.application.OilXlApp.<init>(OilXlApp.java:55)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.<init>(ReferenceDataProcessorBeanTest.java:74)
at java.lang.reflect.Constructor.newInstance(Native Method)
at junit.framework.TestSuite.createTest(TestSuite.java:135)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.main(ReferenceDataProcessorBeanTest.java:101)
java.io.FileNotFoundException: D:\OilXL\CodeBase\Dolphin\config\ejb.properties (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:64)
at java.io.FileInputStream.<init>(FileInputStream.java:95)
at com.sun.enterprise.util.Utility.getPropertiesFromFile(Utility.java:42)
at com.sun.enterprise.iiop.J2EEInitializer.<init>(J2EEInitializer.java:54)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at com.sun.corba.ee.internal.Interceptors.PIORB.registerORBInitializers(PIORB.java:377)
at com.sun.corba.ee.internal.Interceptors.PIORB.parseProperties(PIORB.java:347)
at com.sun.corba.ee.internal.TxPOA.TxPIORB.parseProperties(TxPIORB.java:116)
at com.sun.corba.ee.internal.corba.ORB.set_parameters(ORB.java:461)
at com.sun.corba.ee.internal.POA.POAORB.set_parameters(POAORB.java:156)
at com.sun.corba.ee.internal.Interceptors.PIORB.set_parameters(PIORB.java:336)
at org.omg.CORBA.ORB.init(ORB.java:329)
at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:138)
at com.sun.enterprise.util.ORBManager.init(ORBManager.java:65)
at com.sun.enterprise.naming.SerialInitContextFactory.<init>(SerialInitContextFactory.java:31)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.init(InitialContext.java:222)
at javax.naming.InitialContext.<init>(InitialContext.java:178)
at net.sf.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:28)
at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:204)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750)
at com.tpt.dolphin.persistenceimpl.HibernateDBPersistenceManager.<clinit>(HibernateDBPersistenceManager.java:87)
at com.tpt.oilxl.application.OilXlApp.<init>(OilXlApp.java:55)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.<init>(ReferenceDataProcessorBeanTest.java:74)
at java.lang.reflect.Constructor.newInstance(Native Method)
at junit.framework.TestSuite.createTest(TestSuite.java:135)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.main(ReferenceDataProcessorBeanTest.java:101)
Warning: unable to read transaction.interoperability config property
java.io.FileNotFoundException: D:\OilXL\CodeBase\Dolphin\config\security.properties (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:64)
at java.io.FileInputStream.<init>(FileInputStream.java:95)
at com.sun.enterprise.util.Utility.getPropertiesFromFile(Utility.java:42)
at com.sun.enterprise.iiop.security.SecurityMechanismSelector.<clinit>(SecurityMechanismSelector.java:102)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.getEndPointInfo(IIOPSSLSocketFactory.java:211)
at com.sun.corba.ee.internal.iiop.ConnectionTable.getConnection(ConnectionTable.java:73)
at com.sun.corba.ee.internal.iiop.ConnectionTable.getConnection(ConnectionTable.java:68)
at com.sun.corba.ee.internal.iiop.GIOPImpl.getConnection(GIOPImpl.java:70)
at com.sun.corba.ee.internal.corba.InitialNamingClient.locateObject(InitialNamingClient.java:769)
at com.sun.corba.ee.internal.corba.InitialNamingClient.getIORUsingHostInfo(InitialNamingClient.java:597)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveCorbaloc(InitialNamingClient.java:573)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveUsingORBInitRef(InitialNamingClient.java:544)
at com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:1080)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:981)
at com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.java:2425)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:52)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:204)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750)
at com.tpt.dolphin.persistenceimpl.HibernateDBPersistenceManager.<clinit>(HibernateDBPersistenceManager.java:87)
at com.tpt.oilxl.application.OilXlApp.<init>(OilXlApp.java:55)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.<init>(ReferenceDataProcessorBeanTest.java:74)
at java.lang.reflect.Constructor.newInstance(Native Method)
at junit.framework.TestSuite.createTest(TestSuite.java:135)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.main(ReferenceDataProcessorBeanTest.java:101)
net.sf.hibernate.HibernateException: Could not locate TransactionManager
at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:26)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:204)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750)
at com.tpt.dolphin.persistenceimpl.HibernateDBPersistenceManager.<clinit>(HibernateDBPersistenceManager.java:87)
at com.tpt.oilxl.application.OilXlApp.<init>(OilXlApp.java:55)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.<init>(ReferenceDataProcessorBeanTest.java:74)
at java.lang.reflect.Constructor.newInstance(Native Method)
at junit.framework.TestSuite.createTest(TestSuite.java:135)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at com.tpt.oilxl.referencedata.ejb.ReferenceDataProcessorBeanTest.main(ReferenceDataProcessorBeanTest.java:101)
Caused by: javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:63)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
|