You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Ronald_K <ro...@gmx.at> on 2007/01/04 09:50:25 UTC

Jackrabbit & Pluto - again

Ok, sorry folks for posting again.. normally I wouldn't do this, but I'm
really running out of time and can' find a solution.. so here again my
problem:

At the moment, I'm implementing a small example portal based on the
pluto-driver example portal. Within one of it's portlets i'd like to use
jackrabbit to access content. To experiment with jackrabbit i've worked with
the following code snippet (which works fine in my stand-allone test
application):
-----
       Repository repository = new TransientRepository();
        Session session = repository.login(
                new SimpleCredentials("username",
"password".toCharArray()));
        try {
            Node root = session.getRootNode();

            // Store content
            Node hello = root.addNode("hello");
            Node world = hello.addNode("world");
            world.setProperty("message", "Hello, World!");
            session.save();

            // Retrieve content
            Node node = root.getNode("hello/world");
            System.out.println(node.getPath());
            System.out.println(node.getProperty("message").getString());

            // Remove content
            // root.getNode("hello").remove();
            // session.save();
        } finally {
            session.logout();
        }

Then I've placed that code (along with some test outputs) within a portlet's
code.... well... when reaching the line "Session session = ..." (the 2nd
one), I get the following exception:
------
javax.jcr.RepositoryException: Invalid repository configuration:
repository.xml: Configuration file syntax error.: Premature end of file.:
Configuration file syntax error.: Premature end of file.: Premature end of
file.
------
I'm using Pluto 1.1 and Tomcat 5.5, along with JDK1.5... As I said, the
strange thing is that the same code works fine outside of pluto in a
standallone app, and that the repository.xml was automatically created in
both cases (within a portlet and standallone).. any ideas??
-- 
View this message in context: http://www.nabble.com/Jackrabbit---Pluto---again-tf2918373.html#a8155831
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.


Re: Jackrabbit & Pluto - again

Posted by Tobias Bocanegra <to...@day.com>.
it's in the jackrabbit-server-1.1.1.war. or in the
http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webapp/
module of the upcoming. 1.2 release.

btw: you are writing to the developer list of jackrabbit; whereas your
question are rather userlist related. please post any new similar
questions to users@jackrabbit.apache.org


On 1/4/07, Ronald_K <ro...@gmx.at> wrote:
>
> Thanks a lot for the tip with these Servlets! In which download-package are
> they located and is there anywhere a tutorial how to use them?
>
>
>
> Tobias Bocanegra wrote:
> >
> > i guess the repository-home is relative to the cwd. so you better
> > create the repository with a absolute path, or put the repository.xml
> > in the portlet context.
> > you're probably better off using the ReposistoryStartupServlet and the
> > RepositoryAccessServlet. they can be found in the jackrabbit-webapp
> > module.
> >
> > regards, toby
> >
> > On 1/4/07, Ronald_K <ro...@gmx.at> wrote:
> >>
> >> Ok, sorry folks for posting again.. normally I wouldn't do this, but I'm
> >> really running out of time and can' find a solution.. so here again my
> >> problem:
> >>
> >> At the moment, I'm implementing a small example portal based on the
> >> pluto-driver example portal. Within one of it's portlets i'd like to use
> >> jackrabbit to access content. To experiment with jackrabbit i've worked
> >> with
> >> the following code snippet (which works fine in my stand-allone test
> >> application):
> >> -----
> >>        Repository repository = new TransientRepository();
> >>         Session session = repository.login(
> >>                 new SimpleCredentials("username",
> >> "password".toCharArray()));
> >>         try {
> >>             Node root = session.getRootNode();
> >>
> >>             // Store content
> >>             Node hello = root.addNode("hello");
> >>             Node world = hello.addNode("world");
> >>             world.setProperty("message", "Hello, World!");
> >>             session.save();
> >>
> >>             // Retrieve content
> >>             Node node = root.getNode("hello/world");
> >>             System.out.println(node.getPath());
> >>             System.out.println(node.getProperty("message").getString());
> >>
> >>             // Remove content
> >>             // root.getNode("hello").remove();
> >>             // session.save();
> >>         } finally {
> >>             session.logout();
> >>         }
> >>
> >> Then I've placed that code (along with some test outputs) within a
> >> portlet's
> >> code.... well... when reaching the line "Session session = ..." (the 2nd
> >> one), I get the following exception:
> >> ------
> >> javax.jcr.RepositoryException: Invalid repository configuration:
> >> repository.xml: Configuration file syntax error.: Premature end of file.:
> >> Configuration file syntax error.: Premature end of file.: Premature end
> >> of
> >> file.
> >> ------
> >> I'm using Pluto 1.1 and Tomcat 5.5, along with JDK1.5... As I said, the
> >> strange thing is that the same code works fine outside of pluto in a
> >> standallone app, and that the repository.xml was automatically created in
> >> both cases (within a portlet and standallone).. any ideas??
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Jackrabbit---Pluto---again-tf2918373.html#a8155831
> >> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > -----------------------------------------< 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 >---
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Jackrabbit---Pluto---again-tf2918373.html#a8156106
> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>
>


-- 
-----------------------------------------< 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 >---

Re: Jackrabbit & Pluto - again

