[JBoss Seam] - Error about ListDataModel?
by jasonqzy
In the message example,I add some code in MessageManager.java?MessageManagerBean.java and message.jsp like following.
MessageManager.java
| //$Id: MessageManager.java,v 1.2 2006/05/23 05:30:24 gavin Exp $
| package org.jboss.seam.example.messages;
|
| import javax.ejb.Local;
|
| @Local
| public interface MessageManager
| {
| public String getTitle();
| public void setTitle(String title);
| public void findMessages();
| public void select();
| public void delete();
| public void destroy();
| }
|
MessageManagerBean.java
| //$Id: MessageManagerBean.java,v 1.7 2006/11/19 21:01:33 gavin Exp $
| package org.jboss.seam.example.messages;
|
| import static javax.persistence.PersistenceContextType.EXTENDED;
| import static org.jboss.seam.ScopeType.SESSION;
|
| import java.io.Serializable;
| import java.util.List;
|
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.Factory;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.annotations.datamodel.DataModel;
| import org.jboss.seam.annotations.datamodel.DataModelSelection;
|
| @Stateful
| @Scope(SESSION)
| @Name("messageManager")
| public class MessageManagerBean implements Serializable, MessageManager
| {
|
| private String title = "Test";
|
| @DataModel
| private List<Message> messageList;
|
| @DataModelSelection
| @Out(required=false)
| private Message message;
|
| @PersistenceContext(type=EXTENDED)
| private EntityManager em;
|
| @Factory("messageList")
| public void findMessages()
| {
| messageList = em.createQuery("select msg from Message msg order by msg.datetime desc").getResultList();
| }
|
| public String getTitle(){
| return title;
| }
|
| public void setTitle(String title){
| this.title = title;
| }
|
| public void select()
| {
| if (message!=null) message.setRead(true);
| }
|
| public void delete()
| {
| if (message!=null)
| {
| messageList.remove(message);
| em.remove(message);
| message=null;
| }
| }
|
| @Remove @Destroy
| public void destroy() {}
|
| }
|
message.jsp
| <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
| <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
| <%@ taglib uri="http://jboss.com/products/seam/taglib" prefix="s" %>
| <html>
| <head>
| <title>Messages</title>
| </head>
| <body>
| <f:view>
| <h2>Message List</h2>
| <h:outputText value="messageManager.title" />
| <h:outputText value="No messages to display" rendered="#{messageList.rowCount==0}"/>
| <h:dataTable var="msg" value="#{messageList}" rendered="#{messageList.rowCount>0}">
| <h:column>
| <f:facet name="header">
| <h:outputText value="Read"/>
| </f:facet>
| <h:selectBooleanCheckbox value="#{msg.read}" disabled="true"/>
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Title"/>
| </f:facet>
| <s:link value="#{msg.title}" action="#{messageManager.select}"/>
| </h:column>
| <h:column>
| <f:facet name="header">
| <h:outputText value="Date/Time"/>
| </f:facet>
| <h:outputText value="#{msg.datetime}">
| <s:convertDateTime type="both" dateStyle="medium" timeStyle="short"/>
| </h:outputText>
| </h:column>
| <h:column>
| <s:button value="Delete" action="#{messageManager.delete}"/>
| </h:column>
| </h:dataTable>
| <h3><h:outputText value="#{message.title}"/></h3>
| <div><h:outputText value="#{message.text}"/></div>
| </f:view>
| </body>
| </html>
|
When I delete the last message of the message list,I get the error.
| 18:16:55,984 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
| javax.faces.el.EvaluationException: Cannot get value for expression '#{messageManager.title}'
| at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
| at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:69)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:57)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
| at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:495)
| at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363)
| at org.apache.jsp.messages_jsp._jspx_meth_h_outputText_0(messages_jsp.java:172)
| at org.apache.jsp.messages_jsp._jspx_meth_f_view_0(messages_jsp.java:126)
| at org.apache.jsp.messages_jsp._jspService(messages_jsp.java:91)
| at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
| at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
| at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
| at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
| at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
| at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
| at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
| at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: javax.faces.el.EvaluationException: Exception getting value of property title of base of type : org.javassist.tmp.java.lang.Object_$$_javassist_1
| at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:96)
| at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
| at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
| at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
| ... 46 more
| Caused by: javax.faces.el.EvaluationException: Bean: org.javassist.tmp.java.lang.Object_$$_javassist_1, property: title
| at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
| at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
| ... 49 more
| Caused by: java.lang.reflect.InvocationTargetException
| 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 org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
| ... 50 more
| Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: row is unavailable
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
| at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
| at $Proxy94.getTitle(Unknown Source)
| 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 org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
| at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
| at org.javassist.tmp.java.lang.Object_$$_javassist_1.getTitle(Object_$$_javassist_1.java)
| ... 55 more
| Caused by: java.lang.IllegalArgumentException: row is unavailable
| at javax.faces.model.ListDataModel.getRowData(ListDataModel.java:63)
| at org.jboss.seam.databinding.DataModelBinder.getSelection(DataModelBinder.java:69)
| at org.jboss.seam.databinding.DataModelBinder.getSelection(DataModelBinder.java:19)
| at org.jboss.seam.Component.injectDataModelSelection(Component.java:1274)
| at org.jboss.seam.Component.injectDataModelSelections(Component.java:1254)
| at org.jboss.seam.Component.inject(Component.java:1196)
| at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
| 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 org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:71)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| ... 86 more
|
But WhenI delete other message,it's normal. Why?[/url]
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044225#4044225
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044225
19 years, 1 month
[JCA/JBoss] - Re: Force Oracle to Rollback _after_ prepare phase?
by ypsilon
Hi Weston.
"weston.price(a)jboss.com" wrote : This is a heuristic.
|
| Technically once a resource agrees in the prepare phase, the commit must occur. Is the offensive resource throwing an Exception in your case? This should force the rollback of the other participant. When you say 'does not respond to the commit request' what do you mean?
The problem is that the resource seems to be no longer available. The TCP-Socket times out. This of course means that the commit request might have reached it's destination and thereby caused the commit to be executed, but from my experiences so far this did not happen.
Since all communication is done via HTTP and the ResourceManager itself is not java an Exception is not really possible. In case of a timeout the XAResource at the moment throws a XAException (RMERR).
If I however set up a test case and throw whatever exception in the XAResource the other participant is not being rolled back. Here is some sample code:
| The Method which does the work looks like this (called remotely):
|
| /**
| * @throws CreateException
| * @ejb.interface-method
| * @ejb.transaction type="Required"
| */
| public void jtaTest() throws RemoteException, CreateException {
|
| ctx.lookup("java:/TransactionManager");
| try {
| TransactionManager transactionManager = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
| log.info(transactionManager.getClass());
| transactionManager.getTransaction().enlistResource(new MyXAResource());
| AddressValue addy2 = new AddressValue();
| addy2.setCity("einestadt");
| addy2.setId(new Long(System.currentTimeMillis()));
| addy2.setName("ich");
| addy2.setStreet("am kamp 12");
| AddressUtil.getLocalHome().create(addy2) ;
|
| } catch (Exception e) {
| e.printStackTrace();
| ctx.setRollbackOnly();
| }
| }
|
|
| And this is the enlisted XAResource:
|
| private static class MyXAResource implements XAResource {
| Xid managedXid = null;
|
| public void commit(Xid xid, boolean b) throws XAException {
| log.info("Nummer 1:commiting " + xid);
| int testFlag=0;
| switch (testFlag) {
| case 0:
|
| log.info("Nummer 1:Error during commit");
| throw new XAException(XAException.XA_HEURRB);
| case 1:
|
| log.info("Nummer 1:Error during commit");
| throw new RuntimeException("blabla");
| case 2:
|
| log.info("Nummer 1:Error during commit");
| throw new XAException(XAException.XAER_RMERR);
|
| }
|
| log.info("Nummer 1:done commiting");
| }
|
| public void end(Xid xid, int i) throws XAException {
| log.info("Nummer 1:end transcation " + xid);
| }
|
| public void forget(Xid xid) throws XAException {
| log.info("Nummer 1:forget transcation " + xid);
| }
|
| public int getTransactionTimeout() throws XAException {
| return 5000; //To change body of implemented methods use File | Settings | File Templates.
| }
|
| public boolean isSameRM(XAResource xaResource) throws XAException {
| log.info("Nummer 1:isSameRM called");
| return xaResource == this;
| }
|
| public int prepare(Xid xid) throws XAException {
| boolean flag = false;
| log.info("Nummer 1: prepare called.");
| if (flag) {
| throw new XAException(XAException.XA_RBCOMMFAIL );
| }
|
| return XA_OK; //To change body of implemented methods use File | Settings | File Templates.
| }
|
| public Xid[] recover(int i) throws XAException {
| log.info("Nummer 1:recover called");
| return new Xid[0]; //To change body of implemented methods use File | Settings | File Templates.
| }
|
| public void rollback(Xid xid) throws XAException {
| boolean flag = false;
| if (flag) {
| throw new XAException(XAException.XAER_RMERR );
| }
| }
|
| public boolean setTransactionTimeout(int i) throws XAException {
| return false; //To change body of implemented methods use File | Settings | File Templates.
| }
|
| public void start(Xid xid, int flags) throws XAException {
| if (xid == null) throw new XAException(XAException.XAER_INVAL);
| if (managedXid != null) {
| throw new XAException(XAException.XAER_INVAL);
| } else {
| managedXid = xid;
| }
| log.info("Nummer 1:start called " + xid + " i " +flags);
| }
| }
|
|
as you can see in commit there is always an XAException being thrown.
here is some logging
| 11:40:15,195 INFO [CMRTestFacadeBean] Nummer 1:Error during commit
| 11:40:15,196 WARN [TransactionImpl] XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=toaster/15, BranchQual=, localId=15] errorCode=XA_HEURRB
| javax.transaction.xa.XAException
| at eval.cmr.CMRTestFacadeBean$MyXAResource.commit(CMRTestFacadeBean.java:313)action.xa.XAException
| at org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
| at org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
| at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:358)
| ...
| "weston.price(a)jboss.com" wrote : This is a heuristic.
| |
| | Technically once a resource agrees in the prepare phase, the commit must occur. Is the offensive resource throwing an Exception in your case? This should force the rollback of the other participant. When you say 'does not respond to the commit request' what do you mean?
|
| The problem is that the resource seems to be no longer available. The TCP-Socket times out. This of course means that the commit request might have reached it's destination and thereby caused the commit to be executed, but from my experiences so far this did not happen.
| Since all communication is done via HTTP and the ResourceManager itself is not java an Exception is not really possible.
|
| If I however set up a test case and throw whatever exception in the XAResource the other participant is not being rolled back. Here is some sample code:
|
|
| | The Method which does the work looks like this (called remotely):
| |
| | /**
| | * @throws CreateException
| | * @ejb.interface-method
| | * @ejb.transaction type="Required"
| | */
| | public void jtaTest() throws RemoteException, CreateException {
| |
| | ctx.lookup("java:/TransactionManager");
| | try {
| | TransactionManager transactionManager = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
| | log.info(transactionManager.getClass());
| | transactionManager.getTransaction().enlistResource(new MyXAResource());
| | AddressValue addy2 = new AddressValue();
| | addy2.setCity("einestadt");
| | addy2.setId(new Long(System.currentTimeMillis()));
| | addy2.setName("ich");
| | addy2.setStreet("am kamp 12");
| | // save the address to the DB
| | AddressUtil.getLocalHome().create(addy2) ;
| |
| | } catch (Exception e) {
| | e.printStackTrace();
| | ctx.setRollbackOnly();
| | }
| | }
| |
| |
| | And this is the enlisted XAResource:
| |
| | private static class MyXAResource implements XAResource {
| | Xid managedXid = null;
| |
| | public void commit(Xid xid, boolean b) throws XAException {
| | log.info("Nummer 1:commiting " + xid);
| | int testFlag=0;
| | switch (testFlag) {
| | case 0:
| |
| | log.info("Nummer 1:Error during commit");
| | throw new XAException(XAException.XA_HEURRB);
| | case 1:
| |
| | log.info("Nummer 1:Error during commit");
| | throw new RuntimeException("blabla");
| | case 2:
| |
| | log.info("Nummer 1:Error during commit");
| | throw new XAException(XAException.XAER_RMERR);
| |
| | }
| |
| | log.info("Nummer 1:done commiting");
| | }
| |
| | public void end(Xid xid, int i) throws XAException {
| | log.info("Nummer 1:end transcation " + xid);
| | }
| |
| | public void forget(Xid xid) throws XAException {
| | log.info("Nummer 1:forget transcation " + xid);
| | }
| |
| | public int getTransactionTimeout() throws XAException {
| | return 5000; //To change body of implemented methods use File | Settings | File Templates.
| | }
| |
| | public boolean isSameRM(XAResource xaResource) throws XAException {
| | log.info("Nummer 1:isSameRM called");
| | return xaResource == this;
| | }
| |
| | public int prepare(Xid xid) throws XAException {
| | boolean flag = false;
| | log.info("Nummer 1: prepare called.");
| | if (flag) {
| | throw new XAException(XAException.XA_RBCOMMFAIL );
| | }
| |
| | return XA_OK; //To change body of implemented methods use File | Settings | File Templates.
| | }
| |
| | public Xid[] recover(int i) throws XAException {
| | log.info("Nummer 1:recover called");
| | return new Xid[0]; //To change body of implemented methods use File | Settings | File Templates.
| | }
| |
| | public void rollback(Xid xid) throws XAException {
| | boolean flag = false;
| | if (flag) {
| | throw new XAException(XAException.XAER_RMERR );
| | }
| | }
| |
| | public boolean setTransactionTimeout(int i) throws XAException {
| | return false; //To change body of implemented methods use File | Settings | File Templates.
| | }
| |
| | public void start(Xid xid, int flags) throws XAException {
| | if (xid == null) throw new XAException(XAException.XAER_INVAL);
| | if (managedXid != null) {
| | throw new XAException(XAException.XAER_INVAL);
| | } else {
| | managedXid = xid;
| | }
| | log.info("Nummer 1:start called " + xid + " i " +flags);
| | }
| | }
| |
| |
|
| as you can see in commit there is always an XAException being thrown.
|
| here is some logging
|
|
| | 11:40:15,195 INFO [CMRTestFacadeBean] Nummer 1:Error during commit
| | 11:40:15,196 WARN [TransactionImpl] XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=toaster/15, BranchQual=, localId=15] errorCode=XA_HEURRB
| | javax.transaction.xa.XAException
| | at eval.cmr.CMRTestFacadeBean$MyXAResource.commit(CMRTestFacadeBean.java:313)action.xa.XAException
| | at org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
| | at org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
| | at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:358)
| | ...
| | 11:40:15,209 INFO [CMRTestFacadeBean] Nummer 1:forget transcation XidImpl[FormatId=257, GlobalId=toaster/15, BranchQual=1, localId=15]
| | 11:40:15,242 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract void eval.cmr.CMRTestFacade.jtaTest() throws javax.ejb.CreateException,java.rmi.RemoteException, causedBy:
| | javax.transaction.HeuristicRollbackException
| | at org.jboss.tm.TransactionImpl.checkHeuristics(TransactionImpl.java:1610)
| | at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:378)
| | at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
| | at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
| | at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
| | at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
| |
| |
| |
|
| The address which is created is however being written to the Database.
|
| Is that normal?
|
| Thanks in advance
| Greetings
| PeeR
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044224#4044224
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044224
19 years, 1 month
[JBoss jBPM] - Problem in adding Action class
by naseem.k
Hi,
I am facing problem in executing a custom action class in jbpm 3.1
Process is something like this...
start--->state1-->end1
Now at state1, I have a action class at the time of node-enter.
<state name="state1">
| <event type="node-enter">
| <action name="action1" class="com.sample.action.MessageActionHandler">
| <message>NASEEM</message>
| </action>
| </event>
| <transition name="action is executed" to="end1">
| </transition>
| </state>
My MessageActionHandler class...
package com.sample.action;
|
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.exe.ExecutionContext;
|
| public class MessageActionHandler implements ActionHandler {
|
| private static final long serialVersionUID = 1L;
|
| /**
| * The message member gets its value from the configuration in the
| * processdefinition. The value is injected directly by the engine.
| */
| String message;
|
| /**
| * A message process variable is assigned the value of the message
| * member. The process variable is created if it doesn't exist yet.
| */
| public void execute(ExecutionContext context) throws Exception {
|
| System.out.println("*************************************************************************");
| //context.getContextInstance().setVariable("message", message);
| //System.out.println("Message is>>>>>>>>>>>>> " + message);
|
| }
| }
|
On the server console... I get this message...
anonymous wrote : .......
| DEBUG [GraphElement] event 'node-enter' on 'State(state1)' for 'Token(/)'
| DEBUG [GraphElement] executing action 'action[action1]'
| .......
|
But my action class execute method is not executed?
My Action class is in the process project and I have selected java classes and resources. I deployed process definition on server-deployer /jbpm/upload
My Action class is not in the jbpm.war. I am not sure where I should put my Action class.
Please help me in this regard
Thanks in advance
Naseem
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044215#4044215
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044215
19 years, 1 month