The problem is solved after a long thinking...The java code returns a workbook object (XSSFWorkbook), and I wanted to save it in a BAW variable with type ANY.
Unfortunately it do not work, and gives this error :(
tw.local.workbook = Packages.xxx.yyy.zzz.
workbookFromXlsxBase64(sss) - Not OK
When I save the workbook object in a simple JavaScript variable, the code works fine.
var workbook = Packages.xxx.yyy.zzz.
workbookFromXlsxBase64(sss) - OK
It seems that BAW has an internal symbol table and if we want to set a variable with an unregistered object (= not defined in BAW), we get this error.
It seems that ANY means any BAW type, not any object type.
Fortunately JavaScript do not makes such checking, so we can store our objects in a JavaScript variable.------------------------------
Laszlo
------------------------------
Original Message:
Sent: Tue September 07, 2021 09:21 AM
From: Atanu Roy
Subject: Java class X is not registered a supported class for the Symbol table error
Can you try exporting the JAR including (Package required libraries into generated JAR) the referenced library JARs ?
------------------------------
Atanu Roy
Solution Architect
Salient Process
Original Message:
Sent: Tue September 07, 2021 06:09 AM
From: Laszlo Kertesz
Subject: Java class X is not registered a supported class for the Symbol table error
Hi All,
I have a small Java utility in a jar file which impersonates excel workbooks based on excel names and xml data. It works fine as a Java application (in Eclipse for example), but when I try to use it in BAW, I get this error:
TeamworksException name='Process: 'Create Excel document' ProcessItem: 'B64 workbook' Type: 'ITEM'', message='Internal Script error: com.lombardisoftware.core.TeamWorksRuntimeException: Java Class org.apache.poi.xssf.usermodel.XSSFWorkbook is not registered as supported class for the SymbolTable'
I copied the following jar files int ot he lib/ext folder of BAW:
poi-3.11.jar
poi-ooxml-3.11.jar
poi-ooxml.schemas-3.11.jar
xmlbeans-3.1.0.jar
docx4j-3.1.0.jar
The code snippet where the exception is generated (this method return a workbook object by loading the Excel file as a BASE64-encoded string):
public static XSSFWorkbook workbookFromXlsxBase64(String xlsx) throws Throwable {
System.out.println("XlsGen workbookFromXlsxBase64 started");
XSSFWorkbook result = null;
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64.getDecoder().decode(xlsx));
result = new XSSFWorkbook(inputStream);
System.out.println("XlsGen workbookFromXlsxBase64 finished");
return result;
}
No idea, what the problem is, what is missing, or what the error is in fact :(
Any help appreciated,
Thx
------------------------------
Laszlo
------------------------------