Forums Register Login

MDB Transaction Propogation.

+Pie Number of slices to send: Send
Hi Guys ,I am very new to EJB 3.0

I have deployed a EAR in a web logic 10.3 g which have two ejb modules called
1.ServicesDump
2.MessageDump

In ServicesDump i have a session bean which doing the database updates,After i have deployed,
When i called these remote session-bean from out side of container to test the functionalites it working perfectly(Which mean
updating the tables perfectly).That session bean have a transaction type is REQUIRED.

In the MessageDump i have a mdb which listening the MQ ,and inside the onMessage() of MDB i am calling the method of remote session bean (the same
method which i have tested ).
The mdb 's transaction type i specified in ejb-jar.xml as follows

<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>test</ejb-name>
...
<transaction-type>Container</transaction-type>

<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>

</message-driven-destination>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>test</ejb-name>
<method-name>onMessage()</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

so when MDB started (When it consumes message from MQ) it calling the session bean method,
but after it returns from the sessions bean method it throwing the following exception.


dminServer+172.22.221.124:7001+base_domain+t3+): weblogic.transaction.RollbackException: Unknown rea

son

at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java

:1834)

at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.

java:339)

at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:233

)

at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:591)

at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:42

4)

9)

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:597)

at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:310)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:182)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:149)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doP

roceed(DelegatingIntroductionInterceptor.java:131)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.inv

oke(DelegatingIntroductionInterceptor.java:119)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:171)

at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodI

nvocationVisitorImpl.java:37)

at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentI

nterceptorCallbackImpl.java:54)

at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(Environment

Interceptor.java:50)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:171)

at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invok

e(ExposeInvocationInterceptor.java:89)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:171)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doP

roceed(DelegatingIntroductionInterceptor.java:131)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.inv

oke(DelegatingIntroductionInterceptor.java:119)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:171)

at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at $Proxy108.processMqLog(Unknown Source)

at .common.service.serviceimpl.LogServiceBean_rq903m_LogServiceImpl.processMqLog

(LogServiceBean_rq903m_LogServiceImpl.java:61)

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:597)

at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.ja

va:73)

at $Proxy103.processMqLog(Unknown Source)

at .olr.baserate.mdb.OLTRateFeedMessageListener.onMessage(OLTRateFeedMessageListener

.java:74)

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:597)

at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:310)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:182)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:149)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doP

roceed(DelegatingIntroductionInterceptor.java:131)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.inv

oke(DelegatingIntroductionInterceptor.java:119)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:171)

at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invok

e(ExposeInvocationInterceptor.java:89)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:171)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doP

roceed(DelegatingIntroductionInterceptor.java:131)

at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.inv

oke(DelegatingIntroductionInterceptor.java:119)

at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:171)

at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at $Proxy107.onMessage(Unknown Source)

at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:466)

at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:371)

at weblogic.ejb.container.internal.NewJMSMessagePoller.processOneMessage(NewJMSMessagePoller

.java:245)

at weblogic.ejb.container.internal.NewJMSMessagePoller.run(NewJMSMessagePoller.java:121)

at weblogic.ejb.container.internal.NewJMSMessagePoller.timerExpired(NewJMSMessagePoller.java

:204)

at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)

at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.jav

a:516)

at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)

at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

Caused by: weblogic.transaction.internal.AppSetRollbackOnlyException

at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(TransactionImpl.java:551)

at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerIm

pl.java:319)

at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerIm

pl.java:312)

at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java

:433)

at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManag

erImpl.java:588)

at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManag

erImpl.java:630)

at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.

java:525)

at weblogic.transaction.internal.ServerSCInfo.doBeforeCompletion(ServerSCInfo.java:1229)

at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1204)

at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:118)



at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransac

tionImpl.java:1310)

at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImp

l.java:2122)

at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.

java:266)

please help me out to resolve it,

Cheers
Dominic

+Pie Number of slices to send: Send
You do look to be on the right track.

Caused by: weblogic.transaction.internal.AppSetRollbackOnlyException
at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(TransactionImpl.java:551)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java:319)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java:312)



It does look like the exception is thrown from the Session bean. Can you walk your session bean through a debugger when invoked from the MDB and ensure that you do not have an exception raised there?

On a side note, your ejb-jar.xml has one minor flaw



should be just



No need for (). Set that right and try again to see if it makes a difference.

cheers,
ram.

+Pie Number of slices to send: Send
Hi Ram
Thanks for the instant reply

But i already tested my session from main method like follows
Context ctx = null;

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, "t3://172.22.221.124:7001");
ctx = new InitialContext(props);


ctx = new InitialContext(props);
Object ref = ctx
.lookup("EmailServiceBean#com.dom.common.service.EmailService");
// #com.citi.common.MessageSenderLocal"

try {

BidService h = (BidService) PortableRemoteObject.narrow(ref,
BidService.class);
Boolean b1 = h.createBid("test");
System.out.println();


but the bid called ("test") created in DB which mean Transaction commit without rollback .But Once i call this Session Bean from MDB like follows

it gaves the TransactionRollback Error.

public class RateRequestListener implements MessageListener {

@EJB
private BidService service;




/**
* @see MessageListener#onMessage(Message)
*/
public void onMessage(Message message) {
service.createBid("test");

}


} catch (JMSException e) {
//If any JMS exception happens rollback the txn .
throw new RuntimeException("Rolback the Msg back to MQ");
}
catch (Exception e) {
//If any exception happens rollback the txn .
throw new RuntimeException("Rolback the Msg back to MQ");
}

}*/
+Pie Number of slices to send: Send
Did you set right that ejb-jar.xml anomaly?
Conceptually you are on the right track - as I said before put a debug point in your bean when invoked from the mdb. You can set up a remote debugger for Weblogic rom eclipse/netbeans

ram.
+Pie Number of slices to send: Send
Hi Ram

I Did the remote debug.But That Exception is thrown in MDB not in the session .
Still i could not find out the actual problem.But definetly it will in MDB transaction.
Do i need to use about XA_transactions setting in the external MQ. ?


Please give me your yahoo or gmail Id it would be great for me..

Thanks
+Pie Number of slices to send: Send
Of course you have to do that. You may have to use an XA driver for your jdbc insert too.
Btw, you can enable debugging in weblogic to easily identify the cause.

ram.
This looks like a job for .... legal tender! It says so right in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4418 times.
Similar Threads
EJB 3 In Action - Ch4 Example - Eclipse/Weblogic
ASSERTION FAILED Error while retrieving EntityManager instance In JPA
java.rmi.RemoteException: EJB Exception: ; nested exception is:
OOM on weblogic 10.3.2 JVM@check_alloc
getting weblogic to add jar to classpath (axis.jar)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:50:53.