jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Giota Karadimitriou" <Giota.Karadimitr...@eurodyn.com>
Subject running JCA connector
Date Tue, 04 Jul 2006 08:48:27 GMT
Hello,
 
I just applied the latest JCA changes commited by Edgar Poce related to
issues 412,461,462 and 463 and many thanks indeed because these problems
had been left open for quite a while.
However I now discovered after testing the following problematic
behaviour:
 
I will just describe it, because with jca it is more difficult to
produce some test case.
 
 I have a session bean Manager1 which calls Manager2 in order to create
jcr nodes.
 
So it's like
 
Manager1{
 
 
public void createStructure()  throws.{
            Node a=Manager2.createNode(null,name,type);
            ...
//HERE IT FAILS
            Node b=Manager2.createNode('/a',name,type);
}  
 
}
 
Manager2 {
            public void createNode(String parentPath, String name,
String nodeType) throws RepException{
                        try {
            
            Session session = getSession("default");
            Workspace ws = session.getWorkspace();
            Node rn = session.getRootNode();            
            if (parentPath != null) {
                parentNode = rn.getNode(parentPath.substring(1));
            } else {
                parentNode = rn;
            }
            Node child = parentNode.addNode(
                name,
                nodeType);
            child.addMixin("mix:referenceable");
            Map metadata = JCRHandler.getMetadata(meta);
            JCRHandler.setProperties(metadata, child);
 
            session.save();
            return child;
        } catch (LoginException e) {
            context.setRollbackOnly();
            throw new RepException("error.jcrmutator.createDir", e);
        } catch (NamingException e) {
            context.setRollbackOnly();
            throw new RepException("error.jcrmutator.createDir", e);
        } catch (RepositoryException e) {
            context.setRollbackOnly();
            throw new RepException("error.jcrmutator.createDir", e);
        }
}
}
 
 
the above code fails at 
 
Node b=Manager2.createNode('/a',name,type);
 
What happens is the following:
 
1)       When  creating Node a, session.save() has been called but
changes have not been persisted because the end of the transaction
has not yet been reached (the end of the transaction will take place at
the end of createStructure method). Therefore the node 'a' in reality
does not exist.
2)       When trying to create Node b with Node a as parent, the code
fails at 
parentNode = rn.getNode(parentPath.substring(1));
 with a PathNotFoundException in resolvePath method of
HierarchyManagerImpl.
 
 
     The above code used to work without the jca changes I applied from
trunk + the diff patch of 463.     
     I think changes of 463 (Uncommitted changes or connection leak with
Container Managed Transactions) (diff patch) have something to do with
it
     as the session handle close is now bound to the *active*
transaction.
            
     Just thought to report it and in the meantime I will see if I can
provide more feedback/test case etc.
 
A workaround for me currently is to create 'a' and 'b' together on a
single call to createNode method but there is some additional
information I need (from a database) which forces me to do it in 2
steps. 
 
     Edgar and rest if you can provide me with some feedback please do.
Thank you.
 
 
    Regards
    Giota
 
 

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