I am getting following compiler error while trying to run below jsp in weblogic8.1 to upload multiple files to server. Code is working fine under Apache
Tomcat environment, so theres no problem in code.
Problem is that, code is not able to find commons-upload.jar file containing org.apache.commons.fileupload package. I have added jar file to system classpath and path varibles.
could anyone please help.
Thanks in advance.
Error is like...-----------------------------------------------------
Compilation of 'C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java' failed:
--------------------------------------------------------------------------------
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:167: cannot resolve symbol
probably occurred due to an error in /webclient/controls/imageupload/JSP/uploadProcessor.jsp line 24:
if (FileUpload.isMultipartContent(request))
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:170: cannot resolve symbol
probably occurred due to an error in /webclient/controls/imageupload/JSP/uploadProcessor.jsp line 27:
DiskFileUpload diskFileUpload = new DiskFileUpload();
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:170: cannot resolve symbol
probably occurred due to an error in /webclient/controls/imageupload/JSP/uploadProcessor.jsp line 27:
DiskFileUpload diskFileUpload = new DiskFileUpload();
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:174: cannot resolve symbol
probably occurred due to an error in /webclient/controls/imageupload/JSP/uploadProcessor.jsp line 31:
FileItem fileItem = null;
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:183: cannot resolve symbol
probably occurred due to an error in /webclient/controls/imageupload/JSP/uploadProcessor.jsp line 40:
FileItem fileItemTemp = (FileItem)it.next();
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:183: cannot resolve symbol
probably occurred due to an error in /webclient/controls/imageupload/JSP/uploadProcessor.jsp line 40:
FileItem fileItemTemp = (FileItem)it.next();
--------------------------------------------------------------------------------
Full compiler error(s):
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:167: cannot resolve symbol
symbol : variable FileUpload
location: class jsp_servlet._webclient._controls._imageupload._jsp.__uploadprocessor
if (FileUpload.isMultipartContent(request)) //[ /webclient/controls/imageupload/JSP/uploadProcessor.jsp; Line: 24]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:170: cannot resolve symbol
symbol : class DiskFileUpload
location: class jsp_servlet._webclient._controls._imageupload._jsp.__uploadprocessor
DiskFileUpload diskFileUpload = new DiskFileUpload(); //[ /webclient/controls/imageupload/JSP/uploadProcessor.jsp; Line: 27]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:170: cannot resolve symbol
symbol : class DiskFileUpload
location: class jsp_servlet._webclient._controls._imageupload._jsp.__uploadprocessor
DiskFileUpload diskFileUpload = new DiskFileUpload(); //[ /webclient/controls/imageupload/JSP/uploadProcessor.jsp; Line: 27]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:174: cannot resolve symbol
symbol : class FileItem
location: class jsp_servlet._webclient._controls._imageupload._jsp.__uploadprocessor
FileItem fileItem = null; //[ /webclient/controls/imageupload/JSP/uploadProcessor.jsp; Line: 31]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:183: cannot resolve symbol
symbol : class FileItem
location: class jsp_servlet._webclient._controls._imageupload._jsp.__uploadprocessor
FileItem fileItemTemp = (FileItem)it.next(); //[ /webclient/controls/imageupload/JSP/uploadProcessor.jsp; Line: 40]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_maximo_maximo\jsp_servlet\_webclient\_controls\_imageupload\_jsp\__uploadprocessor.java:183: cannot resolve symbol
symbol : class FileItem
location: class jsp_servlet._webclient._controls._imageupload._jsp.__uploadprocessor
FileItem fileItemTemp = (FileItem)it.next(); //[ /webclient/controls/imageupload/JSP/uploadProcessor.jsp; Line: 40]
^
6 errors
---------------------------------------------------------------
Code is as below : uploadProcessor.jsp
---------------------------------------------------------------
< !-- uploadProcessor.jsp -->
<%@ page import="org.apache.commons.fileupload.*, java.util.*, java.io.*, java.lang.Exception" %>
.....some html code....
if (FileUpload.isMultipartContent(request))
{
System.out.println("UploadProcessor.jsp : In FileUpload.isMultipartContent...");
DiskFileUpload diskFileUpload = new DiskFileUpload();
List fileItemsList = diskFileUpload.parseRequest(request);
String optionalFileName = "";
FileItem fileItem = null;
File saveTo;
Iterator it = fileItemsList.iterator();
while (it.hasNext())
{
out.println("Hello");
FileItem fileItemTemp = (FileItem)it.next();
if (fileItemTemp.isFormField())
{
%>
Field name: <%= fileItemTemp.getFieldName() %>
Field value: <%= fileItemTemp.getString() %>
<%<br /> }<br /> else <br /> {<br /> <br /> fileItem = fileItemTemp;<br /> } //end if <br /> <br /> if (fileItem!=null)<br /> {<br /> //fileItem.setFieldName("kuldeep");<br /> String fileName = fileItem.getName();<br /> %>
Uploaded File Info: Content type: <%= fileItem.getContentType() %>
Field name: <%= fileItem.getFieldName() %>
File name: <%= fileName %>
File size: <%= fileItem.getSize() %>
< !-- -->
<%<br /> /* Save the uploaded file if its size is greater than 0. */<br /> if (fileItem.getSize() > 0)
{
if (optionalFileName.trim().equals(""))
fileName = (new File(fileName)).getName();
/*else
fileName = optionalFileName; */
String extn=fileName.substring(fileName.indexOf("."));
////out.println(extn);
String dirName ="c:\\DOCLINKS\\CustomMaps\\";
try
{
//// saveTo = new File(dirName+cuser.trim()+".doc");
////saveTo = new File(dirName+"yog"+extn);
saveTo = new File(dirName+fileName);
fileItem.write(saveTo);
byte[] data = fileItem.get();
%>
Data Received at the Server
The uploaded file has been saved successfully.
<% }<br /> catch (Exception e)<br /> {<br /> %>An error occurred..
<%<br /> }<br /> }// if > 0
} // IF not null
} // while loop
} //If
%>
...some HTML code....
---------------------------------------------------------------------