jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patricio Echag├╝e <patric...@gmail.com>
Subject Exposing(binding) a repository object through JNDI in Tomcat 6.
Date Thu, 15 Oct 2009 18:57:10 GMT
Hi all, I have a problem I cannot sort out.

I deployed the jackrabbit webapp in tomcat with MySQL according to the steps
in the wiki. (so far so good).
This webapp has a servlet called: RepositoryStartupServlet which I'm using
to bind the repository (created by it) to JNDI so that another webapp can do
a lookup, get the repo and use it.

After configuring ALL the parameters in tomcat to link the resource name
with the context, I get this exception when tomcat starts up:

Caused by: javax.naming.NameNotFoundException: Name jcr is not bound in this
Context
    at org.apache.naming.NamingContext.bind(NamingContext.java:843)
    at org.apache.naming.NamingContext.bind(NamingContext.java:171)
    at org.apache.naming.NamingContext.bind(NamingContext.java:187)
    at org.apache.naming.SelectorContext.bind(SelectorContext.java:171)
    at javax.naming.InitialContext.bind(Unknown Source)
    at
org.apache.jackrabbit.j2ee.RepositoryStartupServlet.registerJNDI(RepositoryStartupServlet.java:451)
    ... 29 more

As you can see there, the error is when the servlet executes the bind()
method. Apparently, the InitialContext is read correctly.

Does anyone has clue?
Basically, these are the configuration files I have set up:

*bootstrap.prop:*
  repository.config=C:/temp/jackrabbitTomcat/repository.xml
  repository.home=C:/temp/jackrabbitTomcat
  repository.name=jcr/local
  # RMI Settings
  rmi.enabled=true
  rmi.port=0
  rmi.host=localhost
  # If the URI is not specified, it's composed as follows:
  #rmi.uri=//${rmi.host}:${rmi.port}/${repository.name}

  # JNDI Settings
  # all properties starting with 'java.naming.' will go into the
  # environment of the initial context
  jndi.enabled=true
  # if the name is not specified, it's initialized with the repository.name
  jndi.name=jcr/local
  java.naming.provider.url=java:comp/env

META-INF -->* context.xml *(in my webapp)

<?xml version="1.0" encoding="UTF-8"?>

<Context>
  <ResourceLink name="jcr/local"  global="jcr/local"
type="javax.jcr.Repository" />
</Context>

*Server.xml*

  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->

    <Resource name="jcr/local" auth="Container"
              type="javax.jcr.Repository"
              description="local repository"

factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory" />

     <!-- I tried with and without the factory attribute -->

  </GlobalNamingResources>


I have tried to create a simple String and do a lookup from another webapp
and it works fine. But in that case, tomcat is instantiating the object.
In my case, I want jackrabbit servlet to create the repository and bind it
to the JNDI context.

Note: I works fine with JBoss though


Thanks.

-- 
Patricio.-

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message