You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jon yeargers <jo...@lupinesystems.net> on 2003/10/08 23:28:16 UTC

Trying to get past java.net.ConnectException

Problem: Im trying to use an Applet to interact with my Tomcat code via
sockets to transfer files. I get the following exception:
 
java.net.ConnectException: Connection refused: connect
 
and it points to a line in my code where I call
URLConnection::getOutputStream();
 
All well and good. I can see where this needs to be protected. I STFW
for information about setting tomcat security (since my books don't seem
to cover it very well.. bad books I guess) and found this page: 
 
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/security-manager-howto.h
tml
 
Sounds like a good thing to try. My applet lives in
${catalina.home}/webapps/viewer so I added this line to my
catalina.policy file:
 
grant codebase "file:{catalina.home}/webapps/viewer/-" {
    permission java.security.AllPermission;
};
 
 
and restarted the server with 
 
bin/startup.sh -security
 
.. to no avail. The situation hasn't changed. 
 
 
 
 
 
 
is this the right approach? Am I barking up the wrong proverbial tree?
 
 
(The applet in question is signed with a test cert - it makes it past
client security and sees my local drive ok)

RE: Trying to get past java.net.ConnectException

Posted by jon yeargers <jo...@lupinesystems.net>.
I guess Im confused as it worked fine when run against the same server
code runnning in my IDE. I assumed that Tomcat would have more security
to prevent hostile apps from doing damage.


-----Original Message-----
From: Tim Funk [mailto:funkman@joedog.org] 
Sent: Wednesday, October 08, 2003 2:48 PM
To: Tomcat Users List
Subject: Re: Trying to get past java.net.ConnectException


If your applet is bombing with java.net.ConnectException, then your
applet is 
the problem, not tomcat.

-Tim

jon yeargers wrote:

> Problem: Im trying to use an Applet to interact with my Tomcat code 
> via sockets to transfer files. I get the following exception:
>  
> java.net.ConnectException: Connection refused: connect
>  
> and it points to a line in my code where I call 
> URLConnection::getOutputStream();
>  
> All well and good. I can see where this needs to be protected. I STFW 
> for information about setting tomcat security (since my books don't 
> seem to cover it very well.. bad books I guess) and found this page:
>  
> http://jakarta.apache.org/tomcat/tomcat-4.0-doc/security-manager-howto
> .h
> tml
>  
> Sounds like a good thing to try. My applet lives in 
> ${catalina.home}/webapps/viewer so I added this line to my 
> catalina.policy file:
>  
> grant codebase "file:{catalina.home}/webapps/viewer/-" {
>     permission java.security.AllPermission;
> };
>  
>   


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



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


Re: Trying to get past java.net.ConnectException

Posted by Tim Funk <fu...@joedog.org>.
If your applet is bombing with java.net.ConnectException, then your applet is 
the problem, not tomcat.

-Tim

jon yeargers wrote:

> Problem: Im trying to use an Applet to interact with my Tomcat code via
> sockets to transfer files. I get the following exception:
>  
> java.net.ConnectException: Connection refused: connect
>  
> and it points to a line in my code where I call
> URLConnection::getOutputStream();
>  
> All well and good. I can see where this needs to be protected. I STFW
> for information about setting tomcat security (since my books don't seem
> to cover it very well.. bad books I guess) and found this page: 
>  
> http://jakarta.apache.org/tomcat/tomcat-4.0-doc/security-manager-howto.h
> tml
>  
> Sounds like a good thing to try. My applet lives in
> ${catalina.home}/webapps/viewer so I added this line to my
> catalina.policy file:
>  
> grant codebase "file:{catalina.home}/webapps/viewer/-" {
>     permission java.security.AllPermission;
> };
>  
>   


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


RE: Trying to get past java.net.ConnectException

Posted by Wade Chandler <wc...@redesetgrow.com>.
An applet isn't affected by your server settings.  What is your applet
trying to connect to?  What port.  Also what servlet or jsp is it
connecting to on your server.  The applet will be affected by the client
system it is running on.  Send the link to the url you need the applet
to connect to.  

I setup a URLConnection like this:
      java.net.URL url = new java.net.URL(s);
      java.net.URLConnection urlc = url.openConnection();
      urlc.setDoInput(true);
      urlc.setDoOutput(true);
      urlc.setUseCaches(false);
	java.io.PrintStream pout = urlc.getOutputStream();//other
streams work as well, just an example.

But you need to understand where you are executing an applet and when
and where the security and settings matter.

Wade

-----Original Message-----
From: jon yeargers [mailto:jony@lupinesystems.net] 
Sent: Wednesday, October 08, 2003 5:28 PM
To: tomcat-user@jakarta.apache.org
Subject: Trying to get past java.net.ConnectException


Problem: Im trying to use an Applet to interact with my Tomcat code via
sockets to transfer files. I get the following exception:
 
java.net.ConnectException: Connection refused: connect
 
and it points to a line in my code where I call
URLConnection::getOutputStream();
 
All well and good. I can see where this needs to be protected. I STFW
for information about setting tomcat security (since my books don't seem
to cover it very well.. bad books I guess) and found this page: 
 
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/security-manager-howto.h
tml
 
Sounds like a good thing to try. My applet lives in
${catalina.home}/webapps/viewer so I added this line to my
catalina.policy file:
 
grant codebase "file:{catalina.home}/webapps/viewer/-" {
    permission java.security.AllPermission;
};
 
 
and restarted the server with 
 
bin/startup.sh -security
 
.. to no avail. The situation hasn't changed. 
 
 
 
 
 
 
is this the right approach? Am I barking up the wrong proverbial tree?
 
 
(The applet in question is signed with a test cert - it makes it past
client security and sees my local drive ok)



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