[英]In portlets .jsp page I connect an applet, and after this it throws Exceptions
In portlet's .jsp page I connect an applet, and after this it throws Exception Portlet system is Liferay 在portlet的.jsp页面中,我连接了一个applet,然后抛出Exception Portlet系统就是Liferay
"'Name of portlet' is temporarily unavailable." “'portlet名称'暂时无法使用。” shows on the page.
显示在页面上。
html/jsp code for applet: applet的html / jsp代码:
<APPLET name="SignApplet" mayscript code="SignApplet.class"
archive="<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/lib/SignApplet.jar")%>,
<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/lib/crypto.tsp.jar")%>,
<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/lib/crypto.gammaprov.jar")%>"
height=500 width=500 style="display:none;">
<PARAM NAME="file" VALUE="<%
byte[] array = (byte[])session.getAttribute("downloadedFile");
out.print(new String(array));
%>" />
</APPLET>
jsp's name is LoadXLS. jsp的名字是LoadXLS。 Here is log:
这是日志:
ApplicationDispatcher[/ExecutePortlet] PWC1231: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at java.lang.String.<init>(String.java:602)
at org.apache.jsp.WEB_002dINF.jsp.LoadXLS_jsp._jspService(LoadXLS_jsp.java:232)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
...
04:18:44,421 ERROR [PortletRequestDispatcherImpl:137] org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.JasperException: java.lang.NullPointerException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)
...
04:18:44,421 ERROR [PortletServlet:97] javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.NullPointerException
javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.NullPointerException
at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:139)
at com.test.ExecutePortlet.doView(ExecutePortlet.java:249)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
...
ApplicationDispatcher[/ExecutePortlet] PWC1231: Servlet.service() for servlet ExecutePortlet Servlet threw exception
javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.NullPointerException
at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:139)
at com.test.ExecutePortlet.doView(ExecutePortlet.java:249)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
...
04:18:44,437 ERROR [render_portlet_jsp:154] java.lang.NullPointerException
at java.lang.String.<init>(String.java:602)
at org.apache.jsp.WEB_002dINF.jsp.LoadXLS_jsp._jspService(LoadXLS_jsp.java:232)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
...
From the stacktrace it seems you're using tomcat - a nice way to find the actual location of that NullpointerException in Tomcat is to go to the intermediary code that the JSP-Compiler generates, typically in tomcat's work folder - go to tomcat/work/Catalina/localhost/your-web-app-name/org/apache/jsp/... and locate the Java code generated from your JSP in there (from the stacktrace, it's named LoadXLS_jsp.java. ("Catalina/localhost" is the default folder - might be different in your setup) 从堆栈跟踪看来你似乎在使用tomcat - 在Tomcat中找到NullpointerException的实际位置的一个很好的方法是转到JSP-Compiler生成的中间代码,通常在tomcat的工作文件夹中 - 转到tomcat / work / Catalina / localhost / your-web-app-name / org / apache / jsp / ...并在那里找到从JSP生成的Java代码(来自stacktrace,它名为LoadXLS_jsp.java。(“Catalina / localhost”是默认文件夹 - 您的设置可能有所不同)
The stacktrace says, that the NullpointerException occurs in line 232 ( at org.apache.jsp.WEB_002dINF.jsp.LoadXLS_jsp._jspService(LoadXLS_jsp.java:232)
) - while the whole file is machine-generated and not well readable, it should be quite simple to map it back to the original JSP. 堆栈跟踪说,NullpointerException发生在第232行(
at org.apache.jsp.WEB_002dINF.jsp.LoadXLS_jsp._jspService(LoadXLS_jsp.java:232)
) - 虽然整个文件是机器生成的并且读取不好,但它应该是将它映射回原始JSP非常简单。
My bet is - as dragon66 says in the comment to your question - session.getAttribute("downloadedFile") is null, thus the constructor that you use in out.print(new String(array));
我的赌注是 - 正如dragon66在你的问题的评论中所说 - session.getAttribute(“downloadedFile”)为null,因此你在
out.print(new String(array));
使用的构造函数out.print(new String(array));
gets a null value passed. 获取传递的空值。 The line
at java.lang.String.<init>(String.java:602)
tells you that the String constructor is where the NullpointerException is caused, but the next line - eg the calling method - tells you where the string constructor is called. at java.lang.String.<init>(String.java:602)
告诉您String构造函数是导致NullpointerException的地方,但下一行 - 例如调用方法 - 告诉您字符串构造函数的调用位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.