From users-return-5701-apmail-jackrabbit-users-archive=jackrabbit.apache.org@jackrabbit.apache.org Tue Dec 04 17:23:13 2007 Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 81360 invoked from network); 4 Dec 2007 17:23:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Dec 2007 17:23:12 -0000 Received: (qmail 73994 invoked by uid 500); 4 Dec 2007 17:22:59 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 73974 invoked by uid 500); 4 Dec 2007 17:22:59 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 73965 invoked by uid 99); 4 Dec 2007 17:22:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2007 09:22:59 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [69.156.193.165] (HELO scalixmail.pitchpointsolutions.com) (69.156.193.165) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2007 17:23:00 +0000 Received: from scalixmail.pitchpointsolutions.com (localhost.localdomain [127.0.0.1]) by scalixmail.pitchpointsolutions.com (8.13.1/8.13.1) with ESMTP id lB4HMbS0028041 for ; Tue, 4 Dec 2007 12:22:38 -0500 Date: Tue, 4 Dec 2007 12:22:37 -0500 From: "dainius rygelis" To: users Message-ID: In-Reply-To: Subject: RE: autcommit in DatabaseJournal.append x-scalix-Hops: 1 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-MailWasher-Server-Scanned: Checked by MailWasher server v2.2.3 (www.Firetrust.com) X-MailWasher-Server-Status: Clean X-Virus-Checked: Checked by ClamAV on apache.org Hi Dominique, Thanks for the quick resolution. Just out of curiosity, what's the performance difference between the way j= ackrabbit has implemented sql execution vs calling... Connection conn =3D DataSource.getConnection(); PreparedStatement stmt =3D connection.prepareStatement(sqlString); =2E.... rs.close(); stmt.close(); connection.close(); every time to execute a sql statement? The thinking being that the above approach should perform just as quickly= or quicker on the container because the driver or the container usually c= aches prepared statements and provides validated connections from a pool.= We haven't yet done any testing ourselves to check if there's a differen= ce. Thanks, Dainius -----Original Message----- From: Dominique Pfister [mailto:dominique.pfister@day.com]=20 Sent: December-04-07 11:09 AM To: users@jackrabbit.apache.org Subject: Re: autcommit in DatabaseJournal.append Hi Dainius, I could easily reproduce your scenario with a clustered setup and MySQL b= ackend. Apparently, other backends are more tolerant when calling commit(= ) on a connection that is already in auto-commit mode. I filed a JIRA issue for this: https://issues.apache.org/jira/browse/JCR-1254 and fixed it in the main trunk. Thank you very much for reporting! On 04/12/2007, dainius rygelis w= rote: > Hi Dominique, > > Yes, we're using 1.3.3. > > Two more questions... > Are the DatabaseJournal sql operations supposed in their own transactio= n? Yes. > Also, why the use of a single connection vs obtaining a new one when ne= eded from the connection pool supported datasource in the DatabaseJournal= , DbFileSystem/JNDIDatabaseFileSystem and BundleDbPersistenceManager/JNDI= DatabasePersistenceManager implementations? There are PreparedStatements inside these classes that one would have to p= repare every time a connection is obtained from the pool. Kind regards Dominique > Appreciate your help, > Dainius > > -----Original Message----- > From: Dominique Pfister [mailto:dominique.pfister@day.com] > Sent: December-04-07 4:15 AM > To: users@jackrabbit.apache.org > Subject: Re: autcommit in DatabaseJournal.append > > Hi Dainius, > > your configuration looks fine to me and I don't think you're using Data= baseJournal incorrectly. You're using Jackrabbit 1.3.3, right? > When appending new entries to the journal, the order of calls on the=20 > journal and corresponding actions on the database connection is as > follows: > > Journal Connection > > lock() autocommit=3Dfalse > append() commit or rollback > unlock() autocommit=3Dtrue > > In your stack trace commit() is called while the connection is in autoc= ommit mode, which implies that some other component already unlocked the j= ournal. I'm going to investigate the calls made on behalf of the journal w= hen a transaction - updating both a workspace and the versioning space - i= s committed. > > Kind regards > Dominique > > On 03/12/2007, dainius rygelis wrote: > > Hi, we're fairly new to jackrabbit and are evaluating it for use in a= highly available deployment. We're looking at using the database journal= but are encountering problems. Jackrabbit has been deployed as resource a= dapter on glassfish and works great until we attempt to use the database j= ournal. > > The jackrabbit resource adapter is enlisted in a container managed tr= ansaction through a resource environment reference in a session bean. Whe= n the container attempts to commit or rollback the transaction an error i= s thrown because DatabaseJournal.append has called connection.commit and a= ttempted to set autocommit to true. Are we using DatabaseJournal incorrec= tly? > > > > Here's the snippet of our config that's causing the problem. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Here's the relevant test code from the session bean.. > > > > @Stateless > > @TransactionManagement(value =3D TransactionManagementType.CONTAINER)= > > public class JackrabbitFacadeBean implements JackrabbitFacadeLocal { > > > > @Resource(name =3D "jcr/repository", shareable =3D true, type =3D= Repository.class) > > private Repository repository; > > > > ...... > > ...... > > ...... > > > > public String saveDocument(String parentNode, String document) { > > if (LOGGER.isDebugEnabled()) { > > LOGGER.debug("saveDocument(" + parentNode + ", " + docume= nt + ") - start"); > > } > > SimpleCredentials credentials =3D new SimpleCredentials("####= ##", "######".toCharArray()); > > String uuid =3D null; > > try { > > InputStream stream =3D new ByteArrayInputStream(document.= getBytes()); > > Session session =3D repository.login(credentials); > > Node root =3D session.getRootNode(); > > dump(root); > > if (!root.hasNode(parentNode)) { > > Node node =3D root.addNode(parentNode, "nt:unstructur= ed"); > > uuid =3D node.getPath(); > > }else{ > > Node node =3D root.getNode(parentNode); > > uuid =3D node.getPath(); > > } > > session.importXML("/" + parentNode, stream, ImportUUIDBeh= avior.IMPORT_UUID_CREATE_NEW); > > stream.close(); > > session.save(); > > dump(root); > > session.logout(); > > } catch (Exception e) { > > LOGGER.fatal(e.getLocalizedMessage(), e); > > throw new RuntimeException(e); > > } > > if (LOGGER.isDebugEnabled()) { > > LOGGER.debug("saveDocument() - end return value=3D" + uui= d); > > } > > return uuid; > > } > > > > and the stack trace... > > > > 2007-12-03 > > 16:56:05,WARN,org.apache.jackrabbit.core.journal.DatabaseJournal,htt > > pS > > SLWorkerThread-8080-1 Error while rolling back connection: Can't=20 > > call rollback when autocommit=3Dtrue > > 2007-12-03 16:56:05,ERROR,org.apache.jackrabbit.core.cluster.ClusterN= ode,httpSSLWorkerThread-8080-1 Unable to commit log entry. > > org.apache.jackrabbit.core.journal.JournalException: Unable to append= revision 4. > > at org.apache.jackrabbit.core.journal.DatabaseJournal.append(= DatabaseJournal.java:322) > > at org.apache.jackrabbit.core.journal.AppendRecord.update(App= endRecord.java:251) > > at org.apache.jackrabbit.core.cluster.ClusterNode$WorkspaceUp= dateChannel.updateCommitted(ClusterNode.java:614) > > at org.apache.jackrabbit.core.state.SharedItemStateManager$Up= date.end(SharedItemStateManager.java:725) > > at org.apache.jackrabbit.core.state.XAItemStateManager.commit= (XAItemStateManager.java:162) > > at org.apache.jackrabbit.core.version.XAVersionManager.commit= (XAVersionManager.java:475) > > at org.apache.jackrabbit.core.TransactionContext.commit(Trans= actionContext.java:177) > > at org.apache.jackrabbit.core.XASessionImpl.commit(XASessionI= mpl.java:339) > > at org.apache.jackrabbit.jca.TransactionBoundXAResource.commi= t(TransactionBoundXAResource.java:39) > > at com.sun.jts.jtsxa.OTSResourceImpl.commit_one_phase(OTSReso= urceImpl.java:166) > > at com.sun.jts.CosTransactions.RegisteredResources.commitOneP= hase(RegisteredResources.java:1575) > > at com.sun.jts.CosTransactions.TopCoordinator.commitOnePhase(= TopCoordinator.java:2949) > > at com.sun.jts.CosTransactions.CoordinatorTerm.commit(Coordin= atorTerm.java:317) > > at com.sun.jts.CosTransactions.TerminatorImpl.commit(Terminat= orImpl.java:249) > > at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl= =2Ejava:623) > > at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionM= anagerImpl.java:309) > > at com.sun.enterprise.distributedtx.J2EETransactionManagerImp= l.commit(J2EETransactionManagerImpl.java:1030) > > at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt= =2Ecommit(J2EETransactionManagerOpt.java:397) > > at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseCon= tainer.java:3792) > > at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseCont= ainer.java:3571) > > at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContai= ner.java:1354) > > at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContai= ner.java:1316) > > at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.inv= oke(EJBLocalObjectInvocationHandler.java:205) > > at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDele= gate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127) > > at $Proxy24.saveDocument(Unknown Source) > > at pps.jackrabbit.demo.web.bean.JackRabbitTestBean.submit(Jac= kRabbitTestBean.java:42) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method= ) > > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAc= cessorImpl.java:39) > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating= MethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at com.sun.el.parser.AstValue.invoke(AstValue.java:187) > > at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImp= l.java:297) > > at javax.faces.component.MethodBindingMethodExpressionAdapter= =2Einvoke(MethodBindingMethodExpressionAdapter.java:77) > > at com.sun.faces.application.ActionListenerImpl.processAction= (ActionListenerImpl.java:91) > > at javax.faces.component.UICommand.broadcast(UICommand.java:3= 83) > > at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoo= t.java:447) > > at javax.faces.component.UIViewRoot.processApplication(UIView= Root.java:752) > > at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(Inv= okeApplicationPhase.java:97) > > at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.= java:251) > > at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImp= l.java:117) > > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:= 244) > > at org.apache.catalina.core.ApplicationFilterChain.servletSer= vice(ApplicationFilterChain.java:411) > > at org.apache.catalina.core.StandardWrapperValve.invoke(Stand= ardWrapperValve.java:290) > > at org.apache.catalina.core.StandardContextValve.invokeIntern= al(StandardContextValve.java:271) > > at org.apache.catalina.core.StandardContextValve.invoke(Stand= ardContextValve.java:202) > > at org.apache.catalina.core.StandardPipeline.doInvoke(Standar= dPipeline.java:632) > > at org.apache.catalina.core.StandardPipeline.doInvoke(Standar= dPipeline.java:577) > > at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java= :94) > > at org.apache.catalina.core.StandardHostValve.invoke(Standard= HostValve.java:206) > > at org.apache.catalina.core.StandardPipeline.doInvoke(Standar= dPipeline.java:632) > > at org.apache.catalina.core.StandardPipeline.doInvoke(Standar= dPipeline.java:577) > > at org.apache.catalina.core.StandardPipeline.invoke(StandardP= ipeline.java:571) > > at org.apache.catalina.core.ContainerBase.invoke(ContainerBas= e.java:1080) > > at org.apache.catalina.core.StandardEngineValve.invoke(Standa= rdEngineValve.java:150) > > at org.apache.catalina.core.StandardPipeline.doInvoke(Standar= dPipeline.java:632) > > at org.apache.catalina.core.StandardPipeline.doInvoke(Standar= dPipeline.java:577) > > at org.apache.catalina.core.StandardPipeline.invoke(StandardP= ipeline.java:571) > > at org.apache.catalina.core.ContainerBase.invoke(ContainerBas= e.java:1080) > > at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdap= ter.java:270) > > at com.sun.enterprise.web.connector.grizzly.DefaultProcessorT= ask.invokeAdapter(DefaultProcessorTask.java:637) > > at com.sun.enterprise.web.connector.grizzly.DefaultProcessorT= ask.doProcess(DefaultProcessorTask.java:568) > > at com.sun.enterprise.web.connector.grizzly.DefaultProcessorT= ask.process(DefaultProcessorTask.java:813) > > at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.e= xecuteProcessorTask(DefaultReadTask.java:339) > > at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.d= oTask(DefaultReadTask.java:261) > > at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.d= oTask(DefaultReadTask.java:212) > > at com.sun.enterprise.web.portunif.PortUnificationPipeline$PU= Task.doTask(PortUnificationPipeline.java:361) > > at com.sun.enterprise.web.connector.grizzly.TaskBase.run(Task= Base.java:265) > > at > > com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSL > > Wo > > rkerThread.java:106) Caused by: java.sql.SQLException: Can't call=20 > > commit when autocommit=3Dtrue > > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:9= 14) > > at com.mysql.jdbc.Connection.commit(Connection.java:2273) > > at org.apache.jackrabbit.core.journal.DatabaseJournal.append(= DatabaseJournal.java:311) > > ... 67 more > > > > Thanks for your help, > > Dainius > > > >