You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Tom Jordahl <to...@macromedia.com> on 2003/10/31 16:35:45 UTC

RE: Crash in AxisServlet when getting the list of services or get ting the wsdl

 

If you could submit the changes in a Bugzilla report in the form of a patch, that would be very helpful.

  http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SubmitPatches <http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SubmitPatches> 

 

Thanks!

--
Tom Jordahl
Macromedia Server Development

-----Original Message-----
From: Spijker, Lodewijk [mailto:lspijker@Informatica.com] 
Sent: Friday, October 31, 2003 5:25 AM
To: axis-dev@ws.apache.org
Subject: Crash in AxisServlet when getting the list of services or getting the wsdl

 

Hi,

 

we have an application running on WebLogic81 (among others, like WebSphere5, SunOne, WebLogic61, JBoss). We use Axis for handling SOAP. When the application is installed you can get a list of all installed webservices by the following URL: http://localhost:7001/ias/api4/services <http://localhost:7001/ias/api4/services> , this crashes. Obtaining the wsdl crashes too. Here the stacktrace:

 

Oct 24, 2003 4:50:06 PM CEST> <Error> <HTTP> <BEA-101020> <[ServletContext(id=19282192,name=ias,context-path=/ias)] Ser
vlet failed with Exception
java.lang.IllegalStateException: Attempt to change ContentType after calling getWriter() (cannot change charset from 'Cp1252' to 'ISO-8859-1')
       at weblogic.servlet.internal.ServletResponseImpl.setEncoding(ServletResponseImpl.java:857)
       at weblogic.servlet.internal.ServletResponseImpl.setHeader(ServletResponseImpl.java:688)
       at weblogic.servlet.internal.ServletResponseImpl.setContentType(ServletResponseImpl.java:269)
       at org.apache.axis.transport.http.AxisServlet.reportTroubleInGet(AxisServlet.java:358)
       at org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:340)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
       at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
       at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
       at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
       at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)
       at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
       at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
       at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
       at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
       at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
       at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

 

.

 

I have examined the code of the AxisServlet.java and I noticed that a PrintWriter object was created from the HttpServletResponse object. However, after that, the content type of the response object was changed. This is not recommended practice, but at least in case of WebLogic81, it is prohibited (see stacktrace above).

The fix for this problem was rather easy. I have made a wrapper around the PrintWriter class that creates the PrintWriter object on demand. This has the advantage to the create writer try..finally..writer.close construct can be left intact. It works because, fortunately, nowhere the contenttype of the response object is changed after actually using the writer.

 

To elaborate the above explanation, I have included the new implementation of the AxisServlet.java and the printer writer class. You are entitled to use this code as you see fit in axis.

 

I hope that it will helpful and prevents some problems with Axis and WebLogic81,

 

regards,

 

Lodewijk Spijker

Software Engineer

Informatica Netherlands BV

 

lspijker@informatica.com