具体情况:
我的本地环境是weblogic8和JDK1.4,项目启动,运行都没问题,现在是把这个项目放到一个服务器上,服务器的环境是weblogic11g,JDK1.6,(至于为啥会这样,别在意这些细节了)启动运行也没问题,但是当跳转到,调用FileY,这个类的页面时候,就会报下面的错
[ServletContext@3843485[app:sdywxt module:sdywxt path: spec-version:null]] Servlet failed with Exception java.lang.NullPointerException at
ywCommonBean.FileY.filenum(FileY.java:13) at
jsp_servlet._xtdl.__pdfjsp._jspService(__pdfjsp.java:135) at
weblogic.servlet.jsp.JspBase.service(JspBase.java:34) at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at
com.gotop.common.RightFilter.doFilter(RightFilter.java:56) at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748) at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714) at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283) at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182) at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491) at
weblogic.work.ExecuteThread.execute(ExecuteThread.java:263) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
以上是错误,
FileY这个类我试着在本地的一个JDK1.6的项目里运行了,没问题,所以我来求助,拜托各位给点意见,下面是FileY的代码:
package ywCommonBean;
import java.io.File;
public class FileY {
public static int filenum(String fileurl)
{
int result=0;
File file=new File(fileurl);
String files[];
files=file.list();
// System.out.println("files : "+files);
result = files.length;
// for(int i=0;i<files.length;i++)
// {
// System.out.println(files[i]);
// }
return result;
}
public static void main(String[] ages)
{
File file=new File("D:\\xx");
String files[];
files=file.list();
int num = files.length;
System.out.println("XX下文件夹个数:"+num);
for(int i=0;i<files.length;i++)
{
System.out.println(files[i]);
}
}
}