Specifically, the method getInputStream() on the object URLConnection is
randomly throwing a FileNotFoundException for valid URLs.
This class is instantiated from a JSP page being served by Allaire's JRUN
and is used to return content for rendering in Plumtree's portal product.
Here is the call stack for the exception:
java.io.FileNotFoundException:
http://white/test/test.dll?Widget=PortalBridge&Display=Bookma
rk&Size=Wide&SetTemp=N&Portal=PT&UserName=PT-Administrator&Section=100338
&AdminUN=Admin at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java, Compiled Code) at
com.opentext.myLivelink.LivelinkCommon.getURLContents(LivelinkCommon.java,
Compiled Code) at
jrun__LLRemoteGadgets__LivelinkBookmark__LLBookmark_view2ejsp35._jspService(
jrun__LLRemoteGadgets__LivelinkBookmark__LLBookmark_view2ejsp35.java,
Compiled Code) at
allaire.jrun.jsp.HttpJSPServlet.service(HttpJSPServlet.java, Compiled Code)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code) at
allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code) at
allaire.jrun.servlet.JRunNamedDispatcher.forward(JRunNamedDispatcher.java,
Compiled Code) at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java,
Compiled Code) at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled
Code) at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code)
at
allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.jav
a, Compiled Code) at allaire.jrun.servlet.JRunSE.service(JRunSE.java,
Compiled Code) at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java,
Compiled Code) at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java,
Compiled Code) at allaire.jrun.ThreadPool.run(ThreadPool.java, Compiled
Code) at allaire.jrun.WorkerThread.run(WorkerThread.java, Compiled Code)
Here is the code for the method getURLContents():
public String getURLContents( String addrURL )
{
String pageURLContents = "";
String pageLine = "";
URL objURL = null;
URLConnection objURLConnection = null;
// add handler for SSL
System.setProperty( "java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol" );
try
{
StringBuffer pageContents = new StringBuffer( "" );
if ( addrURL == null )
pageURLContents = "ERROR: No URL was specified.";
else if ( addrURL.length() == 0 )
pageURLContents = "ERROR: No URL was specified.";
else
{
objURL = new URL( addrURL );
if ( objURL.getProtocol().equals( "http" ) ||
objURL.getProtocol().equals( "https" ) )
{
objURLConnection = objURL.openConnection();
// get a reader to store the URL contents
BufferedReader r = new BufferedReader(
new InputStreamReader(
objURLConnection.getInputStream()));
while( ( pageLine = r.readLine() ) != null )
{
pageContents.append( pageLine );
pageContents.append( "\r\n" );
}
// close the reader
r.close();
pageURLContents = pageContents.toString();
// check for content
if ( pageURLContents.length() < 1 )
pageURLContents = "The server did not return any
content for the specified URL.";
}
else
{
pageURLContents = "ERROR: Bad protocol. Only the HTTP and
HTTPS protocols are supported.";
}
}
}
catch ( Exception e )
{
// output the exception contents
pageURLContents = getCallStack( e );
}
return ( pageURLContents );
}
Any help is greatly appreciated.
Thanks...
Dave White
Murvin
David F. White <wh...@infinet.com> wrote:
: Hi, we've got a problem that we cannot solve and I hope someone can point
: // close the reader
: r.close();
: pageURLContents = pageContents.toString();
: return ( pageURLContents );
: }
: Thanks...
: Dave White
--
.........................................................................
*>>>>Murvin Lai<<<< >>>>--Muffin--<<<< email: murvi...@sfu.ca *
*homepage: http://www.sfu.ca/~mmlai mm...@sfu.ca *
`````````````````````````````````````````````````````````````````````````
It turns out the URLs being accessed by URLConnection objects were
being created on multiple threads. Furthermore, the machine specified on
the URLs was an NT workstation, NOT an NT server. IIS on NT workstations
limits the number of simultaneous connections to four.
Therefore, depending on which threads completed first, different
requests to the method getInputStream() on URLConnection would throw the
FileNotFoundException because no more connections were being allowed by IIS
on the NT workstation.
Switching to an NT or Windows 2000 server solved our problem.
Dave White