• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Unknown Source

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When im going to save the file given target path its getting fails to load a file name and server thrown an NullPointerException as well
as java.io.FileInputStream.<init>(Unknown Source) it Exceptions. It unable to catch a File Name

My code is was written like this,



Server thrown an Excetopn to above bold line what is the reason to thrown such exception i really was not getting. If have any
proper solution on that.

Exception is;

Stored file to D:\Monitors\null
Jul 14, 2010 1:46:58 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.NullPointerException
at java.io.FileInputStream.<init>(Unknown Source)
at com.save.SaveFile.saveFile(SaveFile.java:29)
at com.kogent.action.FileActionUpload.uploadFile(FileActionUpload.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:399)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:262)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i have tried out your method with this program and working fine for me.


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error is a logic error, somewhere around


at com.save.SaveFile.saveFile(SaveFile.java:29)
at com.kogent.action.FileActionUpload.uploadFile(FileActionUpload.java:18)

but without knowing what's actually happening on and around those lines, it's impossible to help. Most likely something is null (like the exception says) that you believe isn't null.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!