CFParameters() constructor NullPointerException

User e469f67125

01-10-2008 23:03:42

environment: JChem version 5_1_0, Java 1.6.0_03 (Sun JDK), Linux x86 32bit





Simply calling the default constructor:





Code:
    CFParameters cfparams = new CFParameters();





results in a runtime exception and message "Failed to create default XML configuration." (traceback below).





However, the same code, same JChem version, with Java 1.6.0_07 works fine.
    $ java sim2d test.smi 'NCCc1ccccc1'


    java.lang.NullPointerException


    at org.jaxen.util.DescendantAxisIterator.hasNext(DescendantAxisIterator.java:94)


    at org.jaxen.expr.DefaultStep.evaluate(DefaultStep.java:166)


    at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:154)


    at org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPath.java:121)


    at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:112)


    at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:688)


    at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:227)


    at org.jaxen.BaseXPath.selectSingleNode(BaseXPath.java:248)


    at org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:156)


    at org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:188)


    at chemaxon.descriptors.CFParameters.processDocument(CFParameters.java:273)


    at chemaxon.descriptors.MDParameters.initParameters(MDParameters.java:201)


    at chemaxon.descriptors.CFParameters.initParameters(CFParameters.java:177)


    at chemaxon.descriptors.CFParameters.setLength(CFParameters.java:127)


    at chemaxon.descriptors.CFParameters.<init>(CFParameters.java:62)


    at sim2d.main(sim2d.java:28)


    Exception in thread "main" java.lang.RuntimeException: Failed to create default XML configuration.


    at chemaxon.descriptors.MDParameters.initParameters(MDParameters.java:210)


    at chemaxon.descriptors.CFParameters.initParameters(CFParameters.java:177)


    at chemaxon.descriptors.CFParameters.setLength(CFParameters.java:127)


    at chemaxon.descriptors.CFParameters.<init>(CFParameters.java:62)


    at sim2d.main(sim2d.java:28)


My sim2d.java source file is attached. Apparently a problem with Jaxen (org.jaxen.util)?





I have already found a workaround, by using the alternate constructor CFParameters(String xml), which works on the platform in question. So the main purpose of this post is to inform others and inform full resolution.

ChemAxon efa1591b5a

03-10-2008 12:43:33

Hi,





I'm afraid I could not reproduce the problem you reported. I tried various platforms and java version (MacOSX, Linux, java 1.4.2, 1.5.0_13-121 and 1.6.0_06-b02), though not 1.6.0_03 where you experienced problem.





If this problem is so specific to a particular java version then we will not take any further action at present. Thank you for informing us and our user community.





Regards,


Miklos

User e469f67125

03-10-2008 16:57:47

I upgraded from JDK 1.6.0_03 to 1.6.0_07 and the problem went away, so it seems the issue is Java version as you anticipate. Miklos, thank you very much for the response.

ChemAxon efa1591b5a

06-10-2008 11:48:50

Thanks for the information and in particular for your flexibility in using a newer version of java.








Regards,


Miklos