Library problem with InChi String conversion

User b0f6d33590

27-10-2011 11:15:39

Dear chemaxon users


I have an eclipse RCP application. In my target platform I use the marvin libraries of version 5.4.x


I successfully integrated the marvin sketch into my application and it works.


But now I am facing the following issue: I added some code that the user is able to enter an InChI string:


Molecule molecule = MolImporter.importMol("...", INCHI_FORMAT);


This works great on my computer. On other computers it will not work. I found out, that it only works on computers where the marvin package is installed as a windows software.


On the other computers I get the following error:


Cannot load InChi
library:C:\...\inchi-native-windows-1_2r.jar is
not found.


I deploy my application as webstart application which has all needed jars included. Everything else from the marvin libraries is working on all computers. If I look in the application folder, I see that the inchi-native-windows-1.2r.jar is available (like all other jar's e.g. jchem, ...)


Do you have any ideas on how to solve this problems?


 


many thanks in advance,


David

ChemAxon 5433b8e56b

28-10-2011 08:03:28


Hi,


i moved this topic to the Sturcture representation forum, because
this question belongs to here. My collagues will answer you soon.


Regards,
Istvan


ChemAxon 7c2d26e5cf

02-11-2011 13:28:25

Is inchi-native-windows-1_2r.jar is enumerated in your JNLP file? Does this file exist on the server?


 

User b0f6d33590

30-11-2011 15:12:25

hi Tamas


Thanks for your reply. I just checked it and the jar library is available in the jnlp file.


The weird thing is, that all other Chemaxon functionalites are working, expect the described one above.


Any other ideas?


regards,


David

ChemAxon 7c2d26e5cf

01-12-2011 12:42:50

Do you get the error message during the initalization process of the Webstart appliction?


If not, after which action appears this inchi issue?

User b0f6d33590

01-12-2011 12:49:17

Hi


I have GUI where the user may paste some input data. SMARTS, SMILES or INCHI.


If the user enters something, I try to parse the input:


Molecule molecule = MolImporter.importMol(input, SMARTS_FORMAT);


if this is not working, I try to convert it as INCHI String:


Molecule molecule = MolImporter.importMol(input, INCHI_FORMAT);


This line will then throw the exception. If it is a smarts or smiles string it will work.


So, the error occurs not during the startup, it occurs during the conversion call.


Thx for your help.


regards,


David


 

User b0f6d33590

01-12-2011 14:02:45

Hi


 


One additional information. The issue has nothing to do with webstart. I just went to my collegue and we started the application directly from the Eclipse environment and we got the same error.


So it looks like the application is looking for the library on the system instead of looking for it in the target platform of the project.


regards,


David

User b0f6d33590

01-12-2011 14:56:25

Hi Tamas


 


I found the problem:


If I use a Marvin tool like marvin sketch and I work with an Inchi string, the Inchi DLL will be copied to my windows home user directory (C:\Users\herzigd\chemaxon\lib\inchi-1_2r).


If I delete the chemaxon folder, it will be created again next time.


But if I start my application and use Inchi string, the application is not able to copy the Inchi dll into my user directory:



chemaxon.marvin.util.InstallFromJar.extractFromJar(Unknown
Source),
 chemaxon.marvin.io.formats.inchi.Inchi.install(Unknown
Source),
 chemaxon.marvin.io.formats.inchi.Inchi.main(Unknown
Source),
 chemaxon.marvin.io.formats.inchi.InchiImport.createAuxInfo(Unknown
Source),
 chemaxon.marvin.io.formats.inchi.InchiImport.readInput(Unknown
Source),
 chemaxon.marvin.io.formats.inchi.InchiImport.readMol(Unknown
Source),
 chemaxon.marvin.io.MRecordImporter.readStructure(Unknown
Source),
 chemaxon.marvin.io.MRecordImporter.readMol(Unknown
Source),
 chemaxon.marvin.io.MRecordImporter.readMol(Unknown
Source),
 chemaxon.marvin.io.MRecordImporter.readMol0(Unknown
Source),
 chemaxon.marvin.io.MRecordImporter.readMol(Unknown
Source)


regards,

David

ChemAxon 7c2d26e5cf

05-12-2011 13:02:37

Hi David,


Yes, you have figured out how inchi native is loaded In Marvin.


The inchi.dll is deployed in a jar file. Since Webstart requires to wrap everything in signed jars.


Marvin unwraps the dll from the proper jar and place it into a custom directory under your user home unless it already exists.


The absolute path of this native is used to load the native into the memory.


You have attached a portion of the stack trace. It seems that the extraction of the jar file is unsuccessful.


Can you show the full stacktrace? Which exception has been thrown?

User b0f6d33590

09-01-2012 11:32:32

Hi Tamas


Thanks for your help. Here is the stack trace.


chemaxon.marvin.io.formats.inchi.InchiImport.readInput(Unknown Source)
chemaxon.marvin.io.formats.inchi.InchiImport.readMol(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readStructure(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol0(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol(Unknown Source)
chemaxon.formats.MolImporter.readMol(Unknown Source)
chemaxon.formats.MolImporter.read(Unknown Source)
chemaxon.formats.MolImporter.importMol(Unknown Source)
chemaxon.formats.MolImporter.importMol(Unknown Source)
chemaxon.formats.MolImporter.importMol(Unknown Source)
com.roche.research.giacometti.shared.ui.StructureDrawComposite.updateFromInputText(StructureDrawComposite.java:243)
com.roche.research.giacometti.shared.ui.StructureDrawComposite$1.insertUpdate(StructureDrawComposite.java:159)
javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:184)
javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:754)
javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:711)
javax.swing.text.PlainDocument.insertString(PlainDocument.java:114)
javax.swing.text.AbstractDocument.replace(AbstractDocument.java:673)
javax.swing.text.JTextComponent.setText(JTextComponent.java:1441)
com.roche.research.giacometti.shared.ui.StructureDrawComposite.initComponents(StructureDrawComposite.java:439)
com.roche.research.giacometti.shared.ui.StructureDrawComposite.<init>(StructureDrawComposite.java:190)
com.roche.research.giacometti.search.structuresearch.core.ui.StructureSearchComposite.initComponents(StructureSearchComposite.java:237)
com.roche.research.giacometti.search.structuresearch.core.ui.StructureSearchComposite.<init>(StructureSearchComposite.java:120)
com.roche.research.giacometti.search.structuresearch.core.ui.StructureSearchComposite.<init>(StructureSearchComposite.java:107)
com.roche.research.giacometti.search.tabbed.tabs.structure.StructureSearchTab.initComposite(StructureSearchTab.java:142)
com.roche.research.giacometti.search.tabbed.view.TabPanel.setTab(TabPanel.java:115)
com.roche.research.giacometti.search.tabbed.view.SearchView.createTabs(SearchView.java:259)
com.roche.research.giacometti.search.tabbed.view.SearchView.initializePartControl(SearchView.java:230)
com.roche.research.giacometti.search.tabbed.view.SearchView.createPartControl(SearchView.java:150)
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1254)
org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1207)
org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1606)
org.eclipse.ui.internal.PartStack.createControl(PartStack.java:647)
org.eclipse.ui.internal.PartStack.createControl(PartStack.java:574)
org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:981)
org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3614)
org.eclipse.ui.internal.WorkbenchPage.busySetPerspective(WorkbenchPage.java:1041)
org.eclipse.ui.internal.WorkbenchPage.access$16(WorkbenchPage.java:1025)
org.eclipse.ui.internal.WorkbenchPage$19.run(WorkbenchPage.java:3715)
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3713)
org.eclipse.ui.internal.Workbench.showPerspective(Workbench.java:2814)
com.roche.research.giacometti.core.ui.util.PerspectiveHelper$1.run(PerspectiveHelper.java:96)
org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
org.eclipse.swt.widgets.Display.syncExec(Display.java:4584)
com.roche.research.giacometti.core.ui.util.PerspectiveHelper.showPerspective(PerspectiveHelper.java:92)
com.roche.research.giacometti.core.ui.util.PerspectiveHelper.showPerspective(PerspectiveHelper.java:54)
com.roche.research.giacometti.core.ui.commands.internal.NewSearchHandler.execute(NewSearchHandler.java:52)
org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:178)
com.roche.research.giacometti.core.ui.swt.button.ImageButton.handleEvent(ImageButton.java:208)
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
com.roche.research.giacometti.workbench.Application.getReturnCode(Application.java:189)
com.roche.research.giacometti.workbench.Application.performStartWithLoginWindow(Application.java:120)
com.roche.research.giacometti.workbench.Application.start(Application.java:74)
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
org.eclipse.equinox.launcher.Main.run(Main.java:1408)
org.eclipse.equinox.launcher.Main.main(Main.java:1384)
chemaxon.marvin.io.MRecordImporter.readStructure(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol0(Unknown Source)
chemaxon.marvin.io.MRecordImporter.readMol(Unknown Source)
chemaxon.formats.MolImporter.readMol(Unknown Source)
chemaxon.formats.MolImporter.read(Unknown Source)
chemaxon.formats.MolImporter.importMol(Unknown Source)
chemaxon.formats.MolImporter.importMol(Unknown Source)
chemaxon.formats.MolImporter.importMol(Unknown Source)
com.roche.research.giacometti.shared.ui.StructureDrawComposite.updateFromInputText(StructureDrawComposite.java:243)
com.roche.research.giacometti.shared.ui.StructureDrawComposite$1.insertUpdate(StructureDrawComposite.java:159)
javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:184)
javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:754)
javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:711)
javax.swing.text.PlainDocument.insertString(PlainDocument.java:114)
javax.swing.text.AbstractDocument.replace(AbstractDocument.java:673)
javax.swing.text.JTextComponent.replaceSelection(JTextComponent.java:1099)
javax.swing.plaf.basic.BasicTextUI$TextTransferHandler.handleReaderImport(BasicTextUI.java:2278)
javax.swing.plaf.basic.BasicTextUI$TextTransferHandler.importData(BasicTextUI.java:2383)
javax.swing.TransferHandler$TransferAction.actionPerformed(TransferHandler.java:847)
javax.swing.text.JTextComponent.invokeAction(JTextComponent.java:1233)
javax.swing.text.JTextComponent.paste(JTextComponent.java:1211)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.eclipse.ui.internal.handlers.WidgetMethodHandler$2.run(WidgetMethodHandler.java:108)
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

