java.lang.NullPointerException是怎么回事
代码如下<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<%@ page language="java" contentType="text/html;charset=GBK"%>
<%@page import = "java.sql.*"%>
<html>
<head>
<title>hello,everyone</title>
</head>
<body>
<center>
<%
Connection con=null;
Statement sm=null;
ResultSet rs=null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://localhost/mydb1";
con=DriverManager.getConnection(url,"root","12345");
sm = con.createStatement();
rs=sm.executeQuery("select * from userinfo");
while(rs.next())
{
out.println("hello"+rs.getString("name")+"!<br>");
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(rs!=null)
{
try{rs.close();}catch(Exception e){e.printStackTrace();}
}
if(sm!=null)
{
try{sm.close();}catch(Exception e){e.printStackTrace();}
}
if(con!=null)
{
try{con.close();}catch(Exception e){e.printStackTrace();}
}
}
%>
</center>
</body>
</html>
一保存文件eclipse就提示J2EE Plugin internal error
详细情况是
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.batch.FileSystem.initializeKnownFileNames(FileSystem.java:111)
at org.eclipse.jdt.internal.compiler.batch.FileSystem.<init>(FileSystem.java:71)
at org.eclipse.jdt.internal.compiler.batch.FileSystem.<init>(FileSystem.java:49)
at com.objectlearn.jdt.j2ee.core.jasper.JasperNameEnvironment.jasperizedClasspath(JasperNameEnvironment.java:127)
at com.objectlearn.jdt.j2ee.core.WebModule.internalParseJSP(WebModule.java:232)
at com.objectlearn.jdt.j2ee.core.WebModule.forceParseJSP(WebModule.java:218)
at com.objectlearn.jdt.j2ee.core.WebModule.parseJSP(WebModule.java:197)
at com.objectlearn.jdt.j2ee.core.WebModule.internalCompileJsp(WebModule.java:78)
at com.objectlearn.jdt.j2ee.core.WebModule.compileJsp(WebModule.java:66)
at com.objectlearn.jdt.j2ee.core.WebModule.incrementalBuildFor(WebModule.java:291)
at com.objectlearn.jdt.j2ee.core.WebModule.incrementalBuildFor(WebModule.java:272)
at com.objectlearn.jdt.j2ee.core.Project.incrementalBuildFor(Project.java:609)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener.doIncrementalBuildFor(ResourceChangedListener.java:178)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener.access$0(ResourceChangedListener.java:171)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener$1.visit(ResourceChangedListener.java:155)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:68)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:49)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener.deltaTree(ResourceChangedListener.java:152)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener.deltaTree(ResourceChangedListener.java:167)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener.deltaTree(ResourceChangedListener.java:167)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener.deltaTree(ResourceChangedListener.java:167)
at com.objectlearn.jdt.j2ee.core.ResourceChangedListener.resourceChanged(ResourceChangedListener.java:92)
at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:276)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run(Platform.java:783)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:270)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:144)
at org.eclipse.core.internal.resources.Workspace.broadcastBuildEvent(Workspace.java:185)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:200)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
怎么回事呀