Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 89840 invoked from network); 7 Nov 2007 15:59:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Nov 2007 15:59:43 -0000 Received: (qmail 74703 invoked by uid 500); 7 Nov 2007 15:59:29 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 74687 invoked by uid 500); 7 Nov 2007 15:59:29 -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 74678 invoked by uid 99); 7 Nov 2007 15:59:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2007 07:59:29 -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 [91.143.96.40] (HELO mail.hms.org) (91.143.96.40) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2007 16:00:05 +0000 Subject: AW: Transaction over multiple workspaces? Date: Wed, 7 Nov 2007 16:59:09 +0100 Message-ID: <23E4DD34F112AF40A4F13B73B50BB3065CA34E@hms-server-01.hms.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-class: urn:content-classes:message Thread-Topic: Transaction over multiple workspaces? X-MimeOLE: Produced By Microsoft Exchange V6.5 thread-index: Acfzu60c+8cWJ8pAQaiVgNeITIIBRwtlg10g References: <4CB71494-AAD6-4E65-B686-3F3DA593EBE0@kontrast.de> <7E5857B3-F080-40A0-A0ED-27F97C3BA745@kontrast.de> From: "Norbert Dreisiebner" To: X-Virus-Checked: Checked by ClamAV on apache.org Hi, I also have to work with multiple workspaces within a single - container = managed - transaction, and basically it works the way Jan described it.=20 I tried the whole thing with the following code: // 1. get jcr sessions Session sWS1 =3D repository.login(credentials, "ws1"); Session sWS2 =3D repository.login(credentials, "ws2"); // 2. do something useful =3D) sWS1.getRootNode().addNode("ws1_test_node", "nt:unstructured"); sWS2.getRootNode().addNode("ws2_test_node", "nt:unstructured"); // 3. save changes sWS1.save(); sWS2.save(); // 4. close connections sWS1.logout(); sWS2.logout(); When running this code the first time everything seems to run smoothly: 16:09:51,012 INFO [jcr/local] Created session = (org.apache.jackrabbit.core.XASessionImpl@395294) 16:09:51,028 INFO [jcr/local] Created session = (org.apache.jackrabbit.core.XASessionImpl@b58796) However, every following invocation produces this warning: 16:10:07,610 WARN [JBossManagedConnectionPool] Destroying connection = that could not be successfully matched: = org.jboss.resource.connectionmanager.TxC onnectionManager$TxConnectionEventListener@1d89cb4[state=3DNORMAL = mc=3Dorg.apache.jackrabbit.jca.JCAManagedConnection@16020ed handles=3D0 = lastUse=3D1194448191 074 permit=3Dfalse trackByTx=3Dfalse = mcp=3Dorg.jboss.resource.connectionmanager.JBossManagedConnectionPool$One= Pool@11cc36 context=3Dorg.jboss.resource.connect ionmanager.InternalManagedConnectionPool@762acf = xaResource=3Dorg.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper= @181a7a txSync=3Dnull] 16:10:07,625 INFO [jcr/local] Created session = (org.apache.jackrabbit.core.XASessionImpl@fe4dd2) Maybe some of you can give me a hint what this warning means and how i = should handle it =3D) Following you may find my jcr-ds.xml: =20 jcr/local=20 jackrabbit-jca-1.3.3.rar javax.jcr.Repository C:\temp\jackrabbit C:\temp\jackrabbit\repository.xml true Thank you, Norbert -----Urspr=FCngliche Nachricht----- Von: Jan Grathwohl [mailto:jan.grathwohl@kontrast.de]=20 Gesendet: Montag, 10. September 2007 17:02 An: Dominique Pfister Cc: Jackrabbit Users List List Betreff: Re: Transaction over multiple workspaces? Hi Dominique, I have removed the from my jcr-dsl.xml, and =20 now I can run it without the exception, and everyting works =20 correctly. It doesn't seem to cause any other problems either, so it =20 looks I really don't need this option. Thank you very much for your help. Jan Am 05.09.2007 um 11:18 schrieb Dominique Pfister: > Hi Jan, > > I received your attachments, deployed them in a fresh JBoss server > configuration and got the same "IllegalStateException" you've > experienced. I then removed the following line inside the jcr-ds.xml: > > > > and set the config property "bindSessionToTransaction" to "true" and > it works. Is there some reason for including "track-connection-by-tx", > apart from working around JCR-1109? I still have to figure out what > this setting changes in the way Jackrabbit's JCA is used by JBoss... > > Kind regards > Dominique > > On 04/09/07, Jan Grathwohl wrote: >> >> Hi Dominique, >> >> since it seems to be a problem with my setup, I have experimented =20 >> with my >> configuration, and removed all of my own customizations, but I =20 >> always get >> the Exception "Inactive logical session handle called" when I try =20 >> to execute >> the JSP. >> >> I can reproduce the error with the following steps: >> >> 1. Download a fresh copy of JBoss 4.0.5 GA (or 4.2.1) and extract the >> archive >> >> 2. Download the Jackrabbit JCA adapter rar as a binary from >> http://jackrabbit.apache.org/downloads.cgi >> >> 3. Put the rar, the jcr-ds.xml and the web app war with the test =20 >> jsp in >> server/default/deploy >> >> 4. Start JBoss >> >> 5. Calling http://localhost:8080/TransactionsTest/test.jsp >> causes the exception >> >> >> Am I missing something here? I have to admit that my knowledge of =20 >> JBoss >> configuration options is limited.... >> >> The content of my jcr-dsl.xml is >> >> >> >> jcr/local >> >> jackrabbit-jca-1.3.1.rar >> >> javax.jcr.Repository >> > type=3D"java.lang.String">/temp/jackrabbit2 >> > type=3D"java.lang.String">classpath:repository.xml >> > type=3D"java.lang.Boolean">false >> >> >> >> I can't send my test application because the Apache mailings list =20 >> server >> rejects it as spam, but it didn't really contain more than the jsp =20 >> page >> anyway. >> >> >> Thank you very much for your support. >> >> Jan >> >> >> >> >> Am 04.09.2007 um 13:53 schrieb Dominique Pfister: >> >> >> Hi Jan, >> >> I have a JBoss 4.0.5.GA installation with Jackrabbit JCA 1.3.1 >> deployed in it. I created a small web application containing the >> following JSP code: >> >> <%@page import=3D"javax.jcr.*"%> >> <%@page import=3D"javax.naming.InitialContext"%> >> <%@page import=3D"javax.transaction.UserTransaction"%> >> <% >> InitialContext ctx =3D new InitialContext(); >> >> UserTransaction utx =3D >> (UserTransaction)ctx.lookup("java:comp/UserTransaction"); >> utx.begin(); >> >> Repository repo =3D (Repository)ctx.lookup("java:jcr/local"); >> Session session1 =3D repo.login(new SimpleCredentials("admin", >> "admin".toCharArray()), "workspace1"); >> Session session2 =3D repo.login(new SimpleCredentials("admin", >> "admin".toCharArray()), "workspace2"); >> >> Node rootNode1 =3D session1.getRootNode(); >> %>Workspace1: <%=3D rootNode1.getNodes().getSize() %> nodes
>> <% >> rootNode1.addNode("a"); >> Node rootNode2 =3D session2.getRootNode(); >> %>Workspace2: <%=3D rootNode2.getNodes().getSize() %> nodes
>> <% >> rootNode2.addNode("b"); >> >> session1.save(); >> session2.save(); >> >> utx.commit(); >> %> >> >> Works as expected, incrementing the root node's children count on >> every request. Can you tell me how you access the resource adapter >> from within your client code? Any relevant, customized configuration >> (ra.xml, repository.xml and the like) might be helpful, too... >> >> Kind regards >> Dominique >> >> >> On 04/09/07, Jan Grathwohl wrote: >> Hi Dominique, >> >> the session that was opened first cannot be accessed at all, the >> three lines >> >> Session session1 =3D repo.login(new SimpleCredentials("admin", >> "admin".toCharArray()), "default"); >> Session session2 =3D repo.login(new SimpleCredentials("admin", >> "admin".toCharArray()), "ws2"); >> Node rootNode1 =3D session1.getRootNode(); >> >> already cause an error: >> >> 12:39:25,720 ERROR [STDERR] java.lang.IllegalStateException: Inactive >> logical session handle called >> 12:39:25,720 ERROR [STDERR] at >> org.apache.jackrabbit.jca.JCAManagedConnection.getSession >> (JCAManagedConnection.java:227) >> 12:39:25,720 ERROR [STDERR] at >> org.apache.jackrabbit.jca.JCASessionHandle.getSession >> (JCASessionHandle.java:84) >> 12:39:25,720 ERROR [STDERR] at >> org.apache.jackrabbit.jca.JCASessionHandle.getRootNode >> (JCASessionHandle.java:135) >> 12:39:25,720 ERROR [STDERR] at jbosstest.Servlet6.doGet >> (Servlet6.java:55) >> 12:39:25,720 ERROR [STDERR] at >> javax.servlet.http.HttpServlet.service >> (HttpServlet.java:690) >> 12:39:25,720 ERROR [STDERR] at >> javax.servlet.http.HttpServlet.service >> (HttpServlet.java:803) >> 12:39:25,720 ERROR [STDERR] at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter >> (ApplicationFilterChain.java:290) >> 12:39:25,720 ERROR [STDERR] at >> org.apache.catalina.core.ApplicationFilterChain.doFilter >> (ApplicationFilterChain.java:206) >> 12:39:25,720 ERROR [STDERR] at >> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter >> (ReplyHeaderFilter.java:96) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter >> (ApplicationFilterChain.java:235) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.core.ApplicationFilterChain.doFilter >> (ApplicationFilterChain.java:206) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.core.StandardWrapperValve.invoke >> (StandardWrapperValve.java:230) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.core.StandardContextValve.invoke >> (StandardContextValve.java:175) >> 12:39:25,721 ERROR [STDERR] at >> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke >> (SecurityAssociationValve.java:179) >> 12:39:25,721 ERROR [STDERR] at >> org.jboss.web.tomcat.security.JaccContextValve.invoke >> (JaccContextValve.java:84) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.core.StandardHostValve.invoke >> (StandardHostValve.java:128) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.valves.ErrorReportValve.invoke >> (ErrorReportValve.java:104) >> 12:39:25,721 ERROR [STDERR] at >> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke >> (CachedConnectionValve.java:157) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.core.StandardEngineValve.invoke >> (StandardEngineValve.java:109) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.catalina.connector.CoyoteAdapter.service >> (CoyoteAdapter.java:241) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.coyote.http11.Http11Processor.process=20 >> (Http11Processor.java: >> 844) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.coyote.http11.Http11Protocol >> $Http11ConnectionHandler.process(Http11Protocol.java:580) >> 12:39:25,721 ERROR [STDERR] at >> org.apache.tomcat.util.net.JIoEndpoint >> $Worker.run(JIoEndpoint.java:447) >> >> The second session can still be accessed, but if I do >> >> Session session1 =3D repo.login(new SimpleCredentials("admin", >> "admin".toCharArray()), "default"); >> Session session2 =3D repo.login(new SimpleCredentials("admin", >> "admin".toCharArray()), "ws2"); >> session2.getRootNode().addNode(nodeName2); >> session2.save(); >> utx.commit(); >> >> it finishes quietly without any error message, but the new node is >> not saved to the database for the workspace (MySQL with the Bundle >> persistence manager). If I only comment out the first line that opens >> session1, the new node is added to the database. >> >> >> Jan >> >> >> >> Am 04.09.2007 um 11:47 schrieb Dominique Pfister: >> >> >> Hi Jan, >> >> can you tell me, what happens when you commit your user transaction? >> Is there an exception or a timeout or... >> >> Kind regards >> Dominique >> >> On 04/09/07, Jan Grathwohl wrote: >> Hi, >> >> is it possible in Jackrabbit to have a transaction that spans >> multiple workspaces? What I would like to do is to start a >> UserTransaction, write changes to several Jackrabbit workspaces (all >> from the same repository) and a Hibernate session, and then commit >> all these changes together. My application modifies several >> workspaces concurrently, and I would like to ensure that all these >> changes are either commited or rolled back completely. >> >> I have set up a JCA deployment of Jackrabbit 1.3.1 in JBoss , and it >> works fine as long as I only use one session per transaction. It >> looks from my tests like it is not possible to open more than one >> session within a transaction, and I also found a thread on the >> mailing list that says something like that. >> >> >> >> >> >> >> >> But if I want to work in multiple workspaces, I have to open multiple >> sessions, because session are always per-workspace, right? >> >> So my code to edit multiple workspaces within one transaction >> would be >> >> InitialContext ctx =3D new InitialContext(); >> >> UserTransaction utx =3D (UserTransaction)ctx.lookup >> ("java:comp/ >> UserTransaction"); >> utx.begin(); >> >> Repository repo =3D >> (Repository)ctx.lookup("java:jcr/ >> local"); >> Session session1 =3D repo.login(new SimpleCredentials >> ("admin", >> "admin".toCharArray()), "workspace1"); >> Session session2 =3D repo.login(new SimpleCredentials >> ("admin", >> "admin".toCharArray()), "workspace2"); >> >> // Use session1 to write changes to workspace1 >> >> // Use session2 to write changes to workspace2 >> >> session1.save(); >> session2.save(); >> >> utx.commit(); >> >> which doesn't work. >> >> Is there any way to include multiple workspaces within the scope of >> one transaction? >> >> >> Thank you. >> >> Jan >> >> >> >> >> >> >> No virus found in this incoming message. Checked by AVG Free Edition.=20 Version: 7.5.485 / Virus Database: 269.13.14/999 - Release Date: = 10.09.2007 17:43 =20 No virus found in this outgoing message. Checked by AVG Free Edition.=20 Version: 7.5.503 / Virus Database: 269.15.23/1114 - Release Date: = 06.11.2007 20:05 =20