当前位置: 代码迷 >> J2EE >> struts2 上传时报错,求教原因?该如何处理
  详细解决方案

struts2 上传时报错,求教原因?该如何处理

热度:56   发布时间:2016-04-22 02:03:55.0
struts2 上传时报错,求教原因?
Java code
java.lang.NullPointerException    java.io.File.<init>(File.java:262)    com.yiyi.action.UploadAction.upload(UploadAction.java:32)    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)    java.lang.reflect.Method.invoke(Method.java:597)    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:314)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.


------解决方案--------------------
Java code
    private File picture;    @SuppressWarnings("unused")    private String pictureContentType;    private String pictureFileName;
  相关解决方案