seeking help with jackrabbit-jcr-servlet component

View: New views
4 Messages — Rating Filter:   Alert me  

seeking help with jackrabbit-jcr-servlet component

by Betty Chang-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi --

I'm trying to write a simple webapp that sits in the same tomcat servlet container as the jackrabbit server.  I want to
use this app to configure some custom nodetypes for the repository.

I'm trying to understand the instructions on the local.jsp page about the jackrabbit-jcr-servlet component.  In particular, it states:
"See the jackrabbit-jcr-servlet documentation for more details. "  

Where is the jackrabbit-jcr-servlet documentation?  

Is it possible for me to use the line of code shown in the local.jsp page to access a repository in the jackrabbit app if my webapp is on
the same container?  Will I  be able to add custom node types this way?    I tried the example, but I ended up with an error about my
context missing the "javax.jcr.repository" attribute.

Thanks

Betty


Re: seeking help with jackrabbit-jcr-servlet component

by Jukka Zitting :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Tue, Jul 22, 2008 at 3:03 AM, Betty Chang <bchang@...> wrote:
> I'm trying to write a simple webapp that sits in the same tomcat servlet container as the jackrabbit server.  I want to
> use this app to configure some custom nodetypes for the repository.
>
> I'm trying to understand the instructions on the local.jsp page about the jackrabbit-jcr-servlet component.  In particular, it states:
> "See the jackrabbit-jcr-servlet documentation for more details. "
>
> Where is the jackrabbit-jcr-servlet documentation?

See the org.apache.jackrabbit.servlet javadocs in
http://jackrabbit.apache.org/api/1.4/.

> Is it possible for me to use the line of code shown in the local.jsp page to access
> a repository in the jackrabbit app if my webapp is on the same container?

Yes if you your webapp has cross-context access to be able to access
the repository from the jackrabbit-webapp context. In Tomcat that
requires a <Context crossContext="true"/> setting.

> Will I  be able to add custom node types this way?

Yes if the jackrabbit-api extension interfaces are shared within the
container. In Tomcat (6.x) that requires moving the jackrabbit-api jar
file from WEB-INF/lib in jackrabbit-webapp to $CATALINA_HOME/lib.

> I tried the example, but I ended up with an error about my
> context missing the "javax.jcr.repository" attribute.

Are you using the jackrabbit-jcr-servlet classes like
ServletRepository to access the repository? Then instead of the code
snippet in local.jsp you should be using the ContextRepositoryServlet
that copies the repository reference from another context to the
context of your webapp.

Another point, the default attribute name is "javax.jcr.Repository" (capital R).

BR,

Jukka Zitting

Re: seeking help with jackrabbit-jcr-servlet component

by Betty Chang-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi --

So, here's what I tried:

I created a servlet that extends ContextRepositoryServlet,  for which the
init-param "path" is set to the context path of the
source servlet ("/jackrabbit").   In the init() for this servlet, I did a
Repository rep = new ServletRepository(this).

Then, when I tried a session = rep.login(), I got the following exception:
javax.servlet.ServletException: javax.jcr.RepositoryException: Invalid
repository: Attribute javax.jcr.Repository in servet context Jackrabbit JCR
Server is an instance of
org.apache.jackrabbit.commons.repository.ProxyRepositoryAm I even on the
right track?

Thanks

Betty

----- Original Message -----
From: "Jukka Zitting" <jukka.zitting@...>
To: <users@...>
Sent: Tuesday, July 22, 2008 1:47 AM
Subject: Re: seeking help with jackrabbit-jcr-servlet component


