You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nikola Milutinovic <Ni...@ev.co.yu> on 2005/05/27 20:11:26 UTC

Tomcat and RMI client - setup

Hi all.

This might be a simple question. I have a working RMI client and server. 
I have tested it no problem. Now I would like to make a JSP/Servlet that 
will act as a RMI client and connect to the RMI server running outside 
Tomcat JVM.

I keep running into access permission violations. I understand that I 
need to setup security policy, I had that for RMI. One thing than makes 
me slightly suspicious, is the fact that when I debug TC/RMI combo, I 
can see that my RMI client enters into setting up RMISecurityManager:

                    if (System.getSecurityManager() == null) {
goes in =>         System.setSecurityManager( new RMISecurityManager() );
                    }

Is that OK? I thought TC would setup security manager.

Now, my question is, what about Tomcat? If I want to run this, what do I 
need to do?

If I get it, I need to:

- setup catalina.policy
- run it with "-security" option

I'm on Windows XP, how do I enable security mode  for TC?

Am I barking up the wrong tree?

Nix.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


[Addendum] Re: Tomcat and RMI client - setup (ClasCastException)

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
Bill Barker wrote:

>"Nikola Milutinovic" <Ni...@ev.co.yu> wrote in message 
>news:429762CE.2020605@ev.co.yu...
>  
>
>>- setup catalina.policy
>>- run it with "-security" option
>>
>>I'm on Windows XP, how do I enable security mode  for TC?
>>    
>>
>
>That's the idea.  And, as a bonus, it works the same on Linux, Solaris, 
>OS/X, .....
>  
>

OK. I've realised that TC should handle security and now it works - on 
5.0.19, imbeded in JBuilder.

Well, I meant ot say it partially works. This is what I have set:

-Djava.security.manager
-Djava.security.policy=.../conf/catalina.policy
-Djava.rmi.server.codebase=http://localhost:8080/MyApp/classes/

All seams to work except, I get a class cast exception when I cast this:

Object obj = Naming.lookup( "//localhost/Search" );
SearchRMI search = (SearchRMI) obj;

The funny thing is, when I inspect the result from the JBuilder, it 
shows that obj is of a class SearchImpl_Stub, which implements SearchRMI 
interface.

I suspect I'm being hit with some RMI classloader issue, so my next 
question is:

Has anyone done this? And what am I doing wrong?

Nix.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat and RMI client - setup

Posted by Bill Barker <wb...@wilshire.com>.
"Nikola Milutinovic" <Ni...@ev.co.yu> wrote in message 
news:429762CE.2020605@ev.co.yu...
> Hi all.
>
> This might be a simple question. I have a working RMI client and server. I 
> have tested it no problem. Now I would like to make a JSP/Servlet that 
> will act as a RMI client and connect to the RMI server running outside 
> Tomcat JVM.
>
> I keep running into access permission violations. I understand that I need 
> to setup security policy, I had that for RMI. One thing than makes me 
> slightly suspicious, is the fact that when I debug TC/RMI combo, I can see 
> that my RMI client enters into setting up RMISecurityManager:
>
>                    if (System.getSecurityManager() == null) {
> goes in =>         System.setSecurityManager( new RMISecurityManager() );
>                    }
>
> Is that OK? I thought TC would setup security manager.
>

Setting an SM this late could cause wierd problems, depending on what 
permissions it doesn't grant, so it's probably at the least a bad idea.  TC 
only sets up the SM if you start it with '-security'.

> Now, my question is, what about Tomcat? If I want to run this, what do I 
> need to do?
>
> If I get it, I need to:
>
> - setup catalina.policy
> - run it with "-security" option
>
> I'm on Windows XP, how do I enable security mode  for TC?

That's the idea.  And, as a bonus, it works the same on Linux, Solaris, 
OS/X, .....

>
> Am I barking up the wrong tree?
>
> Nix. 




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org