Hello,
We are trying using Hibernate in Spring framework and facing some problems. I am explaining the scenerio and problem, please guide us what to do:
we have a service object named Catalog.
we have a daObject named catalogDAO.
We are using transaction proxy in configuration file for applying transaction attributes to our service object ie to Catalog and using catalogDAO for accessing database related services.
we are using weblogic appserver.
--------
Now the complexity comes with that sometime we need to use transaction in our system before proper startup of appServer. it is required from some of our utility classes from preStartup of appServer. And as server is not started at time so we used to get exception that is
javax.naming.CommunicationException: Can't find SerialContextProvider
For its solution, we have to override JTATransactionManager of Spring API and ensure that transaction will be looked up based on server state ie userTransaction or another one.
After this, we are getting another problem that i am giving below. The point to consider is, we are using jdbc transaction also for our start up utility programs and after startup of appServer, we are using spring framework for handling transactions using JtaTransactionManager.
Please guide for it. Exception is:
[jprobejunit] java.sql.SQLException: Transaction BEA1-002AE72FB9B97F28EDB9 not active anymore.
tx status = Marked rollback. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException]
[jprobejunit] at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108
)
[jprobejunit] at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:284)
[jprobejunit] at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:244)
[jprobejunit] at weblogic.jdbc.common.internal.RmiDataSource_812_WLStub.getConnection(Unknown
Source)
[jprobejunit] at org.springframework.orm.hibernate.LocalDataSourceConnectionProvider.getConne
ction(LocalDataSourceConnectionProvider.java:49)
[jprobejunit] at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
[jprobejunit] at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1119)
[jprobejunit] at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:74
8)
[jprobejunit] at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(
LocalSessionFactoryBean.java:400)
[jprobejunit] at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet
(LocalSessionFactoryBean.java:339)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:644)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:170)
[jprobejunit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:142)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.resolveReference(AbstractAutowireCapableBeanFactory.java:585)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:553)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:506)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:361)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:150)
[jprobejunit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:142)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.resolveReference(AbstractAutowireCapableBeanFactory.java:585)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:553)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:506)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:361)
[jprobejunit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:150)
[jprobejunit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:142)
[jprobejunit] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst
antiateSingletons(DefaultListableBeanFactory.java:159)
[jprobejunit] at org.springframework.context.support.AbstractApplicationContext.refresh(Abstr
actApplicationContext.java:268)
[jprobejunit] at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(F
ileSystemXmlApplicationContext.java:32)
[jprobejunit] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(Cl
assPathXmlApplicationContext.java:31)
[jprobejunit] at com.aceva.context.ExecutionContext$ComponentFactoryImpl.createComponent(Exec
utionContext.java:599)
[jprobejunit] at com.aceva.context.ExecutionContext.createComponent(ExecutionContext.java:506
)
[jprobejunit] at com.aceva.rms.catalog.test.CatalogTestWL.postSetUp(CatalogTestWL.java:63)
[jprobejunit] at com.aceva.rms.knowledge.test.RollbackTestCase.setUp(RollbackTestCase.java:52
)
[jprobejunit] at junit.framework.TestCase.runBare(TestCase.java:125)
[jprobejunit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[jprobejunit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[jprobejunit] at junit.framework.TestResult.run(TestResult.java:109)
[jprobejunit] at junit.framework.TestCase.run(TestCase.java:118)
[jprobejunit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[jprobejunit] at junit.framework.TestSuite.run(TestSuite.java:203)
[jprobejunit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:331)
[jprobejunit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:557)
[jprobejunit] Caused by: java.sql.SQLException: Transaction BEA1-002AE72FB9B97F28EDB9 not activ
e anymore. tx status = Marked rollback. [Reason=weblogic.transaction.internal.AppSetRollbackOnl
yException]
[jprobejunit] at weblogic.jdbc.jts.Driver.getTransaction(Driver.java:367)
[jprobejunit] at weblogic.jdbc.jts.Driver.connect(Driver.java:126)
[jprobejunit] at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java
:305)
[jprobejunit] at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)
[jprobejunit] at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
[jprobejunit] at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:108)
[jprobejunit] at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
[jprobejunit] at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:353)
[jprobejunit] at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
[jprobejunit] at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
[jprobejunit] at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
0)
[jprobejunit] at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
[jprobejunit] at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Thanks,
_________________ Mohit Gupta
Software Engineer
Gurgaon, India
|