improve error logging diagnostics when inputstream == null
----------------------------------------------------------
Key: PLUTO-512
URL: https://issues.apache.org/jira/browse/PLUTO-512
Project: Pluto
Issue Type: Improvement
Components: descriptor
Affects Versions: 2.0.0
Reporter: Antony Stubbs
Priority: Minor
When portlet.xml cannot be found (input stream is null) the error message log
is not very helpful and is a bit cryptic "is cannot be null - verify
portlet.xml structure" or something of the sort.
The main head ache with this is that it doesn't show the cause exception on the
web page (IMO it should), but it does show the cause exception in the log.
After a bit of debugging, i traced it down, and my portlet,xml's structure was
fine, it just wasn't being deployed (m2eclipse doesn't think src/main/webapp
should be a source folder, so WTP wasn't copying the deployment descriptor to
the server). So I propose the following slight change:
in PortletDescriptorRegistry#createDefinition:
{code}
InputStream in = servletContext.getResourceAsStream(PORTLET_XML);
+ if (in == null)
+ {
+ throw new PortletContainerException("Cannot find " + PORTLET_XML +
+ ". Are you sure it is in the deployed package?");
+ }
{code}
Other wise you just get on the web page is the following:
{code}
Error rendering portlet.
java.lang.NullPointerException: Unable to load Portlet App Deployment
Descriptor:Error loading portlet.xml at context Welcome to Tomcat. Please
validate the file structure of this portlets portlet.xml file.
at
org.apache.pluto.internal.impl.PortletEntityImpl.load(PortletEntityImpl.java:203)
at
org.apache.pluto.internal.impl.PortletEntityImpl.getPortletDefinition(PortletEntityImpl.java:154)
at
org.apache.pluto.internal.impl.MimeResponseImpl.(MimeResponseImpl.java:116)
at
org.apache.pluto.internal.impl.RenderResponseImpl.(RenderResponseImpl.java:57)
at
org.apache.pluto.core.DefaultPortletEnvironmentService.createRenderResponse(DefaultPortletEnvironmentService.java:70)
at
org.apache.pluto.core.PortletContainerImpl.doRender(PortletContainerImpl.java:215)
at
org.apache.pluto.driver.tags.PortletTag.doStartTag(PortletTag.java:152)
at
org.apache.jsp.WEB_002dINF.themes.portlet_002dskin_jsp._jspx_meth_pluto_005fportlet_005f0(portlet_002dskin_jsp.java:105)
at
org.apache.jsp.WEB_002dINF.themes.portlet_002dskin_jsp._jspService(portlet_002dskin_jsp.java:79)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fforEach_005f1(pluto_002ddefault_002dtheme_jsp.java:527)
at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fotherwise_005f0(pluto_002ddefault_002dtheme_jsp.java:471)
at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fchoose_005f0(pluto_002ddefault_002dtheme_jsp.java:332)
at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspService(pluto_002ddefault_002dtheme_jsp.java:165)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at
org.apache.pluto.driver.PortalDriverServlet.doGet(PortalDriverServlet.java:197)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
{code}
and in the logs it adds:
{code}
Caused by: java.io.IOException: is parameter must not be null
at
org.apache.pluto.descriptors.services.jaxb.PortletAppDescriptorServiceImpl.read(PortletAppDescriptorServiceImpl.java:52)
at
org.apache.pluto.internal.PortletDescriptorRegistry.createDefinition(PortletDescriptorRegistry.java:159)
... 54 more
{code}
however the message is parameter must not be null is from jaxb and is
missleading because "is" is actually inputstream but it sort of implies (is how
i read it) that "is" is a parameter in your portlet.xml.
the addition I suggest changes all that to this:
{code}
SEVERE: Unable to load Portlet App Deployment Descriptor:Cannot find
/WEB-INF/portlet.xml. Are you sure it is in the deployed package?
org.apache.pluto.PortletContainerException: Cannot find /WEB-INF/portlet.xml.
Are you sure it is in the deployed package?
at
org.apache.pluto.internal.PortletDescriptorRegistry.createDefinition(PortletDescriptorRegistry.java:156)
at
org.apache.pluto.internal.PortletDescriptorRegistry.getPortletAppDD(PortletDescriptorRegistry.java:130)
{code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.