[
Lists Home |
Date Index |
Thread Index
]
- To: Seetha Rama Krishna <ram_kurra@yahoo.co.in>, xml-dev@lists.xml.org
- Subject: Re: [xml-dev] servlet and xml getting java.lang.IllegalStateException
- From: Tatu Saloranta <cowtowncoder@yahoo.com>
- Date: Fri, 16 Jun 2006 09:12:17 -0700 (PDT)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=M/X7aZvcQ1I0K1s64rfBNcjXDjqndj5aTYFCMTkQK4UR0OaJ5bzwSknUgSPr8SlKRjYZ1a0r1F+UtiP3H2nyMqECujQcrChtnW+gqW9OeujToDE7RC8/NGWwgmKXAXWB1t+If0Ojq91D3z4uV9Wfha47LLMkAn6BX+0rOnJi8CE= ;
- In-reply-to: <20060616113658.2003.qmail@web8403.mail.in.yahoo.com>
This is more a Java+Servlet question, as your problem
has nothing to do specifically with XML. So you
probably should ask this question on some other
mailing list (classes involved look like Tomcat
classes, but embedded in Sun's App server?).
-+ Tatu +-
--- Seetha Rama Krishna <ram_kurra@yahoo.co.in> wrote:
> Hi All,
> I am tryng to generate the xml file
> from servlet. I am getting the following
> exception.
>
>
>
[#|2006-06-16T16:40:21.187+0530|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.container.web|_ThreadID=21;|ApplicationDispatcher[/ruleengine]
> Servlet.service() for servlet jsp threw exception
> java.lang.IllegalStateException: getOutputStream()
> has already been called for this response
> at
>
org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:619)
> at
>
org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:181)
> at
>
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:143)
> at
>
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:136)
> at
>
org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:195)
> at
>
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)
> at
>
org.apache.jasper.runtime.JspFactoryImpl.access$100(JspFactoryImpl.java:42)
> at
>
org.apache.jasper.runtime.JspFactoryImpl$PrivilegedReleasePageContext.run(JspFactoryImpl.java:178)
> at
> java.security.AccessController.doPrivileged(Native
> Method)
> at
>
org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:78)
> at
>
org.apache.jsp.htmls.jsps.backUp1_jsp._jspService(backUp1_jsp.java:287)
> at
>
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
> at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
> at
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
> at
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
> at
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
> at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
> at
>
sun.reflect.GeneratedMethodAccessor128.invoke(Unknown
> Source)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> java.lang.reflect.Method.invoke(Method.java:324)
> at
>
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
> at
> java.security.AccessController.doPrivileged(Native
> Method)
> at
>
javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
> at
>
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
> at
>
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
> at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
> at
>
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
> at
>
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
> at
> java.security.AccessController.doPrivileged(Native
> Method)
> at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> at
>
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)
> at
>
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:482)
> at
>
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:417)
> at
>
org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:80)
> at
>
org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:95)
> at
> java.security.AccessController.doPrivileged(Native
> Method)
> at
>
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313)
> at
>
com.stivant.esp.ruleengine.servlet.BackUpServlet1.doGet(Unknown
> Source)
> at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
> at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
> at
>
sun.reflect.GeneratedMethodAccessor128.invoke(Unknown
> Source)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> java.lang.reflect.Method.invoke(Method.java:324)
> at
>
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
> at
> java.security.AccessController.doPrivileged(Native
> Method)
> at
>
javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
> at
>
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
> at
>
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
> at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
> at
>
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
> at
>
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
> at
> java.security.AccessController.doPrivileged(Native
> Method)
> at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
> at
>
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
> at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
> at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
> at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
> at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
> at
>
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
> at
>
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
> at
>
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
> at
>
com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
> at
>
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
> |#]
>
>
> Here is my code
> XMLSerializer serial = new
> XMLSerializer(stringOut, new OutputFormat("xml",
> "UTF-8", true));
> serial.setOutputCharStream(new
> FileWriter(backupFileName));
>
> serial.serialize(doc.getDocumentElement());
>
>
> response.setContentType("application/xml");
>
> response.setHeader("Content-Disposition",
> "attachement; filename="+ backupFileName);
> File fileToDownload = new
> File(backupFileName);
> FileInputStream fileInputStream = new
> FileInputStream(fileToDownload);
> int i = 0;
> OutputStream os =
> response.getOutputStream();
> while ((i = fileInputStream.read()) !=
> -1) {
> os.write(i);
> }
> fileInputStream.close();
>
>
> }
>
> Can u guys tell me how to set the output format
> for the output stream??
>
> regards,
> Krish
>
>
>
> ---------------------------------
> Yahoo! India Answers: Share what you know. Learn
> something new Click here
> Send free SMS to your Friends on Mobile from your
> Yahoo! Messenger Download now
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|