Technical Support Forum Index
Technical Support Forum
Access ChemAxon scientists and developers here. For registration and login issues contact website support.

Support Ticket System is replacing forum

This forum was converted into a searchable archive. You cannot add posts here any more. For support please use our new Ticket System.

Create your first ticket
ECFPParameters problem: org.xml.sax.SAXException
To watch this topic for replies  Register (enables digests) or give email address:
This topic is locked: you cannot edit posts or make replies.
Display posts from previous:   
    View previous topic :: View next topic    
Author Message
David

Joined: 15 Nov 2011
Posts: 23

View user's profile

Back to top
Link to postPosted: Wed Jul 16, 2014 7:42 pmPost subject: ECFPParameters problem: org.xml.sax.SAXException Reply with quote

Hi

I'm trying to use fingerprints (ECFP) but when I try to create a configuration file I get an exception.  (Mac OS X).  Here is the code:

ECFPParameters ecfpParameters = new ECFPParameters(new File("/Applications/ChemAxon/JChem/examples/config/ecfp.xml"))

Here is the exception:

Warning: Caught exception attempting to use SAX to load a SAX XMLReader 

Warning: Exception was: org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set?

Warning: I will print the stack trace then carry on using the default SAX parser

org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set?

at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83)

at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)

at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)

at org.dom4j.io.SAXReader.read(SAXReader.java:435)

at org.dom4j.io.SAXReader.read(SAXReader.java:264)

at chemaxon.descriptors.MDParameters.readFromXmlFile(MDParameters.java:885)

at chemaxon.descriptors.ECFPParameters.<init>(ECFPParameters.java:137)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)

at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)

at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)

at generateFingerprints.run(generateFingerprints.groovy:27)

at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:258)

at groovy.lang.GroovyShell.run(GroovyShell.java:502)

at groovy.lang.GroovyShell.run(GroovyShell.java:491)

at groovy.ui.GroovyMain.processOnce(GroovyMain.java:650)

at groovy.ui.GroovyMain.run(GroovyMain.java:381)

at groovy.ui.GroovyMain.process(GroovyMain.java:367)

at groovy.ui.GroovyMain.processArgs(GroovyMain.java:126)

at groovy.ui.GroovyMain.main(GroovyMain.java:106)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)

at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Caught: chemaxon.descriptors.MDParametersException: Bad XML config file.

chemaxon.descriptors.MDParametersException: Bad XML config file.

at chemaxon.descriptors.MDParameters.readFromXmlFile(MDParameters.java:896)

at chemaxon.descriptors.ECFPParameters.<init>(ECFPParameters.java:137)

at generateFingerprints.run(generateFingerprints.groovy:27)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Caused by: org.dom4j.DocumentException: Can't create default XMLReader; is system property org.xml.sax.driver set? Nested exception: Can't create default XMLReader; is system property org.xml.sax.driver set?

at org.dom4j.io.SAXReader.read(SAXReader.java:484)

at org.dom4j.io.SAXReader.read(SAXReader.java:264)

at chemaxon.descriptors.MDParameters.readFromXmlFile(MDParameters.java:885)

... 3 more

Norbert
ChemAxon personnel
Joined: 08 May 2013
Posts: 161

View user's profile

Back to top
Link to postPosted: Thu Jul 17, 2014 11:43 amPost subject: Reply with quote

Hi David,

 

I moved your record to the appropriate topic. My colleagues will answer you in short time.

 

Best regards,

Norbert 

Gabor
ChemAxon personnel
Joined: 29 May 2005
Posts: 317

View user's profile

Back to top
Link to postPosted: Fri Jul 18, 2014 4:34 pmPost subject: Reply with quote

Dear David,

 

Could you post the JChem version, Java version and OS version you used? Could you try to execute ECFP creation code using bare Java?

 

Regards,

Gabor

David

Joined: 15 Nov 2011
Posts: 23

View user's profile

Back to top
Link to postPosted: Sun Jul 20, 2014 6:45 pmPost subject: Reply with quote

Thank you, here is the info:

 

JChem version:  14.7.14.0  (from this file:  jchem-14.7.14.0-macos.dmg)

Java version:  1.7.0_60

OS:  Mac OS X 10.9.4

 

It does work with plain java actually.

Gabor
ChemAxon personnel
Joined: 29 May 2005
Posts: 317

View user's profile

Back to top
Link to postPosted: Tue Jul 22, 2014 11:42 amPost subject: Reply with quote

Dear David,

 

Thanks for the info. I suspect classpath/class loading problem with the groovy launching. Is there a "fork JVM" option in your environment?

 

Regards,

Gabor

org.dom4j.verbose=true.
David

Joined: 15 Nov 2011
Posts: 23

View user's profile

Back to top
Link to postPosted: Tue Jul 22, 2014 10:30 pmPost subject: Reply with quote

Hi

Thank you - I'm not sure how to do that - I'm using IntelliJ.  A quick google didn't turn up how to do it (there was an entry on forking tests).

I had written it as a Groovy script, but then I re-wrote it as a Main class and executed it as an application and it worked.  I then modified my Groovy script to include an additional external library (apache commons math) and that worked.

I would like to pursue why this doesn't work as a Groovy script, if possible.

Gabor
ChemAxon personnel
Joined: 29 May 2005
Posts: 317

View user's profile

Back to top
Link to postPosted: Wed Jul 23, 2014 1:36 pmPost subject: Reply with quote

Dear David,

 

Glad to hear that working around the problem was possible.

To pursue the cause of the original problem i would recommend to follow the execution (based on the stack trace) of the problematic part simultaneously in both environment (standalone java vs Groovy script).

The relevant parts from ChemAxon sources:

// Import statements
import org.dom4j.Document;
import org.dom4j.io.SAXReader;

SAXReader reader = null; // Declaring reader
reader = new SAXReader(); // Creating reder
Document doc = reader.read( file );            // MDParameters.java:885; file is the passed File reference

The dom4j classes are declared in the dom4j-1.6.1.jar file. Online sources to follow stack trace can be found at http://grepcode.com/file/repo1.maven.org/maven2/dom4j/dom4j/1.6.1/org/dom4j/io/SAXReader.java?av=f#264

At a first glance the first possible difference in the execution paths is in SAXHelper.java, in line 78: http://grepcode.com/file/repo1.maven.org/maven2/dom4j/dom4j/1.6.1/org/dom4j/io/SAXHelper.java#78

In the failing execution org.dom4j.io.SAXHelper.createXMLReaderViaJaxp() must return null; in the not failing execution this method might return a not null value. I would recommend to check this first. (I think you need to put your code in org.dom4j.io package and subclass SAXHelper or use java reflection/setAccessible to invoke it)

If there is no difference then then the exception must come from the JRE (http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/org/xml/sax/helpers/XMLReaderFactory.java#133); i think duplicating the source of this method and executing step by step or printing trace info should yield further info.

 

Regards,

Gabor

David

Joined: 15 Nov 2011
Posts: 23

View user's profile

Back to top
Link to postPosted: Wed Jul 23, 2014 6:18 pmPost subject: Reply with quote

Thank you Gabor!  I'll let you know what I find.

This topic is locked: you cannot edit posts or make replies.
Page 1 of 1


To watch this topic for replies   Register (enables digests) or give email address  
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum