You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Humer Günther <Gu...@ams-engineering.com> on 2006/01/04 18:04:06 UTC

EJB-Access to Repository

Hi!
I want to use the JCR-Repository from a Session Bean. 

How do I access it? What is the best way to deploy the Repository?
I tried to deploy the rar (contrib/jca) which failed. 
So I moved on to deploy the WAR.

The Repository is bound [1] but the lookup fails with a NameNotFoundException. 

How do I lookup the Repository? I tried with [2] the preferred lookup and with a simple InitialContext() without any additional properties. The two Methods fail with a NameNotFoundException. 

I am using Jboss 4.0.3 SP1

Günther Humer


[1]
17:51:17,367 INFO  [STDOUT] 04.01.2006 17:51:17 *INFO * RepositoryStartupServlet:   adding property to JNDI environment: java.naming.provider.url=http://www.apache.org/jackrabbit (RepositoryStartupServlet.java, line 300)
17:51:17,367 INFO  [STDOUT] 04.01.2006 17:51:17 *INFO * RepositoryStartupServlet:   adding property to JNDI environment: java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory (RepositoryStartupServlet.java, line 300)
17:51:17,457 INFO  [STDOUT] 04.01.2006 17:51:17 *INFO * RepositoryStartupServlet: Repository bound to JNDI with name: jackrabbit.repository (RepositoryStartupServlet.java, line 307)
17:51:17,457 INFO  [STDOUT] 04.01.2006 17:51:17 *INFO * RepositoryStartupServlet: RepositoryStartupServlet initialized. (RepositoryStartupServlet.java, line 186)

[2]
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
InitialContext ctx = new InitialContext(env);
Repository r = (Repository)ctx.lookup("repo");