具體情況:
我的本地環境是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]);
}
}
}
不懸賞就沒人麼,這讓新人怎麼混,,,,,,,,,,