I am trying to use Apache POI and have successfully made a module. When I tried using some of the classes I received a java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException error message. I then made a module for Apache’s XMLBeans, but now when I try launching the designer I receive a message about a duplicate class. Can someone please help me with how to get either POI to work without XMLBeans or how to get XMLBeans in the gateway without conflicting with the existing classes?
thanks. I removed the duplicate line, created a new modl file and installed it on the gateway, but it still gives the same error when launching the designer. it looks weird when it first starts up because it says “Package 1/1, download retry#2” right before the error.
I actually think this is a problem in the build of apache. Try simply extracting the jars and re-zipping them and changing the name to *.jar.
Zip files can contain multiple entries at the same path. File systems cannot, so by extracting to a filesystem and re-zipping you can remove duplicate entries.
I do not think the issue is that it is conflicting with a class that is already in Ignition as might seem intuitive.
There we go. you got it. now that you say that when i have extracted the jar i would get a message that some of the files already exist. I would just click yes to all, but now that you said something i looked at the filenames and the first file name was the location.class just like in the picture of the error message. looks like all the files that conflicted had the same modify date and size. so there should be any problem doing this?
I have follow up question now that I have it all working. To get POI working it took three java APIs POI, XMLBeans, and dom4j. would it be best practices to put all the jars in one module or create three separate modules?
Definitely one module. Each module is loaded under its own ClassLoader; one module can’t see/use JAR files loaded by another module, unless it depends on that module, but you only get one module dependency.
Since I am only including the jars to make the libraries available to me for scripting and I am not doing anything in the module that is dependent on one of the jars is your response still true?
This is purely what if, but what if I make my POI module with all the jars which includes XMLBeans and then another module is made that does something other than POI, but it also include the XMLBeans jar? would there be a conflict? would one the XMLBean jars override the other? what if one of the XMLBean jars is a different version than the other?
I am just trying to get a good understanding of this works. thanks for the help.
This actually could cause a conflict in the Designer and the Client, where the classloading is shared, but not in the Gateway, where the classloading is more segregated.