Hi All,
Kindly rectify my problem,
I have deployed jackrabbit-webapp-1.4.war on tomcat and its create a
repository in C:/tomcat/bin/jackrabbit.But when i want to access this
repository through my sample program its shows me error:-
org.apache.jackrabbit.core.config.ConfigurationException: Configuration
file could not be read.: Connection timed out: connect: Connection timed
out: connect
at
org.apache.jackrabbit.core.config.ConfigurationParser.parseXML(Configura
tionParser.java:551)
at
org.apache.jackrabbit.core.config.ConfigurationParser.parseRepositoryCon
fig(ConfigurationParser.java:200)
at
org.apache.jackrabbit.core.config.RepositoryConfig.create(RepositoryConf
ig.java:140)
at
org.apache.jackrabbit.core.config.RepositoryConfig.create(RepositoryConf
ig.java:83)
at
org.apache.jackrabbit.core.jndi.BindableRepository.init(BindableReposito
ry.java:127)
at
org.apache.jackrabbit.core.jndi.BindableRepository.create(BindableReposi
tory.java:115)
at
org.apache.jackrabbit.core.jndi.RegistryHelper.registerRepository(Regist
ryHelper.java:56)
My sample program :-
import java.util.Hashtable;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.apache.jackrabbit.core.jndi.RegistryHelper;
public class Login {
public static void main(String args[]){
String configFile="C:/Tomcat/bin/jackrabbit/repository.xml";
String repHomeDir="C:/Tomcat/bin/jackrabbit/repository";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.jackrabbit.core.jndi" +
".provider.DummyInitialContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
try {
System.out.println("Repository config ");
InitialContext ctx = new InitialContext(env);
RegistryHelper.registerRepository(ctx,"repo",configFile,repHomeDir,
true);
Repository repository = (Repository) ctx.lookup("repo");
System.out.println("Name of the Repository is: " +
repository.getDescriptor(repository.REP_NAME_DESC));
System.out.println("Version of the Repository is: " +
repository.getDescriptor(repository.REP_VERSION_DESC));
Session session = repository.login(
new SimpleCredentials("admin", "admin".toCharArray()));
Node root = session.getRootNode();
Node hello = root.addNode("hello");
Node world = hello.addNode("world");
world.setProperty("message", "Hello, World!");
session.save();
} catch(Exception e){
e.printStackTrace();
}
}
}
please help me to rectify this problem
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates.
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------