• Excel File Import

    By Adrian Osterwalder 1 decade ago

    Export to Excel is very nice... but occasionally I don't have to write files but read. So I have created a custom control which reads the content of an excel file and give it's content back as an ArrayList. Works great for xls files and it also works for xlsx files if I run the XPage in the Notes Client. But if I try the same on the server, it doesn't work... So why I tell you that? For reading the file I accessed the Java classes of POI (which are provided by POI 4 XPages) directly. It seems that the Classloader can't see a few classes of the Java classes provided by the OSGi plugin.

    I get this error:
    java.lang.NoClassDefFoundError: org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller (initialization failure)

    Do you have an idea how I can fix this problem?

    Thanks in advance...

    • Please provide some CodeSnipped ...

      By Christian Güdemann 1 decade ago

      .. if possibe.

      This would help, that we can reproduce the issue and deliver a fixed version.

      Thanks

      Christian

      • Java Code Snippet

        By Adrian Osterwalder 1 decade ago

        Hi Christian

        This is a shortened java code snippet with which you can reproduce the issue.

        public static Workbook getWorkbook (String path) throws IOException, InvalidFormatException {
                File excelFile = new java.io.File(path);
                Workbook wb = WorkbookFactory.create(excelFile);
                return wb;           
        }

        If you use the create method of the WorkbookFactory with an .xlsx excel file, you will recieve this exception: "java.lang.NoClassDefFoundError: org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller (initialization failure)"

        Thanks Adrian

        • We need a short time

          By Christian Güdemann 1 decade ago

          Hello Adrian

          Thanks for your codesnipped. We will reproduce this and give you a feedback. I hope, that we can fix this.

          Its vacation season actualy, so we need some time for this.

          Best regards

          Christian

          • Any news?

            By Adrian Osterwalder 1 decade ago

            Hi Christian!

            Do you have any news regarding this issue?

            Thanks in advance, Adrian

            • AccessControl Issue

              By Christian Güdemann 1 decade ago

              Hello Adrian

              It seams to be a classical access controll Issue. Lena is currently working on a solution for this.

              I hope that we can solve this issue in short time. I let you know, if we have sometihing to test for you.

               

              Best Regards

              Christian

              • 1.2.3 should solve this

                By Christian Güdemann 1 decade ago

                Hello Adrian

                Please try your code with the 1.2.3 release of POI4XPages. We have also introduced the AbstractPOIPowerAction. How to us is explained in the example database.

                Best regards

                Christian