You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by gems450 <s....@yelladworks.com> on 2009/11/24 17:59:13 UTC

nt:file versioning exception


Hi 
Im having some probs when trying to versioning a nt:file node  the code 
below is standard I believe.

  Node fileNode = bundleNode.addNode (fileName, "nt:file");
       fileNode.addMixin("mix:versionable");
       //create the mandatory child node - jcr:content
       Node resNode = fileNode.addNode ("jcr:content", "nt:resource");
       resNode.setProperty ("jcr:mimeType", mimetype);
       resNode.setProperty ("jcr:data", new FileInputStream(file));   
       Calendar lastModified = Calendar.getInstance ();
       lastModified.setTimeInMillis(file.lastModified ());
       resNode.setProperty ("jcr:lastModified", lastModified);
       session.save();
       fileNode.checkin();


         //then get it back out so  as to create another version.
    fileNode.checkout();
   fileNode.checkin();



I get a repository exception with this message.     Missing child node 
entry for node with id: 

this is thrown evertime checkin is called. I do not understand why this 
happens. any help greatly appreciated.

Si Smith


-- 
View this message in context: http://n4.nabble.com/nt-file-versioning-exception-tp786973p786973.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: nt:file versioning exception

Posted by Stefan Guggisberg <st...@gmail.com>.
On Wed, Nov 25, 2009 at 12:18 PM, gems450 <s....@yelladworks.com> wrote:
>
> If this sheds anymore light on it if I replace session.save() with
> fileNode.save(); I get a different error of
>
> "Cannot save a new item: node /Resources/test/my.xml"

you should call bundleNode.save() instead of fileNode.save().

cheers
stefan

>
>
>
> gems450 wrote:
>>
>>
>> Hi
>> Im having some probs when trying to versioning a nt:file node  the code
>> below is standard I believe.
>>
>>   Node fileNode = bundleNode.addNode (fileName, "nt:file");
>>        fileNode.addMixin("mix:versionable");
>>        //create the mandatory child node - jcr:content
>>        Node resNode = fileNode.addNode ("jcr:content", "nt:resource");
>>        resNode.setProperty ("jcr:mimeType", mimetype);
>>        resNode.setProperty ("jcr:data", new FileInputStream(file));
>>        Calendar lastModified = Calendar.getInstance ();
>>        lastModified.setTimeInMillis(file.lastModified ());
>>        resNode.setProperty ("jcr:lastModified", lastModified);
>>        session.save();
>>        fileNode.checkin();
>>
>>
>>          //then get it back out so  as to create another version.
>>     fileNode.checkout();
>>    fileNode.checkin();
>>
>>
>>
>> I get a repository exception with this message.     Missing child node
>> entry for node with id:
>>
>> this is thrown evertime checkin is called. I do not understand why this
>> happens. any help greatly appreciated.
>>
>> Si Smith
>>
>>
>>
>
> --
> View this message in context: http://n4.nabble.com/nt-file-versioning-exception-tp786973p787471.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>

Re: nt:file versioning exception

Posted by gems450 <s....@yelladworks.com>.
If this sheds anymore light on it if I replace session.save() with
fileNode.save(); I get a different error of 

"Cannot save a new item: node /Resources/test/my.xml"



gems450 wrote:
> 
> 
> Hi 
> Im having some probs when trying to versioning a nt:file node  the code 
> below is standard I believe.
> 
>   Node fileNode = bundleNode.addNode (fileName, "nt:file");
>        fileNode.addMixin("mix:versionable");
>        //create the mandatory child node - jcr:content
>        Node resNode = fileNode.addNode ("jcr:content", "nt:resource");
>        resNode.setProperty ("jcr:mimeType", mimetype);
>        resNode.setProperty ("jcr:data", new FileInputStream(file));   
>        Calendar lastModified = Calendar.getInstance ();
>        lastModified.setTimeInMillis(file.lastModified ());
>        resNode.setProperty ("jcr:lastModified", lastModified);
>        session.save();
>        fileNode.checkin();
> 
> 
>          //then get it back out so  as to create another version.
>     fileNode.checkout();
>    fileNode.checkin();
> 
> 
> 
> I get a repository exception with this message.     Missing child node 
> entry for node with id: 
> 
> this is thrown evertime checkin is called. I do not understand why this 
> happens. any help greatly appreciated.
> 
> Si Smith
> 
> 
> 

