我是Primefaces的新手。我尝试用Primefaces创建示例页面。但我得到了以下错误。请帮我解决这个问题。
My Code is:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://primefaces.prime.com.tr/ui" prefix="p" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Hello World</title>
<p:resources/>
</head>
<body>
<h:form id="helloWorldPageForm">
<p:panel id="primefacesPanel" header="Hello World"
footer="Footer">
<h:outputText value="Primefaces is great. My first application using Primefaces"/>
</p:panel>
</h:form>
</body>
</html>
</f:view>
My Exception is:
SEVERE: Exception sending context initialized event to listener instance of class org.primefaces.optimus.listener.ContextListener
java.lang.NullPointerException
at org.primefaces.optimus.config.DefaultAnnotationScanner.scanWebInfClasses(DefaultAnnotationScanner.java:106)
at org.primefaces.optimus.config.DefaultAnnotationScanner.scan(DefaultAnnotationScanner.java:41)
at org.primefaces.optimus.config.OptimusBeanContext.initialize(OptimusBeanContext.java:42)
at org.primefaces.optimus.listener.ContextListener.initializeOptimusBeanContext(ContextListener.java:71)
at org.primefaces.optimus.listener.ContextListener.contextInitialized(ContextListener.java:52)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:521)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:849)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:351)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
您使用的是哪个版本的PrimeFaces ?您不能将JSP与PrimeFaces 2一起使用,它只适用于标准的JSF2 facelets视图。
;http://www.primefaces.org/gettingStarted.html