Search code examples
jspstrutsrmi

java.rmi.UnmarshalException: error unmarshalling


I get this execption when I try to access the RMI serevr from action class of struts(i.e. RMI client) (on the click of the jsp button)

java.rmi.UnmarshalException: error unmarshalling return; nested exception is:    
    java.lang.ClassNotFoundException: com.mindcraft.queryExecutor.actionclass.ExecutorInterface (no security manager: RMI class loader disabled)  

Below is my RMI client snippet

try{   
        ExecutorInterface p=(ExecutorInterface)Naming.lookup("//localhost:2007/exec1");   
        System.out.println("Inside client.."+ p.toString());   
        int a= p.getJobStatus("2");   
        System.out.println("a..." + a);   
        p.killJob("1");   
            p.executeJob(id, usrname, pswd);   
        System.out.println("Threads started, main ends\n");   
        }   
        catch(Exception e)   
        {   
            System.out.println("Execption in RMI..."+ e);   
            e.printStackTrace();   
        }  

It was fine when I try above code in separate file with public static void main(),but gets above exception when tried the same code in Action class of struts framework.


Solution

  • Found this around:

    Set a security policy file such as:

    grant {  
    permission java.security.AllPermission "", "";  
    };
    

    In your start up commands:

    -Djava.security.policy=/Security/policy.all
    

    source: link

    try it out and let me know if it works.