Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:40:00+00:00 2026-06-13T16:40:00+00:00

Scenario: I am trying to read an excel file using JExcel and dump the

  • 0

Scenario: I am trying to read an excel file using JExcel and dump the data into Oracle database. I ask the user to browse and select a file to read from their system and then I read the same and dump the data (without saving the physical file) into the Oracle database.

<form id='uploadform'>
    <table class='detailTable'>
    <tr>
        <td class='detailTableTD'>Select File to Upload:</td>
        <td class='detailTableTD'>
            <input type='file' id='fileUpload'>
        </td>
    </tr>
    <tr>
        <td class='detailTableTD'></td>
        <td class='detailTableTD'>
            <button id='uploadBtn' onclick="upload();">Upload</button>
            <button id='backBtn'>Back</button>                                  
        </td>
    </tr>
    </table>
</form>

Java:

public int[][] readFromExcel(final String excelFilePath) throws ApplicationException {
    String excelPath = excelFilePath.trim();
    File inputWorkbook = new File(excelPath);
    Workbook workbook;
    MyObj drawBk;
    List drBkLst = new ArrayList();
    String tmpStr = "";
    try {
        workbook = Workbook.getWorkbook(inputWorkbook);
        Sheet sheet = workbook.getSheet(0);
        for (int j = 1; j < sheet.getRows(); j++) {
            drawBk = new MyObj();
            for (int i = 0; i < sheet.getColumns(); i++) {
                Cell cell = sheet.getCell(i, j);
                switch (i) {
                case 0:
                    drawBk.setSerialNumber(cell.getContents());
                    break;
                case 1:
                    drawBk.setMediaNumber(cell.getContents());
                    break;
                case 2:
                    tmpStr = cell.getContents();
                    if (!(tmpStr.trim().equalsIgnoreCase("Y") || tmpStr.trim().equalsIgnoreCase("N")))
                        continue;
                    else
                        drawBk.setMnProcessInd(tmpStr);
                    drawBk.setSnProcessInd(tmpStr);
                    break;
                }
            }
            drawBk.setLastChangedUser(userId);
            drBkLst.add(drawBk);
        }
    } catch (Exception readExcelEx) {}
return insertExcelDataToDatabase(drBkLst);
}

Here I capture the path and pass as a parameter to a Java method for processing the cells and create a ArrayList of Objects to be inserted into DB. All simple code here.
It all works fine when run from a local deployment but when I deploy the EAR to server I start getting FileNotFound Exception when I browse for a file and select a file.
I feel its all due to some relative/absolute path issue but can’t possibly debug and I need it fast. Any precise help help will be appreciated?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:40:01+00:00Added an answer on June 13, 2026 at 4:40 pm

    You will have to write the file on some temp directory on your server. You can not use your system file path from server (ear).

    You will have to change your form to multipart and handle the request. Check out this link (http://www.servletworld.com/servlet-tutorials/servlet-file-upload-example.html).

    You can avoid writing the file to temp as well (it will be written in tmp by java anyways, but you won’t have to provide the path). use

    FileInputStream fis = new FileInputStream(new File()); //after reading it using file io.
    Workbook workbook = WorkbookFactory.create(fis);  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read floating point numbers from a file into a dynamically
I'm trying to implement this scenario using Unity and i can't figure out how
Im trying to implement a scenario using threads to execute concurrent commands on a
I have a scenario where I am trying to login a user to my
I am trying to load a .xls file into a webbrowser control in my
My scenario: Trying to automate Calculator using Sikuli(Java). I need to get the result
Hi there I have been trying to read an xml file with UTF strings,
In VB.NET or C#, I'm trying to read the contents of a text file
I am trying to merge several data.frames into one data.frame . Since I have
I'm trying to read a file in python (scan it lines and look for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.