WebSphere Application Server & Liberty

 View Only
Expand all | Collapse all

javax.portlet.PortletException: java.lang.IllegalStateException: No content type set

  • 1.  javax.portlet.PortletException: java.lang.IllegalStateException: No content type set

    Posted Sun September 26, 2021 04:19 PM
    Hi all,
    I've deployed a portlet on WPS as a war, so I've tried to install it on a page; The portlet is very very easy just print Hello World; But unfortunately on the screen i read "The content is not available", while looking at the log:

    [26/09/21 21.41.37:119 CEST] 00000122 MimeResponseI E com.ibm.ws.portletcontainer.core.impl.MimeResponseImpl getWriter EJPPC0176W: Tipo di contenuto non valido
    [26/09/21 21.41.37:154 CEST] 00000122 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service CWSRV0014E: Uncaught service() exception root cause HelloWorldPortlet: javax.servlet.ServletException: javax.portlet.PortletException: java.lang.IllegalStateException: No content type set.
    at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.doDispatch(PortletServlet.java:369)


    I cannot figure out what's wrong...... any guess will be very appreciated;

    The portlet.xml:




    the web.xml
    And the java class:



    the structure:




    What can I have to do to discover where is the error?

    thanks so much



    ------------------------------
    francesco Viscomi
    ------------------------------


  • 2.  RE: javax.portlet.PortletException: java.lang.IllegalStateException: No content type set

    Posted Mon September 27, 2021 05:46 AM

    It looks like the problem may be on your RenderResponse.  You will need to call the setContentType("text/html") as well as the your text.

    Saluti/Regards



    ------------------------------
    Brian S Paskin
    Sr. WebSphere, Liberty and MQ Architecture
    Cloud Automation
    IBM Expert Labs
    ------------------------------



  • 3.  RE: javax.portlet.PortletException: java.lang.IllegalStateException: No content type set

    Posted Mon September 27, 2021 07:54 AM
    Thanks really a lot; Now it works;

    ------------------------------
    francesco Viscomi
    ------------------------------