AnsweredAssumed Answered

SecureContext timeout in RMI accessing ?

Question asked by leon on Mar 23, 2006
Latest reply on Sep 1, 2006 by danul
After some output ,I get the following exception.
Is there a setting about timeout of SecureContext in RMI?

(the code will be posted after exception )



Exception occured: net.sf.acegisecurity.AuthenticationCredentialsNotFoundException: A valid SecureContext was not provided in the RequestContext

   at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:477)
   at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:355)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:37)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy22.getCurrentUserName(Unknown Source)
   at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:116)
   at $Proxy64.getDefinition(Unknown Source)
   at org.apache.jackrabbit.rmi.server.ServerProperty.getDefinition(ServerProperty.java:118)
   at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
   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.ServerProperty_Stub.getDefinition(Unknown Source)
   at org.alfresco.rmijcr.RemoteJcrTest.visitNode(RemoteJcrTest.java:46)
   at org.alfresco.rmijcr.RemoteJcrTest.visitNode(RemoteJcrTest.java:60)
   at org.alfresco.rmijcr.RemoteJcrTest.visitNode(RemoteJcrTest.java:60)
   at org.alfresco.rmijcr.RemoteJcrTest.main(RemoteJcrTest.java:29)


—accessing code—


public static void main(String[] argv) {
      try {
         // bind server object to object in client
         RemoteRepository r = (RemoteRepository) Naming
               .lookup("//leon:1099/javaContentRepository");

         // invoke method on server object
         Credentials c=new SimpleCredentials("admin","admin".toCharArray());
         RemoteSession session=r.login©;
         RemoteNode root=session.getRootNode();
         
         System.out.println("root of reposity is:" + root.getUUID());
         RemoteNode[] nodes=root.getNodes();
         if(nodes!=null) {
            for(RemoteNode node:nodes) {
               visitNode(node,0);
            }
         }
         
         System.out.println("done");
      } catch (Exception e) {
         System.out.println("Exception occured: ");
         e.printStackTrace();         
         System.exit(0);
      }
   }
   
   public static void visitNode(RemoteNode node,int n) throws Exception{
      System.out.println(node.getName() +"\t" + node.getUUID());
      RemoteProperty[] ps=node.getProperties();
      for(RemoteProperty p:ps) {
         RemotePropertyDefinition d= p.getDefinition();
         if(!d.isMultiple()) {
            System.out.println("\t– "+ p.getName()+"=\t"+p.getValue().getString());
         }else {
            Value[] vs=p.getValues();
            System.out.println("\t– "+ p.getName()+"=");
            for(Value v:vs) {
               System.out.println("\t\t\t"+ v.getString());
            }
         }
      }
      if(n<3) {
         RemoteNode[] children=node.getNodes();
         for(RemoteNode child:children) {
            visitNode(child,n++);
         }
      }
   }

Outcomes