User bc3eb0a599
28-05-2015 18:22:34
Hello Support,
I have codes that use JChem's MolSearch class to perform in memory duplicate search. However, it failed with "License file not found" error when MolSearch.findAll method is called(see example codes and stack track below). This method is called from an MRI server which is run locally on the same windows 7 machine where the license file resides(c:\users\tomt\chemaxon\license.cxl). My JChem version# is 15.5.11.0. Also, the same codes run ok in Eclipse.
Example codes:
public static int[] findExactMatches(List<String> refMolfiles,
List<String> testMolfiles)
{
MolSearch molSearch = new MolSearch();
MolSearchOptions so = new MolSearchOptions(SearchConstants.DUPLICATE);
molSearch.setSearchOptions(so);
int[] resultIdxs = new int[testMolfiles.size()];
//Convert molfile strings to Molecules.
List<Molecule> targetMols = new ArrayList();
for (String target : testMolfiles)
{
targetMols.add(ScMolHelper.importMol(target));
}
List<Molecule> refMols = new ArrayList();
for (String ref : refMolfiles)
{
refMols.add(ScMolHelper.importMol(ref));
}
int targetIdx = 0;
/*
Molecule[] refMols = new Molecule[3];
refMols[0] = targetMols.get(0);
refMols[1] = targetMols.get(1);
refMols[2] = targetMols.get(3);
Molecule[] testMols = new Molecule[3];
testMols[0] = srcMols.get(1);
testMols[1] = srcMols.get(2);
testMols[2] = srcMols.get(3);
*/
for (Molecule targetMol : targetMols)
{
int refIdx = 0;
resultIdxs[targetIdx] = -1; //default to not found.
for (Molecule refMol : refMols)
{
molSearch.setQuery(refMol);
molSearch.setTarget(targetMol);
try {
System.out.println("Comparing reference idx(" + refIdx + ") to target idx(" + targetIdx + ")");
int[][] allHits = molSearch.findAll();
if (allHits != null)
{
resultIdxs[targetIdx] = refIdx;
}
} catch (SearchException e) {
new ScException("Error comparing Molfile strings.", e);
}
refIdx++;
}
targetIdx++;
}
return resultIdxs;
}
chemaxon.license.LicenseException: No license file was found.
Product name: Structure Search
Licenses are read from:
Please visit http://www.chemaxon.com/contact-us/ or contact sales _at_ chemaxon.com to obtain the corresponding license.
at chemaxon.license.LicenseHandler.checkLicense(LicenseHandler.java:811)
at chemaxon.license.LicenseHandler.checkLicense(LicenseHandler.java:787)
at chemaxon.sss.search.BaseMolSearch.checkLicense(BaseMolSearch.java:376)
at chemaxon.sss.search.BaseMolSearch.ensureCore(BaseMolSearch.java:199)
at chemaxon.sss.search.BaseMolSearch.findFirstHit(BaseMolSearch.java:160)
at chemaxon.sss.search.MolSearch$2.call(MolSearch.java:401)
at chemaxon.sss.search.MolSearch$2.call(MolSearch.java:396)
at chemaxon.sss.search.SearchUtil.invokeSearchWithExceptionWrapping(SearchUtil.java:528)
at chemaxon.sss.search.MolSearch.findNextHit(MolSearch.java:406)
at chemaxon.sss.search.MolSearch.findFirstHit(MolSearch.java:391)
at chemaxon.sss.search.Search.findAllHits(Search.java:333)
at chemaxon.sss.search.MolSearch.findAllHits(MolSearch.java:412)
at chemaxon.sss.search.Search.findAll(Search.java:181)
at com.deltasoftinc.sc.jchem.utility.ScMolComparator.findExactMatches(ScMolComparator.java:136)
at com.deltasoftinc.sc.jchem.utility.ScMolComparator.findExactMatches(ScMolComparator.java:72)
at com.deltasoftinc.sc.server.ScWorker.findExactMatchIndexes(ScWorker.java:285)