chemaxon.license.LicenseException: No license file was found

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)

ChemAxon d26931946c

01-06-2015 08:16:47

Hi Tom,


I think the cause may be that the running user is different in if you run the software from eclipse or from MRI server.


The license file location works for user tomt, but not for others.


I suggest to use a system variable or java propery to define the location of the license file for all users.


 


Best regards,


Peter

User bc3eb0a599

02-06-2015 13:23:55

Thanks Peter. You are right on. I tried setting the license by calling licenseHandler.setLicenseFile(licenseFilePath) and it works.


However, I now have a different issue. I use the MolSearch class to find duplicate structures in memory(see example below). It get ClassNotFoundExcept on the class MolSearch when running in Linux. It works fine when I run it on my Windows machine. Do I need to specify the classpath differently? Any idea?


Tom


The classpath I specified include jchem.jar as in "/home/oracle/ChemAxon/JChem/lib/jchem.jar:/home/oracle/ChemAxon/JChem/lib/com.chemaxon-io.jar:/home/oracle/ChemAxon/JChem/lib/jchem-sss.jar". 


MolSearch molSearch = new MolSearch();
MolSearchOptions so = new MolSearchOptions(SearchConstants.DUPLICATE);
molSearch.setSearchOptions(so);
:


       

ChemAxon abe887c64e

02-06-2015 14:09:52

 


Hi Tom,


It is enough to specify the classpath of the ChemAxon/JChem/lib/jchem.jar file, however, would you check that "/home/oracle/ChemAxon/JChem/lib/jchem.jar" is really the valid path.


Best regards,


Krisztina



User bc3eb0a599

02-06-2015 17:04:07

The path is correct. FYI, there's no problem using other
classes such as Molecule...


I forgot to mention the Linux installation is for our
JChem cartridge server. I assume the APIs should work the same way, right?


Thanks,





Tom

ChemAxon abe887c64e

03-06-2015 07:14:45

Yes, JChem Cartridge uses JChem API, and the MolSearch class is included in com.chemaxon-search-extended.jar.


Our guess is, that your /home/oracle/ChemAxon/JChem/lib/ directory is somehow corrupted. It may also contain jar files from older versions than 15.5.11. (e.g. jchem-sss.jar should not be present). Please compare the jar files of your current lib folder with the ones of a fresh instance of JChem 15.5.11.


Krisztina