Strict servlet API: cannot call getWriter() after getOutputStream()

Hi,
Am getting below exception when i click on create report button.
It was successfully running in development machine, when we deploy the same application into the testing server.
what could be problem..
am using JSF 2.0, Primefaces 3.5, Jdeveloper and Weblogic 12 C server..
java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after getOutputStream()
  at weblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.java:299)
  at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:362)
  at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
  at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:155)

Issue resolved, because testing machine doesn't have specified font in font directory.
recompiled the jrxml file with arial font its working both the env machine..

Similar Messages

  • IllegalStateException: strict servlet API: cannot call getWriter()

    I am getting an exception in Weblogic when I am trying to display a pdf file in a web page.
    java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after getOutputStream()
    I am using the following code code
    ByteArrayOutputStream baos;
    ServletOutputStream out = response.getOutputStream();
    baos.writeTo(out);
    I have seen this error in so many discussion forum and there is no proper solution for this error.
    I am able to see the pdf page even with this exception. But I want to get rid of this exception also from Weblogic.

    I just did a quick (and dirty!) test with the following to display a jpg image and it worked for me without any trace of an exception:
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)  throws ServletException, IOException {
            response.setContentType("image/jpg");
            File f = new File("/Users/me/Desktop/IMG_0032.JPG");
            byte[] bits = new byte[(int) f.length()];
            FileInputStream fos = new FileInputStream(f);
            fos.read(bits);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            baos.write(bits, 0, bits.length);
            baos.writeTo(response.getOutputStream());
            baos.close();
            fos.close();
        }Note that there is no call anywhere to response.getWriter() in that.
    I'd guess the exception is directing you at what the problem is, at least as the server is seeing it -- somewhere in the execution of the request path there would appear to be call to response.getWriter() occurring after a call to response.getOutputStream() has been called, which is not permitted on WLS according to the error message.
    Do you use filters on this app? If response.getWriter() has been called on the same response object in a post request filter phase, that would be on the same call path with the same response object and would result in the exception.
    -steve-

  • Strict servlet API: cannot call getOutputStream() after getWriter()

    i have an applet which will communicate with a servet ,  but got following error in the servlet
    java.lang.IllegalStateException: strict servlet API: cannot call getOutputStream() after getWriter()
    at weblogic.servlet.internal.ServletResponseImpl.getOutputStream(ServletResponseImpl.java:280)
    at oracle.osl.lt.web.servlets.AudioServlet._processGetPlayList(AudioServlet.java:235)
    at oracle.osl.lt.web.servlets.AudioServlet.doPost(AudioServlet.java:91)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.wls.filter.SSOSessionSynchronizationFilter.doFilter(SSOSessionSynchronizationFilter.java:276)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101020 MACHINE = p1dvosl02 TXID = CONTEXTID = TIMESTAMP = 1318836952580
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 30000
    >
    *below _processGetPlayList() is called by doPost() of the servlet.*
    seems the exception is thrown due to response.getOutputStream()?
    any idea? thanks!!
    private void _processGetPlayList(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    try {
    ObjectOutputStream objectOut =
    new ObjectOutputStream(new BufferedOutputStream(response.getOutputStream()));
    try {
    RichDataDTOExt richData = _getRichData(request);
    if (richData == null) {
    Log.web().debug(s7);
    throw new ServletException(s7);
    objectOut.writeObject(richData.getAudioRecordings().getAll(new ContentRefDTO[0]));
    finally {
    objectOut.close();
    catch (IOException e) {
    Log.web().error(e.getMessage());
    throw new ServletException();
    }

    thanks for you reply. but seems we don't call getWriter() at all in our code.
    actually this error only happen in our customer's env, no this issue in our development env.
    besides using getOutputStream() and getWriter() simultaneously for same response, is this maybe related with some web server configuration?

  • IllegalStateException: strict servlet API:

    Hello All,
    I'm trying to do a simple rpc webservice. The wsgen process runs to a successful
    completion and I deploy the result to Weblogic 6.1 sp1, which is also successful.
    When accessing this new service, everything runs fine until the response is generated
    and I get following stack trace:
    <br>
    java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after
    getOutputStream() <br>
    at weblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.java:160)
    <br>
    at weblogic.soap.server.servlet.StatelessBeanAdapter.reportFault(StatelessBeanAdapter.java:238)
    <br>
    etc...
    It would appear that this is being generated in a Weblogic class. There is no
    mention of my EJB in the stack trace.
    Has anyone seen this error? Or, better yet, what causes it and what is the solution?
    Thanks,
    Kris

    Kris,
    I too have run into this problem with Weblogic 6.1. The first time I
    got this exception was when I had java.util.Date attributes within my
    serializable data object that I was returning from my WebService interface.
    When those date attributes were set with values, I would get the exception
    outlined below. Then I set those date values to null, and everything worked
    fine.
    Coincidentally, I'm currently have the same problem with a serializable
    object that has another serializable object defined as an attribute. I'm
    not wondering if Weblogic can't handle Serializable objects within other
    Serializable objects?
    I guess my suggestion would be to look at the values you are returning
    and passing in as parameters to your WebService interface, are there any
    Serializable objects that have other Serializable objects defined as
    attributes ( Strings don't count )? If so, set them to null and try your
    WebService again. ( Does that make sense?? )
    Hope this helps?
    Jeff
    "Kris W. Keener" <[email protected]> wrote in message
    news:3bd71794$[email protected]..
    >
    Hello All,
    I'm trying to do a simple rpc webservice. The wsgen process runs to asuccessful
    completion and I deploy the result to Weblogic 6.1 sp1, which is alsosuccessful.
    When accessing this new service, everything runs fine until the responseis generated
    and I get following stack trace:
    <br>
    java.lang.IllegalStateException: strict servlet API: cannot callgetWriter() after
    getOutputStream() <br>
    atweblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.
    java:160)
    <br>
    atweblogic.soap.server.servlet.StatelessBeanAdapter.reportFault(StatelessBeanA
    dapter.java:238)
    <br>
    etc...
    It would appear that this is being generated in a Weblogic class. There isno
    mention of my EJB in the stack trace.
    Has anyone seen this error? Or, better yet, what causes it and what is thesolution?
    >
    Thanks,
    Kris

  • I cannot call anyone after upgradiong my phone to iOs 7

    After i upgraded my iphone5 to iOs 7.0.2 i cant no longer call anyone in my contact list please help me, i have to make an important calls

    I have this issue to - my current work around is use the speaker phone, but this is a HUGE problem for privacy for me.

  • I FOUND : servlet-api.jar ...WHERE insert it to can compile SERVLETS

    I FOUND : servlet-api.jar in TOMCAT 6
    WHERE insert it to can compile SERVLETS ?
    where added(directory), some folders follow...?
    C:\Program Files\Java\jdk1.6.0_15\bin
    C:\Sun\AppServer\lib
    C:\Program Files\Java\jdk1.6.0_15\src\javax

    You can use any of the following methods:
    i) SET CLASSPATH variable with absolute path of your servlet-api.jar and then compile your servlet from any folder.
    ii)you can use
    C:\jdk\bin>javac -cp C:\tomcat\lib\servlet-api.jar SampleServlet.javaand after comilation put the compiled java class file to classes folder of you web application.
    [Obviously if you have any package, then you need to maintaing that folder structure inside classes folder]
    Here I assumed your javac is available at C:\jdk\bin folder and servlet-api.jar is available at C:\tomcat\lib folder
    ---Sujoy

  • Regarding Facetime on my Ipad. I get started on a call and after 10 or 15 minutes I cannot hear whom I am talking to. They can still hear me and I still have picture on the screen but my sound stops working.

    Regarding Facetime on my Ipad. I get started on a call and after 10 or 15 minutes I cannot hear whom I am talking to. They can still hear me and I still have picture on the screen but my sound stops working.

    Why can't we use Acrobat Pro for mobile devices? Save a whole lot of headaches!!! Now I have to return this subscription.

  • Facetime cannot call my contacts after upgrading to iOS 8

    My Son
    Is getting frustrated that he cannot call any of his friends on Facetime after upgrading to iOS 8.
    We have reset all his settings, gone through the 11 troubleshooting steps here:
    http://www.macworld.co.uk/how-to/iphone/11-fixes-for-when-facetime-is-not-workin g-3527872/
    Also we have restarted the device several times and updated to 8.0.2.
    Any suggestions on how we can fix this?
    Thanks,

    Can you receive FT calls?
    What exactly happens when you try to call someone with FT? Error message?
    Have you tried when connected to another network?

  • TS3367 I have two IPhones and one IPad all with the same Apple ID. I can call facetime between the two IPhones, but I cannot call the IPAD from either of the IPhones and when I call my IPhone from the IPad it rings my wife's IPhone after briefly calling m

    I have two IPhones and one IPad all with the same Apple ID. I can call facetime between the two IPhones, but I cannot call the IPAD from either of the IPhones and when I call my IPhone from the IPad it rings my wife's IPhone after briefly calling mine.

    Each device needs a separate address. Use an email address (gmail.com) on the iPad.
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    For non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
     Cheers, Tom

  • After I've upgraded my iPhone iOS to 5.0.1, I got problems with connectivity. If my iPhone lose network, then it gets frozzen and I cannot make calls. After restart the telephone still does not work.

    After I've upgraded my iPhone iOS to 5.0.1, I got problems with connectivity. If my iPhone lose network, then it gets frozzen and I cannot make calls. After restart the telephone still does not work.

    1. Download the iOS 5.0.1: http://www.tobias-hartmann.net/2011/11/download-ios-5-0-1-veroffentlicht-direkte -downloadlinks/
    2. open itunes,Click in iTunes while holding down the Shift key (on Windows) or Alt key (Mac) to restore and firmware

  • I dropped my iphone 5,1 week later suddenly my phone was restarted. After that I cannot call or receive messages. What should I do?

    I dropped my iphone 5,1 week later suddenly my phone was restarted. After that I cannot call or receive any messages. I followed all the steps that was sudgested but it is still not working. It cannot recognize my Sim card and when Sim card is in it, IMEI number doesn't shown in settings. I don't understand how it is not possible to repair it when I dropped from 1 meters and even I didn't broke the screen. So, what should I do dear Apple family?

    Hello dilara8,
    Welcome to the Apple Support Communities!
    I understand that you are seeing multiple issues with your iPhone after a drop. It sounds as though your device may need to be evaluated for service. For more information on this process, please refer to the attached link. 
    iPhone Repair and Service - Apple Support
    Best,
    Joe

  • Getting two errors when opening attachments after updating to latest version of Thunderbird. First one is exception "cannot call openModalWindw on a hidden win

    After the last Thunderbird update 24.4.0, attachments no longer open. Attempt to open attachment flashes a message quickly but not long enough to read. I get the following errors in the error log with every attempt to open a document like word.
    [Exception... "Cannot call openModalWindow on a hidden window" nresult: ox80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource://gre/components/nsPrompter.js::openModalWindow::line 382" data: no]
    resource://gre/components/nsPrompter.js
    The second error is
    TypeError: this._taskbar is null
    resource://gre/modules/DownloadTaskbarProgress.jsm
    Under tools I have Word docs set to open with Microsoft Word. What are these errors and why can't I no longer open Word documents?
    In addition I also receive multiple warnings at the same time such as Unknown property 'mso-style-type'. Declaration dropped.
    {mso-style-type:export-only;
    Expected '{' to begin declaration block but found 'WordSection1'.
    @page WordSection1
    DCar

    What happens when you save the attachment to disk and open it with Word?

  • TS3276 cannot receive mail after i sent a large photo.   A new folder appeared called "recovered messages" with the over 100 recovered emails of the same email of the one i sent out.  i have read apple support and done everything they suggest.  Help!

    I cannot receive mail after i sent a large photo.   A new folder appeared called "recovered messages" with the over 100 recovered emails of the same email of the one i sent out.  i have read apple support and done everything they suggest.  Help!

    How large is 'large'?

  • I dropped my iphone 5. After that I cannot call or receive messages. What should I do?

    I dropped my iphone 5,1 week later suddenly my phone was restarted. After that I cannot call or receive any messages. I followed all the steps that was sudgested but it is still not working. It cannot recognize my Sim card and when Sim card is in it, IMEI number doesn't shown in settings. I don't understand how it is not possible to repair it when I dropped from 1 meters and even I didn't broke the screen. So, what should I do dear Apple family?

    The phone is obviously damaged. Take it in to an Apple Store or authorized service provider for evaluation and possible replacement.

  • Problem with getWriter() and getOutputStream()

    Hi,
    I have written two methods. Name it as A(),B().
    In A() Method i am calling getWriter()
    In B() Method I am calling getOutputStream().
    But i got the IllegalStateException saying that,
    Cannot call getOutputStream() after getWriter().
    Both are required for me.
    I should not change the A() Method which is written by somebody and all are using the same i eman A().
    But i need getOutputStream() in My method i mean B().
    Please tell me how to avoid this problem.
    Thanks in Advance

    It sounds like you are working on a Servlet and trying to use the Response object. If so then you have fundamental problems because once response.getWriter() has been called one cannot then use response.getOutputStream(). The call to response.getWriter() wraps the OutputStream in a Writer that may buffer bytes.

Maybe you are looking for