DVFactoryException

Post here questions and problems related to editing and publishing DITA content.
sanGeoff
Posts: 42
Joined: Mon Aug 18, 2014 11:50 pm

DVFactoryException

Post by sanGeoff »

Oxygen Author 16.0.0, Eclipse Kepler SP2, jdk1.7.0_67

I can't seem to get the oxygen SDK AuthorDocumentController.insertXMLFragment method to work.
Every time I try and call it I get the following exception. I have tried using the Maven included oxygen-xercesImpl-16.0.0.jar by default in the plugin project, and I have tried excluding it and only using the xercesImpl.jar in the the oxygen folder.

Code: Select all


Caused by: org.apache.xerces.impl.dv.DVFactoryException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
at org.apache.xerces.impl.dv.DTDDVFactory.getInstance(Unknown Source)
at org.apache.xerces.impl.dv.DTDDVFactory.getInstance(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.<init>(Unknown Source)
at org.apache.xerces.parsers.XIncludeAwareParserConfiguration.<init>(Unknown Source)
at ro.sync.xml.parser.t.<init>(Unknown Source)
at org.ditang.relaxng.defaults.RelaxDefaultsParserConfiguration.<init>(Unknown Source)
at org.ditang.relaxng.defaults.RelaxDefaultsParserConfiguration.<init>(Unknown Source)
at ro.sync.xml.parser.ParserCreator.newXmlParserConfiguration(Unknown Source)
at ro.sync.xml.parser.ParserCreator.newXmlParserConfiguration(Unknown Source)
at ro.sync.xml.parser.ParserCreator.newXmlParserConfiguration(Unknown Source)
at ro.sync.xml.parser.ParserCreator.d(Unknown Source)
at ro.sync.xml.parser.ParserCreator.newXRNoValid(Unknown Source)
at ro.sync.xml.parser.ParserCreator.newXRNoValid(Unknown Source)
at ro.sync.xml.XmlUtil.extractTextBeforeRoot(Unknown Source)
at ro.sync.ecss.dom.b.l.c(Unknown Source)
at ro.sync.ecss.e.w.f(Unknown Source)
at ro.sync.ecss.e.h.vb(Unknown Source)
at ro.sync.ecss.e.h.ce(Unknown Source)
... 55 more
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: DVFactoryException

Post by alex_jitianu »

Hello,

I understand that you have followed the instructions for the oXygen SDK to create a Maven based project based on the existing archetype. If that is true, then there should be no need to explicitly add a Xerces dependency in the POM. A dependency already exists in the a super POM. At a first glance, this exception appears to be a class loader issue introduced by the existence of multiple Xerces libraries in the classpath.

Why do you want to explicitly add a Xerces dependency? Anyway our Xerces dependency is added like this (to make sure you are excluding it right):

Code: Select all


<dependency>
<groupId>com.oxygenxml</groupId>
<artifactId>oxygen-xercesImpl</artifactId>
<version>16.0.0</version>
</dependency>
Best regards,
Alex
sanGeoff
Posts: 42
Joined: Mon Aug 18, 2014 11:50 pm

Re: DVFactoryException

Post by sanGeoff »

It's giving me the error with the default dependency, I just temporarily excluded it and used the one in the oxygen lib folder to see if it might be the issue or something. I noticed the xercesImpl.jar that's in the oxygen lib folder was slightly different than the one in the maven include (5/5/14 vs 5/27/14). But even compiling my project as a plugin jar and running it in oxygen Standalone still give me the error. About the only change i made to the maven project was to change the default java compiler complacence from (1.5 to 1.7).
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: DVFactoryException

Post by alex_jitianu »

Hello,

I still suspect this is a two Xerces libraries issue... You have a framework extension, right? Do you distribute a xerces.jar with it? Is this Xerces added in the framework Classpath? If the answer is yes, then you shouldn't do that. Oxygen already has a Xerces.

The exception arises when testing the framework inside an Oxygen installation, right? Can you send us the framework on our support email address (support@oxygenxml.com) to take a look at its configuration?

Best regards,
Alex
sanGeoff
Posts: 42
Joined: Mon Aug 18, 2014 11:50 pm

Re: DVFactoryException

Post by sanGeoff »

I don't have any framework extensions. I am just trying to create a standalone plugin, not a framework extension. I tried with an out of the box install of oxygen with no install changes and deleted the oxygen appdata settings folder. Same error with when trying to use the insertXMLFragment method in the code below in my plugin. Is it because the code is in a plugin and not framework?

Code: Select all


currentEditor.addEditorListener(new WSEditorListener() {
@Override
public boolean editorAboutToBeSavedVeto(int operationType) {
System.out.println("editorAboutToBeSavedVeto");
final WSAuthorEditorPage wae = (WSAuthorEditorPage) currentPage;
final WSEditorPage currentPage = currentEditor.getCurrentPage();
if(currentPage instanceof WSAuthorEditorPage) {
System.out.println("WSAuthorEditorPage");
try {
if(! SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
AuthorAccess AA = wae.getAuthorAccess();
int caretPosition = AA.getEditorAccess().getCaretOffset();
try {
AA.getDocumentController().insertXMLFragment("<draft-comment />", caretPosition);
} catch (AuthorOperationException e) {
e.printStackTrace();
}
}
});
}
} catch (Exception e) {}
}
return true;
}
sanGeoff
Posts: 42
Joined: Mon Aug 18, 2014 11:50 pm

Re: DVFactoryException

Post by sanGeoff »

Nevermind, figured it out. When setting up my plugin project I includes a third-party sdk jar that i eventually need. Turns out it has a copy of xerces buried inside its own jar (doh). Thanks again, I should have caught that sooner.
Post Reply