StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException
几天前我在这里问过同样的问题。克里斯为我指出了一些事情,但是在更改之后仍然出现错误,
还有什么我可以尝试的吗?
我已经上传了我的新代码。
我的第一个 JSP 页面加载正常,当我点击提交时出现错误。
“我不断收到这个警告,在一个非常简单的 JSP/Bean 页面上,我正在练习考试,但我无法通过这个。
有人能指出我的愚蠢吗?”
<html>
<head>
<title>JSP Page</title>
</head>
<h1>Enter Details!</h1>
<body>
<form action="Display.jsp" method="post">
<center>
Enter Name :<input type="text" name="Name"/><br/>
Etv :<input type="radio" name="Channel" value="Etv" /><br/>
Mnet :<input type="radio" name="Channel" value="Mnet" /><br/>
Mtv :<input type="radio" name="Channel" value="Mtv" /><br/>
FTV :<input type="radio" name="Channel" value="FTV" /><br/>
Blue :<input type="checkbox" name="Blue" value="1" /><br/>
Yellow :<input type="checkbox" name="Yellow" value="1" /><br/>
Green :<input type="checkbox" name="Green" value="1" /><br/>
Red :<input type="checkbox" name="Red" value="1" /><br/>
<br/>
<br/>
<input type="submit" value="Submit" />
</center>
</form>
</body>
</html>
我的Javabean:
package bean;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.beans.*;
import java.io.Serializable;
/**
*
* @author Ross
*/
public class NewBean implements Serializable {
private String name;
private String Channel;
private int Blue;
private int Yellow;
private int Green;
private int Red ;
public NewBean() {
}
public NewBean(String tName,String tChannel,int tBlue,int tYellow,int tGreen,int tRed) {
name=tName;
Channel=tChannel;
Blue=tBlue;
Yellow=tYellow;
Green=tGreen;
Red=tRed;
}
public String getName(){
return this.name;
}
public String getChannel(){
return this.Channel;
}
public int getBlue(){
return this.Blue;
}
public int getYellow(){
return this.Yellow;
}
public int getGreen(){
return this.Green;
}
public int getRed(){
return this.Red;
}
public void setName(String tName){
this.name = tName;
}
public void setChannel(String tChannel){
this.Channel = tChannel;
}
public void setBlue(int tBlue){
this.Blue = tBlue;
}
public void setYellow(int tYellow){
this.Yellow = tYellow;
}
public void setGreen(int tGreen){
this.Green = tGreen;
}
public void setRed(int tRed){
this.Red = tRed;
}
}
我的 JSP 显示 javabean:
<html>
<head>
<title>Display</title>
</head>
<body>
<h1>Result</h1>
<center>
<jsp:useBean id="NewBean"class="bean.NewBean">
<jsp:setProperty name="index" property="name" param="Name"/>
<jsp:setProperty name="index" property="Channel" param="Channel"/>
<jsp:setProperty name="index" property="Blue" param="Blue"/>
<jsp:setProperty name="index" property="Yellow" param="Yellow"/>
<jsp:setProperty name="index" property="Green" param="Green"/>
<jsp:setProperty name="index" property="Red" param="Red"/>
</jsp:useBean>
<b>Displayed.</b>
<jsp:getProperty name="index" property="Name"/>
<jsp:getProperty name="index" property="Channel"/>
<jsp:getProperty name="index" property="Blue"/>
<jsp:getProperty name="index" property="Yellow"/>
<jsp:getProperty name="index" property="Green"/>
<jsp:getProperty name="index" property="Red"/>
</center>
</body>
</html>
Glassfish 3 服务器输出
19 Nov 2012 9:51:05 AM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Felix platform
Welcome to Felix
================
INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
INFO: Starting Grizzly Framework 1.9.18-o - Mon Nov 19 09:51:10 CAT 2012
INFO: Starting Grizzly Framework 1.9.18-o - Mon Nov 19 09:51:10 CAT 2012
INFO: Grizzly Framework 1.9.18-o started in: 140ms listening on port 7676
INFO: Grizzly Framework 1.9.18-o started in: 210ms listening on port 8080
INFO: Grizzly Framework 1.9.18-o started in: 170ms listening on port 4848
INFO: Grizzly Framework 1.9.18-o started in: 160ms listening on port 3700
INFO: Grizzly Framework 1.9.18-o started in: 180ms listening on port 8181
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
INFO: SEC1002: Security Manager is OFF.
INFO: Security startup service called
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created.
INFO: Security service(s) started successfully....
INFO: Created HTTP listener http-listener-1 on port 8080
INFO: Created HTTP listener http-listener-2 on port 8181
INFO: Created HTTP listener admin-listener on port 4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Virtual server server loaded system default web module
INFO: Loading application InputAndDisplay at /InputAndDisplay
INFO: Loading InputAndDisplay Application done is 4951 ms
INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Felix(4501ms) startup services(6362ms) total(10863ms)
INFO: Binding RMI port to *:8686
INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://192.168.2.11:8686/jndi/rmi://192.168.2.11:8686/jmxrmi
INFO: Created HTTP listener http-listener-1 on port 8080
INFO: Grizzly Framework 1.9.18-o started in: 10ms listening on port 8080
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\domains\domain1\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\Ross\AppData\Local\Temp\fileinstall--1537292188207799339, felix.fileinstall.filter = null}
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\modules\autostart, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\Ross\AppData\Local\Temp\fileinstall--8697136160454616714, felix.fileinstall.filter = null}
INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
INFO: Created HTTP listener http-listener-2 on port 8181
INFO: Grizzly Framework 1.9.18-o started in: 0ms listening on port 8181
INFO: Updating configuration from org.apache.felix.fileinstall-autodeploy-bundles.cfg
INFO: Installed C:\glassfishv3\glassfish\modules\autostart\org.apache.felix.fileinstall-autodeploy-bundles.cfg
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\domains\domain1\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\Ross\AppData\Local\Temp\fileinstall--8665764141947736823, felix.fileinstall.filter = null}
WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:363)
at org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:349)
at org.apache.jsp.Display_jsp._jspService(Display_jsp.java from :63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:406)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:662)
INFO: Total number of available updates : 49
INFO: Number of available updates since Fri Nov 16 09:47:00 CAT 2012 : 0