You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Nicholas K. Tulach" <nt...@yahoo.com> on 2000/12/25 06:41:35 UTC
RMI and Tomcat
I have coded a simple example Servlet/Applet program using RMI to communicate between the two. I am running Tomcat 3.2.1 with the JDK1.3 on Linux. First of all, I think I discovered a misconfiguration in the tomcat.sh file that doesn't allow you to start with the SecurityManager enabled. I used the following command to start the tomcat server:
java -classpath TOMCAT_HOME/lib/ant.jar:$TOMCAT_HOME/lib
/jasper.jar:$TOMCAT_HOME/lib/jaxp.jar:$TOMCAT_HOME/lib/parser.jar:$TOMCAT_HOME/l
ib/servlet.jar:$TOMCAT_HOME/lib/webserver.jar -Djava.security.manager -Djava.sec
urity.policy="/usr/local/tomcat/conf/tomcat.policy" -Dtomcat.home=$TOMCAT_HOME o
rg.apache.tomcat.startup.Tomcat &
Notice that the "-Djava.security.policy" option only has one "=", unlike in the stock tomcat.sh file where it has two. Is this a problem? Because with the two "=", it doesn't allow me to start..
Another problem with the startup script is that when I provide the "-security" option, it prints the following usage prompt:
Usage: java org.apache.tomcat.startup.Tomcat {options}
Options are:
-config file (or -f file) Use this file instead of server.xml
-help (or help) Show this usage report
-home dir (or -h dir) Use this directory as tomcat.home
-stop Shut down currently running Tomcat
It seems that this is because the "-security" option isn't being stripped properly from the command that gets executed. Is this right or am I wrong?
So, now on to my real problem. When I use my custom startup command:
java -classpath $TOCMAT_HOME/lib/ant.jar:$TOMCAT_HOME/lib
/jasper.jar:$TOMCAT_HOME/lib/jaxp.jar:$TOMCAT_HOME/lib/parser.jar:$TOMCAT_HOME/l
ib/servlet.jar:$TOMCAT_HOME/lib/webserver.jar -Djava.security.manager -Djava.sec
urity.policy="/usr/local/tomcat/conf/tomcat.policy" -Dtomcat.home=$TOMCAT_HOME o
rg.apache.tomcat.startup.Tomcat &
(which manages to start the server), with a AllPermissions tomcat.policy file, I get the following exception thrown in the browser when I try to access my applet:
Using JRE version 1.3.0 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Lucifier
Proxy Configuration: Browser Proxy Configuration
JAR cache enabled.
http://www.moogoogablau.net:8080/applets/
rmi://www.moogoogablau.net:1099/ChatServlet
Remote exception: Connection refused to host: www.moogoogablau.net; nested exception is:
java.net.ConnectException: Connection refused: no further information
java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkExit(SecurityManager.java:765)
at java.lang.Runtime.exit(Runtime.java:91)
at java.lang.System.exit(System.java:701)
at RMIChatApplet.getChatServer(RMIChatApplet.java:58)
at RMIChatApplet.init(RMIChatApplet.java:91)
at sun.applet.AppletPanel.run(AppletPanel.java:344)
at java.lang.Thread.run(Thread.java:484)
Can someone please provide me with a better, step-by-step configuration of tomcat for use with RMI or at least some tips as to what I might be doing wrong?
thanks
nick