jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Grathwohl <jan.grathw...@kontrast.de>
Subject Re: Transaction over multiple workspaces?
Date Tue, 04 Sep 2007 16:26:10 GMT
Hi Dominique,

since it seems to be a problem with my setup, I have experimented  
with my configuration, and removed all of my own customizations, but  
I always get the Exception "Inactive logical session handle called"  
when I try 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 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  
JBoss configuration options is limited....

The content of my jcr-dsl.xml is

<connection-factories>
     <tx-connection-factory>
		<jndi-name>jcr/local</jndi-name>
		<xa-transaction/>
		<rar-name>jackrabbit-jca-1.3.1.rar</rar-name>
		<track-connection-by-tx/>
		<connection-definition>javax.jcr.Repository</connection-definition>
		<config-property name="homeDir" type="java.lang.String">/temp/ 
jackrabbit2</config-property>
		<config-property name="configFile"  
type="java.lang.String">classpath:repository.xml</config-property>
		<config-property name="bindSessionToTransaction"  
type="java.lang.Boolean">false</config-property>
     </tx-connection-factory>
</connection-factories>

I can't send my test application because the Apache mailings list  
server rejects it as spam, but it didn't really contain more than the  
jsp 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="javax.jcr.*"%>
> <%@page import="javax.naming.InitialContext"%>
> <%@page import="javax.transaction.UserTransaction"%>
> <%
> InitialContext ctx = new InitialContext();
>
> UserTransaction utx = (UserTransaction)ctx.lookup("java:comp/ 
> UserTransaction");
> utx.begin();
>
> Repository repo = (Repository)ctx.lookup("java:jcr/local");
> Session session1 = repo.login(new SimpleCredentials("admin",
> "admin".toCharArray()), "workspace1");
> Session session2 = repo.login(new SimpleCredentials("admin",
> "admin".toCharArray()), "workspace2");
>
> Node rootNode1 = session1.getRootNode();
> %>Workspace1: <%= rootNode1.getNodes().getSize() %> nodes<br>
> <%
> rootNode1.addNode("a");
> Node rootNode2 = session2.getRootNode();
> %>Workspace2: <%= rootNode2.getNodes().getSize() %> nodes<br>
> <%
> 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 <jan.grathwohl@kontrast.de> wrote:
>> Hi Dominique,
>>
>> the session that was opened first cannot be accessed at all, the
>> three lines
>>
>> Session session1 = repo.login(new SimpleCredentials("admin",
>> "admin".toCharArray()), "default");
>> Session session2 = repo.login(new SimpleCredentials("admin",
>> "admin".toCharArray()), "ws2");
>> Node rootNode1 = 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 
>> (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 = repo.login(new SimpleCredentials("admin",
>> "admin".toCharArray()), "default");
>> Session session2 = 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 <jan.grathwohl@kontrast.de> 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 = new InitialContext();
>>>>
>>>>                 UserTransaction utx = (UserTransaction)ctx.lookup
>>>> ("java:comp/
>>>> UserTransaction");
>>>>                 utx.begin();
>>>>
>>>>                 Repository repo = (Repository)ctx.lookup("java:jcr/
>>>> local");
>>>>                 Session session1 = repo.login(new SimpleCredentials
>>>> ("admin",
>>>> "admin".toCharArray()), "workspace1");
>>>>                 Session session2 = 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
>>>>
>>>>
>>
>>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message