You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Kurz Wolfgang <wo...@gwvs.de> on 2009/03/10 16:04:26 UTC

Accessing Jackrabbit over JNDI

Hello everyone, 

i still havent figured this out:-(


I really have no clue whats going wrong. But I am always getting the same exception:

javax.naming.NamingException: Cannot create resource instance

Here is my code:

Server.xml:

<GlobalNamingResources>
	
	<Resource name="jcr/globalRepository"
		  auth="Container"
          type="javax.jcr.Repository"
          factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
          configFilePath="U:/jackrabbit/repository.xml"
          repHomeDir="U:/jackrabbit"/>

 </GlobalNamingResources>

And in web.xml I do this:

    <resource-env-ref>
		<description>Content Repository</description>
		<resource-env-ref-name>jcr/globalRepository</resource-env-ref-name>
		<resource-env-ref-type>javax.jcr.Repository</resource-env-ref-type>		
	</resource-env-ref>

And in the code I try this:


InitialContext context = new InitialContext();		
Context environment = (Context) context.lookup("java:comp/env");
Repository repository = (Repository) environment.lookup("jcr/globalRepository");


I really need to figure this out cause using jackrabbit over rmi isn't really an option for the productive servers.

If anyone had some hints for me I would really appreciate them:-)

Thx a lot in advance!