Posted by Ronald_K <ro...@gmx.at>.
Thanks a lot for the tip with these Servlets! In which download-package are
they located and is there anywhere a tutorial how to use them?



Tobias Bocanegra wrote:
> 
> i guess the repository-home is relative to the cwd. so you better
> create the repository with a absolute path, or put the repository.xml
> in the portlet context.
> you're probably better off using the ReposistoryStartupServlet and the
> RepositoryAccessServlet. they can be found in the jackrabbit-webapp
> module.
> 
> regards, toby
> 
> On 1/4/07, Ronald_K <ro...@gmx.at> wrote:
>>
>> Ok, sorry folks for posting again.. normally I wouldn't do this, but I'm
>> really running out of time and can' find a solution.. so here again my
>> problem:
>>
>> At the moment, I'm implementing a small example portal based on the
>> pluto-driver example portal. Within one of it's portlets i'd like to use
>> jackrabbit to access content. To experiment with jackrabbit i've worked
>> with
>> the following code snippet (which works fine in my stand-allone test
>> application):
>> -----
>>        Repository repository = new TransientRepository();
>>         Session session = repository.login(
>>                 new SimpleCredentials("username",
>> "password".toCharArray()));
>>         try {
>>             Node root = session.getRootNode();
>>
>>             // Store content
>>             Node hello = root.addNode("hello");
>>             Node world = hello.addNode("world");
>>             world.setProperty("message", "Hello, World!");
>>             session.save();
>>
>>             // Retrieve content
>>             Node node = root.getNode("hello/world");
>>             System.out.println(node.getPath());
>>             System.out.println(node.getProperty("message").getString());
>>
>>             // Remove content
>>             // root.getNode("hello").remove();
>>             // session.save();
>>         } finally {
>>             session.logout();
>>         }
>>
>> Then I've placed that code (along with some test outputs) within a
>> portlet's
>> code.... well... when reaching the line "Session session = ..." (the 2nd
>> one), I get the following exception:
>> ------
>> javax.jcr.RepositoryException: Invalid repository configuration:
>> repository.xml: Configuration file syntax error.: Premature end of file.:
>> Configuration file syntax error.: Premature end of file.: Premature end
>> of
>> file.
>> ------
>> I'm using Pluto 1.1 and Tomcat 5.5, along with JDK1.5... As I said, the
>> strange thing is that the same code works fine outside of pluto in a
>> standallone app, and that the repository.xml was automatically created in
>> both cases (within a portlet and standallone).. any ideas??
>> --
>> View this message in context:
>> http://www.nabble.com/Jackrabbit---Pluto---again-tf2918373.html#a8155831
>> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> -----------------------------------------< 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 >---
> 
> 

-- 
View this message in context: http://www.nabble.com/Jackrabbit---Pluto---again-tf2918373.html#a8156106
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.


Re: Jackrabbit & Pluto - again

Posted by Tobias Bocanegra <to...@day.com>.
i guess the repository-home is relative to the cwd. so you better
create the repository with a absolute path, or put the repository.xml
in the portlet context.
you're probably better off using the ReposistoryStartupServlet and the
RepositoryAccessServlet. they can be found in the jackrabbit-webapp
module.

regards, toby

On 1/4/07, Ronald_K <ro...@gmx.at> wrote:
>
> Ok, sorry folks for posting again.. normally I wouldn't do this, but I'm
> really running out of time and can' find a solution.. so here again my
> problem:
>
> At the moment, I'm implementing a small example portal based on the
> pluto-driver example portal. Within one of it's portlets i'd like to use
> jackrabbit to access content. To experiment with jackrabbit i've worked with
> the following code snippet (which works fine in my stand-allone test
> application):
> -----
>        Repository repository = new TransientRepository();
>         Session session = repository.login(
>                 new SimpleCredentials("username",
> "password".toCharArray()));
>         try {
>             Node root = session.getRootNode();
>
>             // Store content
>             Node hello = root.addNode("hello");
>             Node world = hello.addNode("world");
>             world.setProperty("message", "Hello, World!");
>             session.save();
>
>             // Retrieve content
>             Node node = root.getNode("hello/world");
>             System.out.println(node.getPath());
>             System.out.println(node.getProperty("message").getString());
>
>             // Remove content
>             // root.getNode("hello").remove();
>             // session.save();
>         } finally {
>             session.logout();
>         }
>
> Then I've placed that code (along with some test outputs) within a portlet's
> code.... well... when reaching the line "Session session = ..." (the 2nd
> one), I get the following exception:
> ------
> javax.jcr.RepositoryException: Invalid repository configuration:
> repository.xml: Configuration file syntax error.: Premature end of file.:
> Configuration file syntax error.: Premature end of file.: Premature end of
> file.
> ------
> I'm using Pluto 1.1 and Tomcat 5.5, along with JDK1.5... As I said, the
> strange thing is that the same code works fine outside of pluto in a
> standallone app, and that the repository.xml was automatically created in
> both cases (within a portlet and standallone).. any ideas??
> --
> View this message in context: http://www.nabble.com/Jackrabbit---Pluto---again-tf2918373.html#a8155831
> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>
>


-- 
-----------------------------------------< 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 >---