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 10:55:24 GMT
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
View raw message