-- 
View this message in context: http://n4.nabble.com/nt-file-versioning-exception-tp786973p787471.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: nt:file versioning exception

Posted by gems450 <s....@yelladworks.com>.
Will do , thanks for the reply

Stefan Guggisberg wrote:
> 
> On Tue, Nov 24, 2009 at 5:59 PM, gems450 <s....@yelladworks.com> wrote:
>>
>>
>> Hi
>> Im having some probs when trying to versioning a nt:file node  the code
>> below is standard I believe.
>>
>>  Node fileNode = bundleNode.addNode (fileName, "nt:file");
>>       fileNode.addMixin("mix:versionable");
>>       //create the mandatory child node - jcr:content
>>       Node resNode = fileNode.addNode ("jcr:content", "nt:resource");
>>       resNode.setProperty ("jcr:mimeType", mimetype);
>>       resNode.setProperty ("jcr:data", new FileInputStream(file));
>>       Calendar lastModified = Calendar.getInstance ();
>>       lastModified.setTimeInMillis(file.lastModified ());
>>       resNode.setProperty ("jcr:lastModified", lastModified);
>>       session.save();
>>       fileNode.checkin();
>>
>>
>>         //then get it back out so  as to create another version.
>>    fileNode.checkout();
>>   fileNode.checkin();
>>
>>
>>
>> I get a repository exception with this message.     Missing child node
>> entry for node with id:
>>
>> this is thrown evertime checkin is called. I do not understand why this
>> happens. any help greatly appreciated.
> 
> this seems to be a bug. could you please post a jira issue and
> include all required information as described in
> http://wiki.apache.org/jackrabbit/QuestionsAndAnswers#Reporting_Problems ?
> 
> cheers
> stefan
> 
>>
>> Si Smith
>>
>>
>> --
>> View this message in context:
>> http://n4.nabble.com/nt-file-versioning-exception-tp786973p786973.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: http://n4.nabble.com/nt-file-versioning-exception-tp786973p787497.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: nt:file versioning exception

Posted by Stefan Guggisberg <st...@gmail.com>.
On Tue, Nov 24, 2009 at 5:59 PM, gems450 <s....@yelladworks.com> wrote:
>
>
> Hi
> Im having some probs when trying to versioning a nt:file node  the code
> below is standard I believe.
>
>  Node fileNode = bundleNode.addNode (fileName, "nt:file");
>       fileNode.addMixin("mix:versionable");
>       //create the mandatory child node - jcr:content
>       Node resNode = fileNode.addNode ("jcr:content", "nt:resource");
>       resNode.setProperty ("jcr:mimeType", mimetype);
>       resNode.setProperty ("jcr:data", new FileInputStream(file));
>       Calendar lastModified = Calendar.getInstance ();
>       lastModified.setTimeInMillis(file.lastModified ());
>       resNode.setProperty ("jcr:lastModified", lastModified);
>       session.save();
>       fileNode.checkin();
>
>
>         //then get it back out so  as to create another version.
>    fileNode.checkout();
>   fileNode.checkin();
>
>
>
> I get a repository exception with this message.     Missing child node
> entry for node with id:
>
> this is thrown evertime checkin is called. I do not understand why this
> happens. any help greatly appreciated.

this seems to be a bug. could you please post a jira issue and
include all required information as described in
http://wiki.apache.org/jackrabbit/QuestionsAndAnswers#Reporting_Problems ?

cheers
stefan

>
> Si Smith
>
>
> --
> View this message in context: http://n4.nabble.com/nt-file-versioning-exception-tp786973p786973.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>