DummyContext is a simple service provider that implements a flat namespace in memory. It is intended to be used for testing purposes only.
> javax.naming.InvalidNameException: java:comp/env/jackrabbit has more > components than namespace can handle you're getting this error because DummyContext only supports a flat namespace whereas you specified a composite name ("jcr/repository"). if you're running in an environment that provides jndi support you should be able to use code like this to lookup a repository instance: InitialContext initialContext = new InitialContext(); Context envContext =(Context) initialContext.lookup("java:comp/env"); Repository repo = (Repository) envContext.lookup("jcr/repository"); cheers stefan On 3/7/06, Bilikiss O Adebiyi <[EMAIL PROTECTED]> wrote: > Hello > I'm working with jackrabbit as a webservice. When i set up my repository > like this: > Hashtable env = new Hashtable(); > env.put(Context.INITIAL_CONTEXT_FACTORY, > "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory"); > env.put(Context.PROVIDER_URL, "localhost"); > > InitialContext inContext = new InitialContext(env); > //Tomcat setup > > Context environment > =(Context)inContext.lookup("java:comp/env/jackrabbit"); > repository = > (Repository)environment.lookup("jcr/repository"); > > > I get an error stating that > > javax.naming.InvalidNameException: java:comp/env/jackrabbit has more > components than namespace can handle > at > org.apache.jackrabbit.core.jndi.provider.DummyContext.getComponentName(DummyContext.java:71) > at > org.apache.jackrabbit.core.jndi.provider.DummyContext.lookup(DummyContext.java:247) > at > org.apache.jackrabbit.core.jndi.provider.DummyContext.lookup(DummyContext.java:255) > at javax.naming.InitialContext.lookup(InitialContext.java:361) > at > com.ibm.smb.docStore.service.docStoreImpl.login(docStoreImpl.java:106) > at > com.ibm.smb.docStore.service.docStoreImpl.initialize(docStoreImpl.java:85) > at > com.ibm.smb.docStore.service.test.docStoreStartTest.testLogin(docStoreStartTest.java:29) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) > at java.lang.reflect.Method.invoke(Method.java:391) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118)done > > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) > > > And when i set it up like this: > > Hashtable env = new Hashtable(); > env.put(Context.INITIAL_CONTEXT_FACTORY, > "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory"); > env.put(Context.PROVIDER_URL, "localhost"); > > InitialContext inContext = new InitialContext(env); > RegistryHelper.registerRepository(inContext, "repo", > CONFIG_FILE, DIRECTORY, true); > repository = (Repository)inContext.lookup("repo"); > > > > When an app tries to access my repository after a few times, it tells it > that its locked, and it was not shutdown properly. Any help would be > greatly appreciated > Thanks > > > > > > Bilikiss Adebiyi > Staff Software Engineer > Lotus Software, IBM Software Group > Phone: 1-978-399-5118, (T/L): 333-5118 >