vote up 0 vote down
star

I am getting this NullpointerException deep in the internals when trying to generate InChI using the InChIGeneratorFactory in CDK. Can someone give me a hint to what could be going wrong?

[...] Caused by: java.lang.NullPointerException at net.sf.jnati.deploy.NativeArtefactLocator.getArtefact(NativeArtefactLocator.java:129) at net.sf.jnati.deploy.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:37) at net.sf.jniinchi.JniInchiWrapper.loadLibrary(JniInchiWrapper.java:92) at org.openscience.cdk.inchi.InChIGeneratorFactory.(InChIGeneratorFactory.java:78) at org.openscience.cdk.inchi.InChIGeneratorFactory.getInstance(InChIGeneratorFactory.java:96) at net.bioclipse.structuredb.domain.DBMolecule.calculateInchi(DBMolecule.java:421) ... 34 more

The actual code is here

flag
This is not a question – baoilleach Nov 11 at 15:06
perhaps you meant..."How do I create an InChI using the CDK?" – baoilleach Nov 11 at 15:31
Fair enough I guess it's supposed to be a question... – jonalv Nov 11 at 16:59
What is the full code you are using in the DBMolecule.calculateInchi() method? – Egon Willighagen Nov 17 at 18:32
github.com/jonalv/bioclipse.structuredb/blob/… – jonalv Nov 18 at 16:27

2 Answers

vote up 1 vote down

which version are you using?

And you can also use directly jni-inchi

http://jni-inchi.sourceforge.net/

which exists in two version. One for inchis and one for standard inchis.

link|flag
vote up 0 vote down

I checked the CDK unit test for the InChIGenerator and that indicates that the code should look like:

InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
InChIGenerator gen = getFactory().getInChIGenerator(ac);
Assert.assertEquals(gen.getReturnStatus(), INCHI_RET.OKAY);
Assert.assertEquals(gen.getInchi(), "InChI=1/Cl");

It seems to be the instantiation of the factory which fails, and I do not know why that is.

link|flag

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.