User b0f6d33590

09-01-2012 11:40:01

The Exception which is thrown in my code:


 


chemaxon.formats.MolFormatException: Cannot load InChi library:C:\java\eclipse-3.6.2-rcp\inchi-native-windows-1_2r.jar is not found.

ChemAxon 7c2d26e5cf

09-01-2012 17:17:52

Marvin attemps to load inchi-native-*.jar from the same directory where chemaxon-inchi.jar is located.


Copy inchi-native-*.jar beside the chemaxon-inchi.jar.

User b0f6d33590

10-01-2012 08:18:51

Hi Tamas


that is already the case. All marvin jars are provided and deployed in one plugin, including inchi-native-windows-1_2r and chemaxon-inchi.

ChemAxon 7c2d26e5cf

10-01-2012 10:18:45

Does it mean that all jars are copied into this directory?


C:\java\eclipse-3.6.2-rcp\


User b0f6d33590

10-01-2012 10:39:05

No.


The folder c:/java/eclipse-3.6.2-rcp contains the eclipse application (just the unpacked eclipse application downloaded from www.eclipse.org). I have no idea why chemaxon is looking in this directory.


All marvin jars are provided within one plugin. This plugin is then used within my application. That works for the marvon gui, but not for the inchi stuff.


I have written a simple Swing application (one eclipse project) and added all marvin jars directly to the project classpath. That is working.

ChemAxon 7c2d26e5cf

10-01-2012 11:40:43

Marvin asks the Java classloader to determine the location of chemaxon/inchi/natives/InchiNative.class.


It is wrapped into chemaxon-inchi.jar. So, the expected behaviour to lookup chemaxon-inchi.jar and retrieve its absolute path. This path is required to be able to load the inchi native.


It seems it does not work in eclipse plugin mechanism. Eclipse believe the above class is in the eclipse root.

User 276147625b

29-01-2012 13:42:50

I used jython with eclise interface to convert  mol to "inchi".


At first it does not work, but after i added the path of these three file shown in picture.


By extending the inchi's library, I  called the function molInchi = mol.toFormat("inchi").


It works for me.