You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Wilhelmsen Tor Iver <To...@arrive.no> on 2010/04/19 15:16:20 UTC

Jackrabbit on Glassfish: Exception when registering as JNDI resource jcr/Jackrabbit

I try to configure jackrabbit-webapp-2.0.0 with the recommended JNDI name syntax, but run into an exception in Glassfish 2.1.1 (see below). Is there a different approach I should use?

My bootstrap.properties, based on an example I googled up:

#bootstrap properties for the repository startup servlet.
#Fri Apr 16 10:39:43 CEST 2010
java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory
repository.home=jackrabbit
rmi.enabled=true
repository.config=jackrabbit/repository.xml
repository.name=jackrabbit.repository
rmi.host=localhost
java.naming.provider.url=http\://www.apache.org/jackrabbit
jndi.enabled=true
jndi.name=jcr/Jackrabbit
rmi.port=0


The exception:

[#|2010-04-19T14:57:30.185+0200|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=14;_ThreadName=pool-1-thread-11;|19.04.2010 14:57:30 *ERROR* RepositoryStartupServlet: RepositoryStartupServlet initializing failed: org.apache.jackrabbit.j2ee.ServletExceptionWithCause: Unable to bind repository using JNDI: jcr/Jackrabbit (RepositoryStartupServlet.java, line 245)
org.apache.jackrabbit.j2ee.ServletExceptionWithCause: Unable to bind repository using JNDI: jcr/Jackrabbit
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.registerJNDI(RepositoryStartupServlet.java:454)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.startup(RepositoryStartupServlet.java:240)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.init(RepositoryStartupServlet.java:211)
        at javax.servlet.GenericServlet.init(GenericServlet.java:270)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1194)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1023)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4917)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5324)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:353)
        at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
        at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
        at com.sun.appserv.management.util.misc.RunnableBase.run(RunnableBase.java:341)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.InvalidNameException: jcr/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.bind(DummyContext.java:103)
        at org.apache.jackrabbit.core.jndi.provider.DummyContext.bind(DummyContext.java:114)
        at javax.naming.InitialContext.bind(InitialContext.java:400)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.registerJNDI(RepositoryStartupServlet.java:451)
        ... 17 more
|#]

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriverw@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no




Re: Jackrabbit on Glassfish: Exception when registering as JNDI resource jcr/Jackrabbit

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> jndi.name=Jackrabbit

Meh, the file was not saved so I thought that was the case; it works with

jndi.name=jcr/Jackrabbit

now, for some reason.

- Tor Iver

Re: Jackrabbit on Glassfish: Exception when registering as JNDI resource jcr/Jackrabbit

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> 	<bean id="jndi-repository"
> class="org.springframework.jndi.JndiObjectFactoryBean">
> 		<property name="jndiName" value="jcr/Jackrabbit" />
> 		<property name="proxyInterface"
> value="javax.jcr.Repository" />
> 	</bean>

Discovered that Jackrabbit prepends "jcr/" on its own accord, so 

jndi.name=Jackrabbit

in bootstrap.properties made the above Spring config work. (The portlet uses 1.5.x libraries while the resource is 2.0, but I guess that works because 2.0 is a superset so the 1.x methods that are proxied will exist.)

- Tor Iver

SV: Jackrabbit on Glassfish: Exception when registering as JNDI resource jcr/Jackrabbit

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> The DummyInitialContextFactory included in Jackrabbit can only handle
> simple names without "/" in them. You can avoid this problem by
> changing the JNDI name to something like "jackrabbit".

Thanks, that set me on the track to comment out the setting of the factory so that it instead used the container's - which was what I really wanted in the first place. :)

But I still have a second problem, that a Spring config fails to see the name. Looking in the Glassfish admin, it does not show the registered resource, only the ones defined in the domain.xml file, i.e. JDBC resources mostly... 

The config I use in Spring to look it up (from a Liferay portlet running on the Glassfish) is:

	<bean id="jndi-repository" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName" value="jcr/Jackrabbit" />
		<property name="proxyInterface" value="javax.jcr.Repository" />
	</bean>

- Tor Iver

Re: Jackrabbit on Glassfish: Exception when registering as JNDI resource jcr/Jackrabbit

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Mon, Apr 19, 2010 at 3:16 PM, Wilhelmsen Tor Iver <To...@arrive.no> wrote:
> Caused by: javax.naming.InvalidNameException: jcr/Jackrabbit has more
> components than namespace can handle

The DummyInitialContextFactory included in Jackrabbit can only handle
simple names without "/" in them. You can avoid this problem by
changing the JNDI name to something like "jackrabbit".

BR,

Jukka Zitting