I have not used RMI since '98 and I know it has gone through some changes since then. It use to be that RMIC created stubs and skeletons fore marshalling the data and class structure. (That is not the case anymore is it?) But, when I did this...even though the stub was on one side and th skeleton on the other, I had to have at least one of them on both client and server side in order for it to work. This is probably not helpful, but my point is....is this a Tomcat problem or a java problem??

Mike S.

Gary Pennington wrote:
Hi,

Environment:

OS: Solaris 10 on client and server
Java: java full version "1.5.0_06-b04"
Tomcat: 5.5.15

I'm trying make one of my servlets act as an RMI client with an RMI server
running on a different host.

I have a problem though and I can't seem to make much progress, so maybe
someone can help me.

If I invoke Tomcat with the following additional options, I can make my
servlet/RMI client deploy:

-Djava.rmi.server.codebase="http://webserver/builds2/garypen/jars/jscmc.jar 
http://webserver/builds2/garypen/jars/jscma.jar";

The application executes fine until it tries to make an RMI call to the server
which involves transferring an object from the client to the server. At this
point, if I make sure that the client jar file is in my server's class path
then everything works fine, since the server loads the local class definition.
However, this is not ideal and I don't want to have to load client jar files
on my server. Rather, I would like to use the RMI capability to load the
class definition from my client. This is the problem I'm trying to solve.

I modified my catalina policy file so that:

//Gary's nasty hack to get round all security :)
grant codeBase "file:${catalina.home}/webapps/repository/-" {
    permission java.security.AllPermission;
};

You'll note that I'm trying to give every permisssion to my servlets.
I'll fix this later and only give specific permissions. I'm just using
this whilst I figure out what is going on.

I start up my server with the -security option to make sure the policy
file is used to set the security environment.

However, when the call to the server is made, I get the following errors:

Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested 
exception is:
        java.lang.ClassNotFoundException: access to class loader denied
<blah, bla, blah...>
Caused by: java.security.AccessControlException: access denied 
(java.io.FilePermission 
/home/garypen/dev/dist/apache-tomcat-5.5.15/webapps/repository/WEB-INF/classes/-
 read)

(This is just a snippet of the full trace log, the rest appears to be
fairly unhelpful detail.)

So, this is a big puzzle to me. I'm giving everything under
<blah>/webapps/repository all permissions and yet Tomcat is failing to
load the class that I want to send to my RMI server because of a
permissions problem.

Has anyone got any idea what the problem could be?

On a related note. When you modify a policy file and use the '-' sign to
indicate all jars and classes under this codebase have the policies applied.
Does this include jar files with different extensions, e.g. .war or .ear?

It doesn't seem that it does at the moment, so I'm unpacking my .war
files. Again, this is a bit unsatisfactory, so I'd rather not do this.
How do I set policy against .war files?

Thanks for any pointers,

Gary

--
Mike Sabroff
Web Services
Developer
[EMAIL PROTECTED]
920-568-8379


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to