Flux innately works with Glassfish (v2 of writing this), but issues are seen when trying to deploy for the first type or redeploy without restarting the domain. This guide intends to resolve the exception
java.lang.AbstractMethodError: org.apache.xerces.dom.DeferredDocumentImpl.setDocumentURI(Ljava/lang/String;)V
This error is due to a conflict between Flux's XML Parser, Xerces-J and the built in Glassfish XML Parser. To correct this issue we will need to edit the JVM to use Xerces by deafult and update Xerces to the latest version. Following the steps below will accomplish this.
- Add the JVM option
-java.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
There are three ways this can be accomplished. First you can edit your domain.xml file, which is located in the {root of domain director}/config. Add the line:
<jvm-options>-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl</jvm-options>
You can also add it via the command line using the asadmin command line utility. The comman would be similar to:
asadmin creat-jvm-options --user=admin --password=adminadmin --host=localhost --port=4848 -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFacotryImpl
And finally you can add it in the admin console by clicking Application Server -> JVM Settings -> JVM Options. From here clock Add and then fill out the text box that appears. Save and reboot and your domain will now have this options enabled.
- Download the newest version of Xerces-J (available at http://archive.apache.org/dist/xml/xerces-j/ ), unpack the file, and there should be a xercesImpl.jar file the newly created directory.
- You wil now need to edit you flux.war using the IDE, your choice, or the command line. Remove the xerces.jar file from WEB-INF/lib directory and replace the xercesImpl.jar file in the same directory with the newest build.
- Recompile the flux.war
You now have a fully hot-deployable flux.war for use in glassfish.
1. xerces.jar and xercesImpl.jar are available in the default (7.6) flux.war.
2. After following the steps listed above WEB-INF/lib should contain the latest version of xercesImpl.jar but not xerces.jar
I know that #1 is correct, but is #2 correct?
Thanks