You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Evgeniy Strokin <ev...@yahoo.com> on 2007/09/30 13:27:44 UTC
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