santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thompson, Willard" <willard.thomp...@goodrich.com>
Subject Tomcat Giving 401 Unauthorized
Date Fri, 17 Nov 2006 18:46:24 GMT
Hello,

 

I am trying to set up a HttpURLConnection stream from a servlet running
on Tomcat to another web server within our LAN, where Tomcat is running
on my desktop.

 

However, I keep getting the following error:

 

Permissions: connect,resolve

Response code: 401

Response message: Unauthorized ( The server requires authorization to
fulfill the request. Access to the Web server is denied. Contact the
server administrator.  )

 

 

Here is my code:

 

url = new URL(urlStr);

urlConnection = url.openConnection();             

httpConnection = (HttpURLConnection) urlConnection;

httpConnection.setDoOutput(true);

httpConnection.setRequestMethod("POST");

httpConnection.setRequestProperty("Content-type", "text/xml");


Permission permission = httpConnection.getPermission();             

System.out.println("Permissions: " + permission.getActions());


outStream = new PrintStream(httpConnection.getOutputStream());

outStream.println(xml);

outStream.close();

 

//*** Debug

int responseCode = httpConnection.getResponseCode();

System.out.println("Response code: " + responseCode);         

String responseMsg = httpConnection.getResponseMessage();

System.out.println("Response message: " + responseMsg);             

 

 

When I run this same code within a stand alone Java app from my PC, it
works just fine.  I am able to connect and I get a response message of
OK.  One of my co-workers is able to run this code within his Tomcat
instance just fine, but we are unable to figure out why my Tomcat isn't
working correctly for this.

 

Also, regardless of what I put in my URL string, I still get the same
error, which leads us to believe that it is something with the Tomcat
security.  I've tried a number of different entries within the
catalina.policy file and no luck.  Of course, I've tried to open up the
remote web server's security permissions and still no luck.  I've even
added our remote server to my no proxy list configuration in Internet
Options.

 

Any help would be great!

 

Thanks,

--Willard

 


Mime
View raw message