jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From evgeniy.stro...@yahoo.com
Subject Re: get a resourse in webapp
Date Sun, 30 Sep 2007 12:45:36 GMT
I've tried to put context.xml:
<Context>
<Resource name="jcr/repository"
          auth="Container"
          type="javax.jcr.Repository"
          factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
          configFilePath="/BB-ARCHIVE/repository/repository.xml"
          repHomeDir="/BB-ARCHIVE/repository/bbmedia"/>
</Context>
and use this code:
        InitialContext context = new InitialContext();
        Context environment = (Context) context.lookup("java:comp/env");
        Repository repository = (Repository) environment.lookup("jcr/repository");
It gives me this exception:
Exception in thread "main" javax.naming.NamingException: The repository home /BB-ARCHIVE/repository/bbmedia
appears to be in use since the file named .lock is already locked by the current process.

Please advise
I've no clue what's going on.

Thank you
Gene

----- Original Message ----
From: Evgeniy Strokin <evgeniy.strokin@yahoo.com>
To: users@jackrabbit.apache.org
Sent: Sunday, September 30, 2007 7:27:44 AM
Subject: get a resourse in webapp

Hello,
I've installed jackrabbit.war file on Tomcat 6. It works fine.
Now I want to add some services to the application.
I need to get a resource.
How can I get it?
I'm trying to use JNDI, but it doesn't work.
For such code:
InitialContext context = new InitialContext();
Context environment = (Context) context.lookup("java:comp/env");
Repository repository = (Repository) environment.lookup("bbmedia");

I'm getting the exception:
Exception in thread "main" javax.naming.NamingException: Cannot create resource instance
    at org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceEnvFactory.java:114)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at bb.servicebus.MyServiceImpl.getRepository(MyServiceImpl.java:45)
.................

This I have in web.xml:
<resource-env-ref>
  <description>Content Repository</description>
  <resource-env-ref-name>bbmedia</resource-env-ref-name>
  <resource-env-ref-type>javax.jcr.Repository</resource-env-ref-type>
</resource-env-ref>

And this is my bootstrap.properties:

# Repository configuration settings (will be adjusted by installer)
repository.config=/BB-ARCHIVE/repository/repository.xml
repository.home=/BB-ARCHIVE/repository/bbmedia
repository.name=bbmedia

# RMI Settings
rmi.enabled=false
rmi.port=0
rmi.host=localhost

# JNDI Settings
jndi.enabled=true
jndi.name=bbmedia
java.naming.provider.url=http://www.apache.org/jackrabbit
java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory

Could you help me out?
May be I can get the access some other way? 

Thank you
Gene






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