You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by oneworld99 <co...@gmail.com> on 2008/08/21 15:34:14 UTC

Apache FileUpload problem

Hi. I'm trying to use the Apache Commons FileUpload component
(http://commons.apache.org/fileupload). It works fine on my local PC (Java
1.5.0_15) but fails on the Unix server running Tomcat 4.1.29 and Java
1.4.2_12-b03. I've got the latest version of the upload component in the
WEB-INF/lib folder. It throws this error (included only the top section;
there are more, similar errors having to do with each fileupload component
call). Do I need an older version of the upload component to work with this
version of Tomcat and Java? If so, which version do I need to download? The
oldest I could find dated to 2003. Thanks.

The server encountered an internal error () that prevented it from
fulfilling this request.

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp

Generated servlet error:
[javac] Compiling 1 source file

/usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:12:
package org.apache.commons.fileupload does not exist
import org.apache.commons.fileupload.FileItem;

/usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:14:
package org.apache.commons.fileupload.servlet does not exist
import org.apache.commons.fileupload.servlet.ServletFileUpload;

/usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:15:
package org.apache.commons.fileupload.disk does not exist
import org.apache.commons.fileupload.disk.DiskFileItemFactory;

/usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:16:
package org.apache.commons.fileupload does not exist
import org.apache.commons.fileupload.FileUpload;

/usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
cannot resolve symbol
symbol : class DiskFileItemFactory
location: class org.apache.jsp.viewPremiums_jsp
DiskFileItemFactory factory = new DiskFileItemFactory();

An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp

Generated servlet error:
/usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
cannot resolve symbol
symbol : class DiskFileItemFactory
location: class org.apache.jsp.viewPremiums_jsp
DiskFileItemFactory factory = new DiskFileItemFactory(); 

[I accidentally posted this to the Sun JSP forum and was told this is the
better place for this question. Thanks.]
-- 
View this message in context: http://www.nabble.com/Apache-FileUpload-problem-tp19088887p19088887.html
Sent from the Commons - Issues mailing list archive at Nabble.com.


Re: Apache FileUpload problem

Posted by n3ur0 <ab...@yahoo.co.in>.
Thanks Mate, I had the same problem.
Reason was the same, Tomcat. 


