jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Douglas José" <douglasj...@gmail.com>
Subject Re: Client access via JNDI to Jackrabbit Web Application
Date Wed, 24 Sep 2008 12:36:54 GMT
Hello, Ken,

Are you trying to access the repository from another web application? If so,
make sure you declared the resource in your web.xml file:

  <resource-ref>
    <description>JCR Repository</description>
    <res-ref-name>jcr/repository</res-ref-name>
    <res-type>javax.jcr.Repository</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

then the client code:

        InitialContext ctx = new InitialContext();
        Context env = (Context) ctx.lookup("java:comp/env");
        Repository repo = (Repository) env.lookup("jcr/repository");
        return repo.login(new SimpleCredentials("admin", "".toCharArray()));

FYI: The code snippets were copied from my working webapp running on Tomcat.
I assume it should work with Tomcat without any changes.

Good luck,

Douglas

On Sat, Sep 6, 2008 at 11:25 PM, kenclark <kenclark@snet.net> wrote:

>
>
> I changed the code to this:
>
>                InitialContext ctx = new InitialContext() ;
>                Repository repo = (Repository)
> ctx.lookup("java:jackrabbit");
> // ...
>
> And get the message:
>
> javax.naming.NameNotFoundException: jackrabbit not bound
>
> I also tried: Repository repo = (Repository) ctx.lookup("jackrabbit");
> which resulted in the same error.
>
> Here is the relevant part of my bootstrap.properties:
>
>
> # Repository configuration settings (will be adjusted by installer)
> repository.config=e:/jackrabbit/repository.xml
> repository.home=e:/jackrabbit
> repository.name=jackrabbit.repository
>
> # RMI Settings
> rmi.enabled=true
> rmi.port=6776
> 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=${repository.name}
> jndi.name=jackrabbit
> java.naming.provider.url=http://www.apache.org/jackrabbit
>
> java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory
>
> And finally, this from the server log during startup:
>
> 17:12:19,468 INFO  [STDOUT] 06.09.2008 17:12:19 *INFO * AbstractConfig:
> Configuration of JNDIConfig (AbstractConfig.java, line 101)
> 17:12:19,484 INFO  [STDOUT] 06.09.2008 17:12:19 *INFO * AbstractConfig:
> ---------------------------------------------- (AbstractConfig.java,
>  line 102)
> 17:12:19,484 INFO  [STDOUT] 06.09.2008 17:12:19 *INFO * AbstractConfig:
> valid: true (AbstractConfig.java, line 106)
> 17:12:19,484 INFO  [STDOUT] 06.09.2008 17:12:19 *INFO * AbstractConfig:
> jndiName: jackrabbit (AbstractConfig.java, line 106)
> 17:12:19,484 INFO  [STDOUT] 06.09.2008 17:12:19 *INFO * AbstractConfig:
> jndiEnabled: true (AbstractConfig.java, line 106)
> 17:12:19,484 INFO  [STDOUT] 06.09.2008 17:12:19 *INFO * AbstractConfig:
> class: class org.apache.jackrabbit.j2ee.JNDIConfig (AbstractConfig
> .java, line 106)
> 17:12:19,484 INFO  [STDOUT] 06.09.2008 17:12:19 *INFO * AbstractConfig:
> jndiEnv: {java.naming.provider.url=http://www.apache.org/jackrabbit,
>
> java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory}
> (AbstractConfig.java, line 106)
> ...
>
> 17:12:21,593 INFO  [STDOUT] 06.09.2008 17:12:21 *INFO *
> RepositoryStartupServlet: Repository bound to JNDI with name: jackrabbit
> (RepositoryStartupServlet.java, line 452)
>
> Seems better, but still not working.  Do I just need to change "java:" to
> something else?
>
> Thanks,
> ken
> --
> View this message in context:
> http://www.nabble.com/Client-access-via-JNDI-to-Jackrabbit-Web-Application-tp19350925p19351425.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>


-- 
Douglas Jose
http://douglasjose.com

- "Use free software. Help us make a free world."

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