You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by pingu1611 <ga...@virgin.net> on 2008/05/20 00:59:58 UTC

Shared JNDI with Tomcat

Hi, 

Thanks in advance for any help you may be able to give. I've searched the
net for a couple of days now but with no success (even with similar messages
posted on this site). 

What I'm trying to do is setup global JNDI on tomcat 5.5 for use with
jackrabbit and Magnolia CMS but either it's not working or I have lost the
plot.

A previous message on this subject said to include the resource in the
GlobalNamingResources element of server.xml along with the ResourceLink in
context.xml. This is what I have: 

in server.xml

<Resource name="magnoliaAuthor" 
                  auth="Container" 
                  type="javax.jcr.Repository"           
                 
factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory" 
                 
configFilePath="C:/msgn-work/magnolia/magnolia-3.5.4/apache-tomcat-5.5.25/webapps/magnoliaAuthor/WEB-INF/config/default/repositories.xml" 
                  repHomeDir="c:/magnoliarepo/magnolia" /> 

in context.xml

<ResourceLink global="magnoliaAuthorGlobal" name="magnoliaAuthor"
type="javax.jcr.Repository" /> 

and in web.xml 

     <resource-env-ref> 
         <description>Jackrabbit Repository</description> 
         <resource-env-ref-name>magnoliaAuthor</resource-env-ref-name> 
         <resource-env-ref-type>javax.jcr.Repository</resource-env-ref-type> 
     </resource-env-ref> 

Using this configuration doesn't appear to work as when I put some debugging
in my servlet the jndi context is empty. 

The piece of servlet code is: 

            Context initContext = new InitialContext (); 
            Context envContext  = (Context)initContext.lookup
("java:/comp/env"); 
            
            Object o = envContext.lookup ("magnoliaAuthor"); // Should this
be the global name (doesn't work either way). 
            BindableRepository repo = (BindableRepository) o; 

Hope someone can point me in the right direction. 

Thanks, 

Gareth

-- 
View this message in context: http://www.nabble.com/Shared-JNDI-with-Tomcat-tp17329972p17329972.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Shared JNDI with Tomcat

Posted by Florian Holeczek <fl...@holeczek.de>.
> I then read on some site (can't remember which as I've been to so
> many) that these parameters cannot be the same. Is this not the
> case?

No, that's definitely wrong. You're simply linking the global resource
into your context and _may_, but don't have to, change its (local) name.

Don't know what's going on then, if this wasn't the problem, sorry.

Regards,
 Florian

Re: Shared JNDI with Tomcat

Posted by pingu1611 <ga...@virgin.net>.
Thanks for the response Florian. I orignally had both the global parameter
and the name parameter the same and still had the problem. I then read on
some site (can't remember which as I've been to so many) that these
parameters cannot be the same. Is this not the case?

Thanks,

Gareth




Florian Holeczek wrote:
> 
> Hallo Gareth,
> 
> your resource is named magnoliaAuthor in the server.xml, so you'll
> have to refer to this name in the context.xml.
> 
> Try modifying your context.xml as follows:
> 
> <ResourceLink global="magnoliaAuthor" name="magnoliaAuthor"
>  type="javax.jcr.Repository" />
> 
> (simply delete the "global" suffix)
> 
> Regards,
>  Florian
> 
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/Shared-JNDI-with-Tomcat-tp17329972p17350519.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Shared JNDI with Tomcat

Posted by Florian Holeczek <fl...@holeczek.de>.
Hallo Gareth,

your resource is named magnoliaAuthor in the server.xml, so you'll
have to refer to this name in the context.xml.

Try modifying your context.xml as follows:

<ResourceLink global="magnoliaAuthor" name="magnoliaAuthor"
 type="javax.jcr.Repository" />

(simply delete the "global" suffix)

Regards,
 Florian