User fc702a6c20
30-04-2008 10:30:29
Hi,
I am trying to use the ElementalanalyserPlugin in my Java program so that I can get the exact mass and formula from a molecule, but I keep getting a null pointer exception when initialising the plugin. I also tried using the ElementalAnalyser class with the same problem.
the exception is as follows
java.lang.NullPointerException: in is nullat java.util.zip.ZipInputStream.<init>(ZipInputStream.java:55)
at chemaxon.struc.PeriodicSystem.a(Unknown Source)
at chemaxon.struc.PeriodicSystem.<clinit>(Unknown Source)
at chemaxon.calculations.ElementalAnalyser.<clinit>(Unknown Source)
at chemaxon.marvin.calculations.ElementalAnalyserPlugin.<init>(Unknown Source)
java.lang.ExceptionInInitializerError
at chemaxon.marvin.calculations.ElementalAnalyserPlugin.<init>(Unknown Source)
Caused by: java.lang.NullPointerException
at chemaxon.struc.PeriodicSystem.getElementCount(Unknown Source)
at chemaxon.calculations.ElementalAnalyser.<clinit>(Unknown Source)
... 55 more
The code is taken from your API - code examples :
ElementalAnalyserPlugin plugin = new ElementalAnalyserPlugin(); - exception thrown here
// set plugin parameters
Properties params = new Properties();
params.put("precision", "3");
plugin.setParameters(params);
// set target molecule
String molasString = metSummaryBean.getMol();
Molecule mol = MolImporter.importMol(molasString);
plugin.setMolecule(mol);
// run the calculation
plugin.run();
// get results
double exactMass = plugin.getExactMass();
String formula = plugin.getFormula();
// do something with the results ...
metSummaryBean.setMolecularWeight(exactMass);
metSummaryBean.setFormula(formula);
also tried :
ElementalAnalyser elemanal = new ElementalAnalyser(); - exception thrown here
Molecule mol = MolImporter.importMol(molasString);
elemanal.setMolecule(mol);
double exactMass = elemanal.exactMass();
metSummaryBean.setMolecularWeight(exactMass);
String formula = elemanal.formula();
metSummaryBean.setFormula(formula);
my question is - am I missing some important properties file, and if so where should this or these files be placed? I thought that perhaps it needed the elements.zip file and have copied the chemaxon folder into the base directory where my application is run from - in this case a WAR but this did not help.
Any suggestions would be greatly appreciated
Regards,
smb
I am trying to use the ElementalanalyserPlugin in my Java program so that I can get the exact mass and formula from a molecule, but I keep getting a null pointer exception when initialising the plugin. I also tried using the ElementalAnalyser class with the same problem.
the exception is as follows
java.lang.NullPointerException: in is nullat java.util.zip.ZipInputStream.<init>(ZipInputStream.java:55)
at chemaxon.struc.PeriodicSystem.a(Unknown Source)
at chemaxon.struc.PeriodicSystem.<clinit>(Unknown Source)
at chemaxon.calculations.ElementalAnalyser.<clinit>(Unknown Source)
at chemaxon.marvin.calculations.ElementalAnalyserPlugin.<init>(Unknown Source)
java.lang.ExceptionInInitializerError
at chemaxon.marvin.calculations.ElementalAnalyserPlugin.<init>(Unknown Source)
Caused by: java.lang.NullPointerException
at chemaxon.struc.PeriodicSystem.getElementCount(Unknown Source)
at chemaxon.calculations.ElementalAnalyser.<clinit>(Unknown Source)
... 55 more
The code is taken from your API - code examples :
ElementalAnalyserPlugin plugin = new ElementalAnalyserPlugin(); - exception thrown here
// set plugin parameters
Properties params = new Properties();
params.put("precision", "3");
plugin.setParameters(params);
// set target molecule
String molasString = metSummaryBean.getMol();
Molecule mol = MolImporter.importMol(molasString);
plugin.setMolecule(mol);
// run the calculation
plugin.run();
// get results
double exactMass = plugin.getExactMass();
String formula = plugin.getFormula();
// do something with the results ...
metSummaryBean.setMolecularWeight(exactMass);
metSummaryBean.setFormula(formula);
also tried :
ElementalAnalyser elemanal = new ElementalAnalyser(); - exception thrown here
Molecule mol = MolImporter.importMol(molasString);
elemanal.setMolecule(mol);
double exactMass = elemanal.exactMass();
metSummaryBean.setMolecularWeight(exactMass);
String formula = elemanal.formula();
metSummaryBean.setFormula(formula);
my question is - am I missing some important properties file, and if so where should this or these files be placed? I thought that perhaps it needed the elements.zip file and have copied the chemaxon folder into the base directory where my application is run from - in this case a WAR but this did not help.
Any suggestions would be greatly appreciated
Regards,
smb