jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go canal <goca...@yahoo.com>
Subject Re: PathNotFoundException
Date Wed, 22 Jul 2009 05:45:54 GMT
Did I misunderstand some basic concept ?

this is how I create a new root node:
    parentNode = getSession().getRootNode();
    Node newNode = jcrom.addNode(parentNode, entity, mixinTypes);

 
the entity has a path set to "/documents", 

immediately, I check the availability:
   return getSession().getRootNode().hasNode ("documents");

and it says path not found ...


rgds,
canal




________________________________
From: go canal <gocanal@yahoo.com>
To: users@jackrabbit.apache.org
Sent: Wednesday, July 22, 2009 8:13:31 AM
Subject: Re: PathNotFoundException

I quickly use exists("/documents") to check, strange though, it says, not existing !  I traced
and found that internally exists() function added the root, which I have set to "/documents"
so the fullpath becomes "/documents/documents"  but then I tried to check exisits(""), also
does not find .... this time the path becomes "/documents/", and the relative path is "documents/"
>> how should I check my new root ?

I use AbstractJcrDAO.create ("/", node) to create the root, the node has:
path = "/documents"
name = "documents"

This is the actual method in AbsractJcrDAO:

    public T create(String parentNodePath, T entity) {
        try {
            String entityName = jcrom.getName(entity);
            if ( entityName == null || entityName.equals("") ) {
                throw new JcrMappingException("The name of the entity being created is empty!");
            }
            if ( parentNodePath == null || parentNodePath.equals("") ) {
                throw new JcrMappingException("The parent path of the entity being created
is empty!");
            }

            Node parentNode;
            if ( parentNodePath.equals("/") ) {
                // special case, add directly to the root node
                parentNode = getSession().getRootNode(); <<<<<<---- traced
here, got root successfully
            } else {
                parentNode = getSession().getRootNode().getNode(relativePath(parentNodePath));
            }
            Node newNode = jcrom.addNode(parentNode, entity, mixinTypes); <<<<<---traced
here, also no issue
            getSession().save();
            if ( isVersionable ) {
                //newNode.checkin();
                checkinRecursively(newNode);
            }
            //return (T)jcrom.fromNode(entityClass, newNode);
            return entity; <<<<<<<-----return successfully
        } catch ( RepositoryException e ) {
            throw new JcrMappingException("Could not create node", e);
        }
    }


rgds,
canal




________________________________
From: go canal <gocanal@yahoo.com>
To: users@jackrabbit.apache.org
Sent: Wednesday, July 22, 2009 7:58:48 AM
Subject: PathNotFoundException

hi,
have been struggling with this for quite sometime already....help needed

I first created /documents root node, then I wanted to add a new file node to it.. 
I am using jcrom - sorry if this is not the right forum but hoping some people here use it
also .......

/documents is created successfully, but when adding the new node, I got PathNotFoundException
in AbstractJcrDAO:

public T create(String parentNodePath, T entity) {
.....
    parentNode = getSession().getRootNode().getNode(relativePath(parentNodePath));
....
}

I traced the parentNodePath, which is the correct 'documents'.


Why it throws 'PathNotFound' ? I lost ....

rgds,
canal


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