Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > inputFileUpload error

Reply
Thread Tools

inputFileUpload error

 
 
canodabasioglu@gmail.com
Guest
Posts: n/a
 
      12-10-2006
I created FileUploadForm.java as a managed bean in my application which

I call
from my upload form copied from UploadForm.jsp - when I click the
'upload' button I get this error:

java.lang.NullPointerException at
com.odabasioglu.master.backbean.FileUploadForm.pro cessMyFile

Any help is greatly appreciated, thanks in advance...

Can ODABAŽIOŠLU




UploadForm.jsp******************
<h:form id="MyForm" enctype="multipart/form-data">
<x:inputFileUpload id="fileUpload" value="#{FileUploadForm.myFile}"
storage="file" required="true"/>
<h:commandButton value="Submit"
action="#{FileUploadForm.processMyFile}"/>
</h:form>


FileUploadForm.java***************
private UploadedFile myFile;
private String myParam;
private String myResult;


public UploadedFile getMyFile() {
return myFile;
}


public void setMyFile(UploadedFile myFile) {
this.myFile = myFile;
}
public String processMyFile() {


InputStream in = new
BufferedInputStream(file.getInputStream());
}
web.xml****************
<filter>
<filter-name>ExtensionsFilter</filter-name>
<filter-class>
org.apache.myfaces.component.html.util.ExtensionsF ilter
</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>10m</param-value>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
</filter>


<filter-mapping>
<filter-name>ExtensionsFilter</filter-name>
<servlet-name>FacesServlet</servlet-name>
</filter-mapping>

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      12-10-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I created FileUploadForm.java as a managed bean in my application which
>
> I call
> from my upload form copied from UploadForm.jsp - when I click the
> 'upload' button I get this error:
>
> java.lang.NullPointerException at
> com.odabasioglu.master.backbean.FileUploadForm.pro cessMyFile


In general, take a look at the line or method identified in the exception, and
see what possibly *could* be null, debug to find out if it actually is null at
the point of invocation, and suss out why it was never set non-null.

How many variables are there at the point identified? Which ones could be null?


> FileUploadForm.java***************


Slightly incomplete example.

> private UploadedFile myFile;
> private String myParam;
> private String myResult;
>
>
> public UploadedFile getMyFile() {
> return myFile;
> }
>
>
> public void setMyFile(UploadedFile myFile) {
> this.myFile = myFile;
> }
> public String processMyFile() {
>
>
> InputStream in = new
> BufferedInputStream(file.getInputStream());
> }


Where is the variable 'file' declared?
Where is it (supposed to be) set to a non-null value?

- Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
inputFileUpload error canodabasioglu@gmail.com Java 0 12-10-2006 12:05 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM



Advertisments