Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

java.net.ProtocolException

3 views
Skip to first unread message

Tim Vattima

unread,
Jul 18, 2000, 3:00:00 AM7/18/00
to
We are having a weird problem using weblogic 4.5.1 sp9 on Solaris along with
Microsoft's IIS Server proxy. We have a page which contains a link to view a
PDF file. The link goes to a servlet whose service method performs the
following code. At the end, you'll notice a call to a method named
sendOutput. This method is in our abstract servlet class. The implementation
for sendOutput is shown below. The java.net.ProtocolException is being
thrown at the point the forward() method is called in sendOutput.

Any ideas on what wou;d be causing this would be greatly appreciated.
-Tim Vattima
tvat...@answerthink.com

----------------------------------------------------------------------------
----------------------------------------------------------------------------
--
Here's the exception stack trace:
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--
com.crowncastle.isite.servlet.http.LicenseSendServletjava.net.ProtocolExcept
ion: Exceeded stated content-length of: 198131 bytes
Tue Jul 18 08:38:30 EDT 2000:<E> <ServletContext-Servlets> Servlet failed
with RuntimeException
Tue Jul 18 08:38:31 EDT 2000:<E> <ServletContext-Servlets>
java.lang.IllegalStateException: already flushed buffer
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at
java.lang.IllegalStateException.<init>(IllegalStateException.java:45)
at
weblogic.servlet.internal.ServletOutputStreamImpl.clearBuffer(Compiled Code)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(Compiled
Code)
at
com.crowncastle.isite.servlet.http.BaseHttpServlet.sendOutput(BaseHttpServle
t.java:474)
at
com.crowncastle.isite.servlet.http.LicenseSendServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled
Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)

----------------------------------------------------------------------------
----------------------------------------------------------------------------
--
Here's the servlet's service() method:
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--
try
{
if (!this.authenticateUser(req, resp))
return;

// oFileInfo
// 0: File Name (Full path)
// 1: File Description
// 2: File Type
// 3: File Size

String []oFileInfo = doGetLicenseFileInfo(oRequest, oLD);
if (oFileInfo == null) {
// No documentation is available for this license
oData.putString(Constants.ERROR_HEADING, "An error has occurred in
Licenses - " + this.getClass().getName());
oData.putString(Constants.ERROR_MESSAGE, "No license documentation
is available for license #" + oRequest.getString(LICENSE_ID_INPUT, "None"));
sendOutput(Constants.SERVLET_JSP_ERROR_NOTIFICATION, oRequest,
oResponse, oData);
return;
}
String sPathName = oFileInfo[0];
if (req.getPathInfo()==null)

oResponse.sendRedirect(oResponse.encodeRedirectURL(req.getRequestURI() + "/"
+ sPathName + "?" + req.getQueryString()));
String sPathSep = System.getProperty("file.separator");
String sContentLocation = Constants.SERVLET_LICENSE_SEND + "/" +
sPathName.substring(sPathName.lastIndexOf(sPathSep) + 1);
File oFile = new File(sPathName);
long lContentLength = oFile.length();
long lLastModified = oFile.lastModified();

String action = oRequest.getString("action", "missing");
String sContentType;
if (action.equals("view"))
sContentType = PDF_VIEW_TYPE;
else if (action.equals("download"))
sContentType = PDF_DOWNLOAD_TYPE;
else
{
oResponse.sendError(oResponse.SC_BAD_REQUEST);
return;
}


FileInputStream oInputStream = new FileInputStream(oFile);

oResponse.setContentType(sContentType);
ServletOutputStream oOutputStream = oResponse.getOutputStream();

if (!method.equals("HEAD"))
oResponse.setContentLength((int)lContentLength);
else {
oResponse.setContentLength(0);
oResponse.setIntHeader("Content-Length", (int)lContentLength);
}
// oResponse.setHeader("Content-Location", sContentLocation);
oResponse.setDateHeader("Last-Modified", lLastModified);

byte oBuf[] = new byte[10240];
int iRead;

if (!method.equals("HEAD")) {
iRead = oInputStream.read(oBuf);
while (iRead != -1) {
oOutputStream.write(oBuf, 0, iRead);
iRead = oInputStream.read(oBuf);
}
}
}
catch (Exception e)
{
Logger.log(Constants.LOG_SEVERITY_ERROR, e,
this.getClass().getName() + e.toString());
oData.putString(Constants.ERROR_HEADING, "A server error has
occurred in Licenses - " + this.getClass().getName());
oData.putString(Constants.ERROR_MESSAGE, "This is the message: " +
e.getClass().getName() + ":" + e.toString());
sendOutput(Constants.SERVLET_JSP_ERROR_NOTIFICATION, oRequest,
oResponse, oData);
return;
}

----------------------------------------------------------------------------
----------------------------------------------------------------------------
--
Our servlets subclass a class named BaseHttpServlet whose sendOutput method
is the following:
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--
protected void sendOutput(String sTemplate, HttpRequestWrapper oRequest,
HttpServletResponse oResponse, ServletData oData) throws IOException,
ServletException
{
// always add home and US Home as breadcrumbs
// removed as of 5/18 - the Home image, top right does the same
// oData.addBreadCrumb(new BreadCrumb("US Home",
CCProperties.getURLCrownCastleUSHome()));

// Home was removed as an auto breadcrumb
// oData.addBreadCrumb(new BreadCrumb("Home", ""));
if (sTemplate != null)
{
ServletContext oContext = getServletContext();
RequestDispatcher oDispatcher =
oContext.getRequestDispatcher(sTemplate);

if (oDispatcher != null)
{
HttpServletRequest req = oRequest.getHttpServletRequest();

oData.sReferringPage = oRequest.getRequestFullURI();

oData.putBoolean(Constants.ISAUTHENTICATED,isAuthenticated(req,oResponse));

// CALLING_URL may be different than sReferringPage above. Some
servlets may override the getFullURL() method to return
// a more detailed URL than what getRequestFullURI() provides.
oData.putString(Constants.CALLING_URL,getFullURL(oRequest));
if (oData.poPage == null) oData.poPage = new PageObject(-1, -1,
"");
req.setAttribute(ServletData.IDENTIFIER, oData);
oDispatcher.forward(req, oResponse);
}
}
}
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--

Wei Guan

unread,
Jul 18, 2000, 3:00:00 AM7/18/00
to
Download service pack 10. Hope it fix this problem.

--
Cheers - Wei

Tim Vattima <tvat...@answerthink.com> wrote in message
news:3974...@newsgroups.bea.com...

0 new messages