jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Bocanegra <tobias.bocane...@day.com>
Subject Re: ConstraintViolationException
Date Mon, 30 Jan 2006 15:11:14 GMT
well, i could reproduce this behaviour, but only once, but now i'm not
able to get the error anymore. this is certainly strange.

sirene, can you strip down your code to some simple class that always
reproduces this behaviour? with this, we could better debug the
problem.

regards, toby

On 1/30/06, Stefan Guggisberg <stefan.guggisberg@gmail.com> wrote:
> On 1/29/06, sirène vip <sirene_vip@hotmail.com> wrote:
> > Hello Everyone,
> >
> > This becoming really annoying!
> >
> > I have verified my program thousands of time and made all possible changes
> > but keep having the exception "ConstraintViolationException:[other
> > application_specific information]  mandatory property
> > {http://www.jcp.org/jcr/1.0}created does not exist"
> >
> > My code consists in the following:
> >
> > public void store(String feName, String document) {
> >
> >   Node root = session.getRootNode();
> >   Node n = root.addNode(feName, "nt:file");
> >   Node content = expNode.addNode("jcr:content", "nt:resource");
> >   content.setProperty("jcr:mimeType", "text/xml");
> >   content.setProperty("jcr:encoding", "");
> >   content.setProperty("jcr:data", document);
> >
> >   Calendar lastModified = Calendar.getInstance ();
> >   long currentTime = System.currentTimeMillis();
> >   final long duration = currentTime - start;
> >   lastModified.setTimeInMillis(duration);
> >   content.setProperty("jcr:lastModified", lastModified);
> >    session.save();
> > }
>
>
> >   Node content = expNode.addNode("jcr:content", "nt:resource");
>
> where does 'expNode' come from?
>
> here's a code fragment that i works perfectly
> (tested with the latest svn rev.):
>
>            // file to be stored in repository
>            File file = new File("repository.xml");
>
>            Node fileNode = root.addNode(file.getName(), "nt:file");
>            Node content = fileNode.addNode("jcr:content", "nt:resource");
>            FileInputStream fin = new FileInputStream(file);
>            try {
>                content.setProperty("jcr:data", fin);
>            } finally {
>                fin.close();
>            }
>            content.setProperty("jcr:lastModified", Calendar.getInstance());
>            content.setProperty("jcr:mimeType", "text/plain");
>
>            session.save();
>
>
> btw: who is it? sirène? celina? susanne? it would be nice to know
> who we're talking to...
>
> cheers
> stefan
>
> >
> > Any help is truly appreciated. Thank you!
> > Best Regards.
> >
> > _________________________________________________________________
> > FREE pop-up blocking with the new MSN Toolbar - get it now!
> > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> >
> >
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Mime
View raw message