One last attempt... still does not work though, but this is what I tried.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi" +
".provider.DummyInitialContextFactory");
env.put(Context.PROVIDER_URL, "localhost:8080/jackrabbit");
InitialContext ctx = new InitialContext(env);
//repo = (Repository) ctx.lookup("java:jcr/local");
Context envContext =(Context) ctx.lookup("java:comp/env");
repo = (Repository) envContext.lookup("jcr/repository");
This results in the following exception...
Repo Exception: javax.naming.InvalidNameException: java:comp/env has more
components than namespace can handle
Note I also tried java:jcr/local but I get the same exception for that also.
kbar wrote:
>
> I have also tried the following but they also did not work...
>
> String configFile =
> "/Library/Tomcat/Home/jackrabbitrepo/repository.xml";
> String repHomeDir = "/Library/Tomcat/Home/jackrabbitrepo";
> Hashtable env = new Hashtable();
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.jackrabbit.core.jndi" +
> ".provider.DummyInitialContextFactory");
> env.put(Context.PROVIDER_URL, "localhost"); //Also tried
> localhost:8080/jackrabbit
> InitialContext ctx = new InitialContext(env);
> repo = (Repository) ctx.lookup("jackrabbit.repository");
>
>
>
> Here I also tried to register a new name to use but that doesn't work for
> me since I do not have permission to create a .lock file in the repHomeDir
> and I don't want to run NetBeans as root to allow this (and I am not even
> sure it will work anyway).
>
>
> String configFile =
> "/Library/Tomcat/Home/jackrabbitrepo/repository.xml";
> String repHomeDir = "/Library/Tomcat/Home/jackrabbitrepo";
> Hashtable env = new Hashtable();
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.jackrabbit.core.jndi" +
> ".provider.DummyInitialContextFactory");
> env.put(Context.PROVIDER_URL, "localhost"); //Also tried
> localhost:8080/jackrabbit
> InitialContext ctx = new InitialContext(env);
> RegistryHelper.registerRepository(ctx,
> "repo",
> configFile,
> repHomeDir,
> true);
> repo = (Repository) ctx.lookup("repo");
>
>
--
View this message in context:
http://www.nabble.com/JNDI-and-Jackrabbit-tp25101779p25102366.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.