oneworld99 wrote:
> 
> Thank you. After a half day of wrestling with it, I figured out what the
> problem was: The Tomcat server's been set up to expect the WEB-INF folder
> at the same level as the application -- that's why the server couldn't
> find the files. Don't ask me why it's that way but that's what it is.
> 
> Another issue: The time on the server was ahead by an hour so when I
> dropped my files on the server, they wouldn't get compiled because the
> server kept thinking it had the latest CLASS files cached. Ouch. Not until
> I manually deleted the auto-generated CLASS files would the JSPs get
> compiled. 
> 
> Finally got the upload working; one important thing that might help
> others: The filename when passed to the server from an input box includes
> the entire path (at least it did for me); you have to use substring and
> lastIndexOf to look for the last "\" and extract the filename from that
> part on. 
> 
> Now, I only have to get this upload working with Adobe Flex! 
> 
> 
> sebb-2-2 wrote:
>> 
>> On 21/08/2008, oneworld99 <co...@gmail.com> wrote:
>>>
>>>  Hi. I'm trying to use the Apache Commons FileUpload component
>>>  (http://commons.apache.org/fileupload). It works fine on my local PC
>>> (Java
>>>  1.5.0_15) but fails on the Unix server running Tomcat 4.1.29 and Java
>>>  1.4.2_12-b03. I've got the latest version of the upload component in
>>> the
>>>  WEB-INF/lib folder. It throws this error (included only the top
>>> section;
>>>  there are more, similar errors having to do with each fileupload
>>> component
>>>  call). Do I need an older version of the upload component to work with
>>> this
>>>  version of Tomcat and Java? If so, which version do I need to download?
>>> The
>>>  oldest I could find dated to 2003. Thanks.
>>>
>>>  The server encountered an internal error () that prevented it from
>>>  fulfilling this request.
>>>
>>>  org.apache.jasper.JasperException: Unable to compile class for JSP
>>>
>>>  An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp
>>>
>>>  Generated servlet error:
>>>  [javac] Compiling 1 source file
>>>
>>> 
>>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:12:
>>>  package org.apache.commons.fileupload does not exist
>>>  import org.apache.commons.fileupload.FileItem;
>>>
>> 
>> Check whether the fileupload jar contains the file
>> org/apache/commons/fileupload/FileItem.class.
>> 
>> If it does not, then you probably have the wrong jar.
>> If it does contain the file, then the problem is that Tomcat/Jasper
>> cannot find the jar file.
>> 
>>> 
>>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:14:
>>>  package org.apache.commons.fileupload.servlet does not exist
>>>  import org.apache.commons.fileupload.servlet.ServletFileUpload;
>>>
>>> 
>>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:15:
>>>  package org.apache.commons.fileupload.disk does not exist
>>>  import org.apache.commons.fileupload.disk.DiskFileItemFactory;
>>>
>>> 
>>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:16:
>>>  package org.apache.commons.fileupload does not exist
>>>  import org.apache.commons.fileupload.FileUpload;
>>>
>>> 
>>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
>>>  cannot resolve symbol
>>>  symbol : class DiskFileItemFactory
>>>  location: class org.apache.jsp.viewPremiums_jsp
>>>  DiskFileItemFactory factory = new DiskFileItemFactory();
>>>
>>>  An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp
>>>
>>>  Generated servlet error:
>>> 
>>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
>>>  cannot resolve symbol
>>>  symbol : class DiskFileItemFactory
>>>  location: class org.apache.jsp.viewPremiums_jsp
>>>  DiskFileItemFactory factory = new DiskFileItemFactory();
>>>
>>>  [I accidentally posted this to the Sun JSP forum and was told this is
>>> the
>>>  better place for this question. Thanks.]
>> 
>> Better yet might be the Tomcat user list.
>> 
>>>
>>> --
>>>  View this message in context:
>>> http://www.nabble.com/Apache-FileUpload-problem-tp19088887p19088887.html
>>>  Sent from the Commons - Issues mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Apache-FileUpload-problem-tp19088887p26331773.html
Sent from the Commons - Issues mailing list archive at Nabble.com.


Re: Apache FileUpload problem

Posted by oneworld99 <co...@gmail.com>.
Thank you. After a half day of wrestling with it, I figured out what the
problem was: The Tomcat server's been set up to expect the WEB-INF folder at
the same level as the application -- that's why the server couldn't find the
files. Don't ask me why it's that way but that's what it is.

Another issue: The time on the server was ahead by an hour so when I dropped
my files on the server, they wouldn't get compiled because the server kept
thinking it had the latest CLASS files cached. Ouch. Not until I manually
deleted the auto-generated CLASS files would the JSPs get compiled. 

Finally got the upload working; one important thing that might help others:
The filename when passed to the server from an input box includes the entire
path (at least it did for me); you have to use substring and lastIndexOf to
look for the last "\" and extract the filename from that part on. 

Now, I only have to get this upload working with Adobe Flex! 


sebb-2-2 wrote:
> 
> On 21/08/2008, oneworld99 <co...@gmail.com> wrote:
>>
>>  Hi. I'm trying to use the Apache Commons FileUpload component
>>  (http://commons.apache.org/fileupload). It works fine on my local PC
>> (Java
>>  1.5.0_15) but fails on the Unix server running Tomcat 4.1.29 and Java
>>  1.4.2_12-b03. I've got the latest version of the upload component in the
>>  WEB-INF/lib folder. It throws this error (included only the top section;
>>  there are more, similar errors having to do with each fileupload
>> component
>>  call). Do I need an older version of the upload component to work with
>> this
>>  version of Tomcat and Java? If so, which version do I need to download?
>> The
>>  oldest I could find dated to 2003. Thanks.
>>
>>  The server encountered an internal error () that prevented it from
>>  fulfilling this request.
>>
>>  org.apache.jasper.JasperException: Unable to compile class for JSP
>>
>>  An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp
>>
>>  Generated servlet error:
>>  [javac] Compiling 1 source file
>>
>> 
>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:12:
>>  package org.apache.commons.fileupload does not exist
>>  import org.apache.commons.fileupload.FileItem;
>>
> 
> Check whether the fileupload jar contains the file
> org/apache/commons/fileupload/FileItem.class.
> 
> If it does not, then you probably have the wrong jar.
> If it does contain the file, then the problem is that Tomcat/Jasper
> cannot find the jar file.
> 
>> 
>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:14:
>>  package org.apache.commons.fileupload.servlet does not exist
>>  import org.apache.commons.fileupload.servlet.ServletFileUpload;
>>
>> 
>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:15:
>>  package org.apache.commons.fileupload.disk does not exist
>>  import org.apache.commons.fileupload.disk.DiskFileItemFactory;
>>
>> 
>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:16:
>>  package org.apache.commons.fileupload does not exist
>>  import org.apache.commons.fileupload.FileUpload;
>>
>> 
>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
>>  cannot resolve symbol
>>  symbol : class DiskFileItemFactory
>>  location: class org.apache.jsp.viewPremiums_jsp
>>  DiskFileItemFactory factory = new DiskFileItemFactory();
>>
>>  An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp
>>
>>  Generated servlet error:
>> 
>> /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
>>  cannot resolve symbol
>>  symbol : class DiskFileItemFactory
>>  location: class org.apache.jsp.viewPremiums_jsp
>>  DiskFileItemFactory factory = new DiskFileItemFactory();
>>
>>  [I accidentally posted this to the Sun JSP forum and was told this is
>> the
>>  better place for this question. Thanks.]
> 
> Better yet might be the Tomcat user list.
> 
>>
>> --
>>  View this message in context:
>> http://www.nabble.com/Apache-FileUpload-problem-tp19088887p19088887.html
>>  Sent from the Commons - Issues mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Apache-FileUpload-problem-tp19088887p19099624.html
Sent from the Commons - Issues mailing list archive at Nabble.com.


Re: Apache FileUpload problem

Posted by sebb <se...@gmail.com>.
On 21/08/2008, oneworld99 <co...@gmail.com> wrote:
>
>  Hi. I'm trying to use the Apache Commons FileUpload component
>  (http://commons.apache.org/fileupload). It works fine on my local PC (Java
>  1.5.0_15) but fails on the Unix server running Tomcat 4.1.29 and Java
>  1.4.2_12-b03. I've got the latest version of the upload component in the
>  WEB-INF/lib folder. It throws this error (included only the top section;
>  there are more, similar errors having to do with each fileupload component
>  call). Do I need an older version of the upload component to work with this
>  version of Tomcat and Java? If so, which version do I need to download? The
>  oldest I could find dated to 2003. Thanks.
>
>  The server encountered an internal error () that prevented it from
>  fulfilling this request.
>
>  org.apache.jasper.JasperException: Unable to compile class for JSP
>
>  An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp
>
>  Generated servlet error:
>  [javac] Compiling 1 source file
>
>  /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:12:
>  package org.apache.commons.fileupload does not exist
>  import org.apache.commons.fileupload.FileItem;
>

Check whether the fileupload jar contains the file
org/apache/commons/fileupload/FileItem.class.

If it does not, then you probably have the wrong jar.
If it does contain the file, then the problem is that Tomcat/Jasper
cannot find the jar file.

>  /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:14:
>  package org.apache.commons.fileupload.servlet does not exist
>  import org.apache.commons.fileupload.servlet.ServletFileUpload;
>
>  /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:15:
>  package org.apache.commons.fileupload.disk does not exist
>  import org.apache.commons.fileupload.disk.DiskFileItemFactory;
>
>  /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:16:
>  package org.apache.commons.fileupload does not exist
>  import org.apache.commons.fileupload.FileUpload;
>
>  /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
>  cannot resolve symbol
>  symbol : class DiskFileItemFactory
>  location: class org.apache.jsp.viewPremiums_jsp
>  DiskFileItemFactory factory = new DiskFileItemFactory();
>
>  An error occurred at line: 15 in the jsp file: /fpauto/viewPremiums.jsp
>
>  Generated servlet error:
>  /usr/local/jakarta-tomcat-4.1.29/work/mywork/fpauto/viewPremiums_jsp.java:74:
>  cannot resolve symbol
>  symbol : class DiskFileItemFactory
>  location: class org.apache.jsp.viewPremiums_jsp
>  DiskFileItemFactory factory = new DiskFileItemFactory();
>
>  [I accidentally posted this to the Sun JSP forum and was told this is the
>  better place for this question. Thanks.]

Better yet might be the Tomcat user list.

>
> --
>  View this message in context: http://www.nabble.com/Apache-FileUpload-problem-tp19088887p19088887.html
>  Sent from the Commons - Issues mailing list archive at Nabble.com.
>
>