2 Replies Latest reply on Sep 21, 2012 11:07 AM by Bernd Sabathil

    JBoss EAP 5.1.0 classloading issues with Apache POI libraries

    Bernd Sabathil Newbie

      Hi guys,

       

      We are having an issue with Apache POI libraries in JBoss EAP 5.1.0 which do not seem to be loaded.

      However, this works on the one environment and on another environment, it does not.

       

      Following problem:

      Basically, we included libs:

      • poi-3.2-FINAL-20081019.jar
      • poi-contrib-3.2-FINAL-20081019.jar
      • poi-scratchpad-3.2-FINAL-20081019.jar

       

      into our product we are deploying onto JBoss as a war file into the server/default/deploy dir.

      The POI libs are included to load an Excel spreadsheet from the filesystem into the application using all the HSSF stuff and classes.

       

      Now the problem where we are currently left in the dark is the following:

      JBoss EAP is installed on my local machine for testing purposes the same way as at our customer. Everyhting works on my local env and on the customer env it does not.

       

      The only differences we could think of are:

      - the machines with OS themselves:

        --> local install is on Windows 7 Enterprise 64bit with JDK 1.6.0_27 64 bit

        --> customer install is a server machine with Windows Server 2008 64 bit and JDK 1.6.0_27 64 bit

       

      - user accounts logged in:

        --> local user has admin rights and domain rights

        --> server user at customer has local admin rights without domain rights

       

      - virtualization vs. physical

        --> local machine is physical install

        --> server machine at customer uses virtualization with VMWare

       

      But JBoss installation itself and settings are identical (unless we have overseen something but we double-checked it).

      When the exact same war file is deployed on both JBoss instances and it comes to Excel import from within the running application, the POI libs are there on my local env and import works but we get an exception on the server machine where libs did not seem to be loaded ( see extract below).

      When I delete the POI libs on my local and deploy the war file without them, I get this exact same error as you would expect.

       

      ================

      "org.apache.poi.hssf.usermodel.HSSFSheet" ist kein gültiger Typ. [line:4 col:36] in
      line 3: uses gw.transaction.Bundle
      line 4: uses org.apache.poi.hssf.usermodel.HSSFSheet
      line 5: uses java.io.FileInputStream
      Line Number: 4 Column: 36

      "org.apache.poi.hssf.usermodel.HSSFWorkbook" ist kein gültiger Typ. [line:6 col:36] in
      line 5: uses java.io.FileInputStream
      line 6: uses org.apache.poi.hssf.usermodel.HSSFWorkbook
      line 7: uses org.apache.poi.hssf.usermodel.HSSFRow
      Line Number: 6 Column: 36

      "org.apache.poi.hssf.usermodel.HSSFRow" ist kein gültiger Typ. [line:7 col:36] in
      line 6: uses org.apache.poi.hssf.usermodel.HSSFWorkbook
      line 7: uses org.apache.poi.hssf.usermodel.HSSFRow
      line 8: uses java.lang.Integer
      Line Number: 7 Column: 36

      "HSSFSheet" ist kein gültiger Typ. [line:21 col:17] in
      line 20:
      line 21: var sheet : HSSFSheet
      line 22: var myxls = new FileInputStream(fileLocation);
      Line Number: 21 Column: 17

      =============

       

      Now my question is:

      Can anyone think of anything that needs to be done here in terms of classloading or elsewhere?

      Could there be a reason why there might be a difference between the two setups?

      We could figure out that the POI libs are actually there in the server/default/tmp directory on both machines after startup, but just accessible from the local one.

       

      Thanks a lot in advance for any hints on this!

       

      Cheers,

      Bernd

        • 1. Re: JBoss EAP 5.1.0 classloading issues with Apache POI libraries
          jaikiran pai Master

          Bernd, welcome to the forums!

           

          Is that a JSP in which you are running into these import errors? If not, can you post a bit more details about what that component is and if there's anything more like the entire exception stacktrace?

          • 2. Re: JBoss EAP 5.1.0 classloading issues with Apache POI libraries
            Bernd Sabathil Newbie

            Jaikiran,

            thanks for the prompt reply.

             

            I attached the relevant part of the server.log with the full stacktrace and the JBoss boot.log.

            The application I am trying to do the upload with is a J2EE application where the UI is purely browser-based.

            The technology is proprietary and built into our product platform, however it is based on JSP on the UI side.

            Basically, I click on a browse button to select the Excel sheet with a file chooser dialog, the import is done from a Gosu class (you might not have heard of this - Gosu is an open source language initially specifically developed for our products --> see http://gosu-lang.org/). You can call any Java libs from Gosu and the code snippet for the import using the POI libs looks like below.

            As said, this is working on the local env and not on the server one.

             

            =================

            uses org.apache.poi.hssf.usermodel.HSSFSheet

            uses java.io.FileInputStream

            uses org.apache.poi.hssf.usermodel.HSSFWorkbook

            uses org.apache.poi.hssf.usermodel.HSSFRow

            uses java.lang.Integer

            uses java.text.SimpleDateFormat

            uses java.util.Date

             

            function importData(bundle : Bundle, fileLocation : String) {

               

                var sheet : HSSFSheet

                var myxls = new FileInputStream(fileLocation);

                var wb     = new HSSFWorkbook(myxls);

                sheet = wb.getSheetAt(0);

                var counter = 7

                var row : HSSFRow

                var dateParsingPattern = new SimpleDateFormat("dd.MM.yyyy")

               

                while(counter <= sheet.getLastRowNum()){

                  row =  sheet.getRow(counter)

                  if(row!=null && row.getCell(0)!=null){

                   

                    var val1 : String = row.getCell(0)!=null?row.getCell(0).getStringCellValue():null

             

            .....

             

            ================

             

            Best,

            Bernd