Я получаю приведенную ниже ошибку при попытке загрузить файл в liferay
05:03:35,867 ERROR [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'][PortletRequestDispatcherImpl:115] org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
at org.springframework.web.servlet.ViewRendererServlet.processRequest(ViewRendererServlet.java:96)
at org.springframework.web.servlet.ViewRendererServlet.doGet(ViewRendererServlet.java:67)
Caused by: java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
at com.liferay.portlet.MimeResponseImpl.getWriter(MimeResponseImpl.java:90)
at com.liferay.portlet.PortletServletResponse.getWriter(PortletServletResponse.java:207)
at com.netcracker.portal.framework.spring.templates.view.SoyDataView.renderMergedOutputModel(SoyDataView.java:93)
и ниже код, я пытался искать в Интернете, но ни один из них не работал
String defaultFileName = "hello.pdf";
resourceResponse.setContentType("application/octet-stream");
resourceResponse.addProperty(GenericServiceTransport.CONTENT_DISPOSITION, "attachment; filename= hello.pdf" );
resourceResponse.flushBuffer();
try {
out = resourceResponse.getPortletOutputStream();
out.write(backendFile.getContent());
out.flush();
out.close();
} catch (IOException e) {
logger.error(e.getMessage());
}
return;