当我在 jsf 页面中运行小程序时(我正在使用 myfaces 和 trinidad 组件),日志在小程序加载时向我显示:
SEVERE: Servlet.service() for servlet faces threw exception
java.lang.NullPointerException
at org.apache.myfaces.trinidadinternal.ui.RootRenderingContext.getRendererManager(RootRenderingContext.java:193)
at org.apache.myfaces.trinidadinternal.uinode.UIXComponentUINode.getRenderer(UIXComponentUINode.java:379)
at org.apache.myfaces.trinidadinternal.uinode.UIXComponentUINode.renderInternal(UIXComponentUINode.java:166)
at org.apache.myfaces.trinidadinternal.uinode.UINodeRendererBase.encodeEnd(UINodeRendererBase.java:70)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:913)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:672)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:606)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:623)
at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:70)
at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:154)
at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:153)
at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:81)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:493)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:913)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:672)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at org.apache.myfaces.shared_impl.view.JspViewDeclarationLanguageBase.actuallyRenderView(JspViewDeclarationLanguageBase.java:355)
at org.apache.myfaces.shared_impl.view.JspViewDeclarationLanguageBase.renderView(JspViewDeclarationLanguageBase.java:194)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:165)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)
at org.apache.catalina.connector.CoyoteAdapter.service(Unknown Source)
at org.apache.coyote.http11.Http11Processor.process(Unknown Source)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Unknown Source)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
小程序运行正常,但是为什么会出现这个异常呢?
我使用此代码启动小程序(我还使用 f:verbatin 代替 tr:output 和转义)
<%@page contentType="text/html"%>
<%@page pageEncoding="ISO-8859-15" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
<%@taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<f:loadBundle basename="es.atc.planem.resources.general" var="general"/>
<c:import url="/contents/head.jsp"/>
<trh:body id="body">
<tr:form id="general">
<tr:panelPage>
<tr:panelGroupLayout layout="vertical">
<tr:outputText escape="false" value="<applet mayscript code=\"org.jdesktop.applet.util.JNLPAppletLauncher\"
codebase=\"#{general['visor.ruta']}\"
width=#{general['visor.width']}
height=#{general['visor.height']}
archive=\"jars/applet-launcher.jar,jars/jogl.jar,
jars/gluegen-rt.jar,
jars/swing-worker-1.1.jar,
jars/swingx-beaninfo-1.6.2.jar,
jars/swingx-core-1.6.2.jar,
jars/appframework-1.0.3.jar,
jars/mail.jar,
jars/postgis-2.0.0SVN.jar,
jars/postgis_pljava.jar,
jars/postgresql-9.0-801.jdbc4.jar,
jars/xSocket-2.8.15.jar,
jars/worldwind.jar,
jars/Plan-EM_Applet.jar\">
<param name=\"jnlp_href\" value=\"visor.jnlp\">
<param name=\"subapplet.classname\" value=\"WWJApplet\">
<param name=\"subapplet.displayname\" value=\"WWJ Applet\">
<param name=\"noddraw.check\" value=\"true\">
<param name=\"progressbar\" value=\"true\">
<param name=\"progressbar\" value=\"true\">
<param name=\"jnlpNumExtensions\" value=\"1\">
<param name=\"jnlpExtension1\"
value=\"#{general['visor.ruta']}/jogl.jnlp\"></applet>" id="_applet"/>
<tr:spacer height="10px"/>
<tr:commandButton id="btnCancelar" actionListener="#{bBean.cerrarVisor}"
styleClass="small"
text="#{general['boton.texto.cerrar']}"/>
</tr:panelGroupLayout>
</tr:panelPage>
</tr:form>
</trh:body>
</f:view>
谢谢!