> Hi,
>
> On Tue, Jul 22, 2008 at 3:03 AM, Betty Chang <bchang@...> wrote:
>> I'm trying to write a simple webapp that sits in the same tomcat servlet
>> container as the jackrabbit server.  I want to
>> use this app to configure some custom nodetypes for the repository.
>>
>> I'm trying to understand the instructions on the local.jsp page about the
>> jackrabbit-jcr-servlet component.  In particular, it states:
>> "See the jackrabbit-jcr-servlet documentation for more details. "
>>
>> Where is the jackrabbit-jcr-servlet documentation?
>
> See the org.apache.jackrabbit.servlet javadocs in
> http://jackrabbit.apache.org/api/1.4/.
>
>> Is it possible for me to use the line of code shown in the local.jsp page
>> to access
>> a repository in the jackrabbit app if my webapp is on the same container?
>
> Yes if you your webapp has cross-context access to be able to access
> the repository from the jackrabbit-webapp context. In Tomcat that
> requires a <Context crossContext="true"/> setting.
>
>> Will I  be able to add custom node types this way?
>
> Yes if the jackrabbit-api extension interfaces are shared within the
> container. In Tomcat (6.x) that requires moving the jackrabbit-api jar
> file from WEB-INF/lib in jackrabbit-webapp to $CATALINA_HOME/lib.
>
>> I tried the example, but I ended up with an error about my
>> context missing the "javax.jcr.repository" attribute.
>
> Are you using the jackrabbit-jcr-servlet classes like
> ServletRepository to access the repository? Then instead of the code
> snippet in local.jsp you should be using the ContextRepositoryServlet
> that copies the repository reference from another context to the
> context of your webapp.
>
> Another point, the default attribute name is "javax.jcr.Repository"
> (capital R).
>
> BR,
>
> Jukka Zitting
>


Re: seeking help with jackrabbit-jcr-servlet component

by Betty Chang-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi --

Okay, I sorted out my last problem.  I moved all of my jackrabbit lib jar
files into the tomcat/lib folder so that it is shared
among the two different webapps.  Otherwise, the "instanceOf Repository"
fails inside the ContextRepositoryFactory.java code.


Betty

----- Original Message -----
From: "Betty Chang" <bchang@...>
To: <users@...>
Sent: Tuesday, July 22, 2008 11:56 AM
Subject: Re: seeking help with jackrabbit-jcr-servlet component


> Hi --
>
> So, here's what I tried:
>
> I created a servlet that extends ContextRepositoryServlet,  for which the
> init-param "path" is set to the context path of the
> source servlet ("/jackrabbit").   In the init() for this servlet, I did a
> Repository rep = new ServletRepository(this).
>
> Then, when I tried a session = rep.login(), I got the following exception:
> javax.servlet.ServletException: javax.jcr.RepositoryException: Invalid
> repository: Attribute javax.jcr.Repository in servet context Jackrabbit
> JCR Server is an instance of
> org.apache.jackrabbit.commons.repository.ProxyRepositoryAm I even on the
> right track?
>
> Thanks
>
> Betty
>
> ----- Original Message -----
> From: "Jukka Zitting" <jukka.zitting@...>
> To: <users@...>
> Sent: Tuesday, July 22, 2008 1:47 AM
> Subject: Re: seeking help with jackrabbit-jcr-servlet component
>
>
>> Hi,
>>
>> On Tue, Jul 22, 2008 at 3:03 AM, Betty Chang <bchang@...>
>> wrote:
>>> I'm trying to write a simple webapp that sits in the same tomcat servlet
>>> container as the jackrabbit server.  I want to
>>> use this app to configure some custom nodetypes for the repository.
>>>
>>> I'm trying to understand the instructions on the local.jsp page about
>>> the jackrabbit-jcr-servlet component.  In particular, it states:
>>> "See the jackrabbit-jcr-servlet documentation for more details. "
>>>
>>> Where is the jackrabbit-jcr-servlet documentation?
>>
>> See the org.apache.jackrabbit.servlet javadocs in
>> http://jackrabbit.apache.org/api/1.4/.
>>
>>> Is it possible for me to use the line of code shown in the local.jsp
>>> page to access
>>> a repository in the jackrabbit app if my webapp is on the same
>>> container?
>>
>> Yes if you your webapp has cross-context access to be able to access
>> the repository from the jackrabbit-webapp context. In Tomcat that
>> requires a <Context crossContext="true"/> setting.
>>
>>> Will I  be able to add custom node types this way?
>>
>> Yes if the jackrabbit-api extension interfaces are shared within the
>> container. In Tomcat (6.x) that requires moving the jackrabbit-api jar
>> file from WEB-INF/lib in jackrabbit-webapp to $CATALINA_HOME/lib.
>>
>>> I tried the example, but I ended up with an error about my
>>> context missing the "javax.jcr.repository" attribute.
>>
>> Are you using the jackrabbit-jcr-servlet classes like
>> ServletRepository to access the repository? Then instead of the code
>> snippet in local.jsp you should be using the ContextRepositoryServlet
>> that copies the repository reference from another context to the
>> context of your webapp.
>>
>> Another point, the default attribute name is "javax.jcr.Repository"
>> (capital R).
>>
>> BR,
>>
>> Jukka Zitting
>>
>
>

LightInTheBox - Buy quality products at wholesale price