jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruchi Goel <Ruchi.G...@Sun.COM>
Subject Error in logging in to remote repository via JNDI (using Tomcat)
Date Wed, 06 Dec 2006 16:29:27 GMT
Hi,

 I have RMIServer :
public class RMIServer {
   
        private static String REPOSITORY_CONFIG="repository-xml.xml";
        private static String REPOSITORY_DIR="PortalContentRepository";

    
    /**
     * The main entry point of the example application.
     *
     * @param args command line arguments (ignored)
     * @throws Exception if an error occurs
     */
    public static void main(String[] args) throws Exception {
        Repository repository = new 
TransientRepository(REPOSITORY_CONFIG,REPOSITORY_DIR);
       
        ServerAdapterFactory factory = new ServerAdapterFactory();
        RemoteRepository remote = factory.getRemoteRepository(repository);
        Registry reg = LocateRegistry.createRegistry(1101);
        reg.rebind("jackrabbit", remote);
       
       
    }


Following RMIClient  is able to conenct and write to the above repository.
public class RMIClient {

    /**
     * The main entry point of the example application.
     *
     * @param args command line arguments (ignored)
     * @throws Exception if an error occurs
     */
    public static void main(String[] args) throws Exception {
        ClientRepositoryFactory factory = new ClientRepositoryFactory();
        Repository repository = 
factory.getRepository("rmi://localhost:1101/jackrabbit");
       
        Session session = repository.login(new 
SimpleCredentials("superuser", "superuser".toCharArray()),null);
        //Session session = repository.login();
        try {
            String user = session.getUserID();
            String name = 
repository.getDescriptor(Repository.REP_NAME_DESC);
            System.out.println(
                    "Logged in as " + user + " to a " + name + " 
repository.");
           
            //Test adding and saving of node via to repository accessed 
via rmi
             Node rn = session.getRootNode();
             Node  cms = rn.addNode("cms");
      
            //---------------------------add first 
ad-----------------------------------
            Node ad = cms.addNode("ad");           
            ad.setProperty("title","IT Jobs !!");
            session.save();
            ad.save();
           
        } finally {
            session.logout();
        }
    }


Now, I am trying JNDI from web application to discover the remote 
repository. I registered under Tomcat server.xml following :
<Resource auth="Container" 
factory="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory" 
name="jcr/globalRepository"  url="rmi://localhost:1101/jackrabbit" 
type="javax.jcr.Repository" />
and the web application tries to login to repository via following :
 InitialContext initial = new InitialContext();
       
        //Look up needed for Tomcat
        Context context = (Context) initial.lookup("java:comp/env");
        System.out.println("before lookup");
        repository = (Repository) context.lookup("jcr/GlobalRepository");
       repository.login(new SimpleCredentials("superuser", 
"superuser".toCharArray()));

I get following error in last line , while I am able to login as anonymous.
java.rmi.ServerException: RemoteException occurred in server thread; 
nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; 
nested exception is:
        java.net.MalformedURLException: no protocol: 
Files/netbeans-5.0/enterprise2/jakarta-tomcat-5.5.9/common/classes/
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
        at java.lang.Thread.run(Thread.java:595)
        at 
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
        at 
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
        at 
org.apache.jackrabbit.rmi.server.ServerRepository_Stub.login(Unknown Source)
        at 
org.apache.jackrabbit.rmi.client.ClientRepository.login(ClientRepository.java:97)
        at 
com.sun.portal.cms.ad.service.AdModelServiceImpl.getSession(AdModelServiceImpl.java:43)
        at 
com.sun.portal.cms.ad.service.AdModelServiceImpl.getAd(AdModelServiceImpl.java:67)
        at 
com.sun.portal.cms.ad.model.TemplateFiller.getHtmlFromCMS(TemplateFiller.java:69)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

P.S .I have jcr-rmi.jar under commons as well webapp   WEB-INF//lib 
directory


Appreciate help.
Thanks,
Ruchi






Mime
View raw message