"MObjectProp cannot be exported" upgrade 3.2.2

User 2082812c83

12-01-2007 18:15:27

Hi,





I have taken a swing application that was previously using JChem 3.1.1 and upgraded it to use 3.2.2. Now when I double click on a molecule rendered in a cell of a JTable I get the exception shown below (which I did not get when using the prior version of JChem). The table has registered a TableCellEditor which is a subclass of DefaultCellEditor but which returns an instance of MViewPane when getTableCellEditorComponent is called by Swing. Any ideas what is causing this exception?:





java.lang.RuntimeException: MObjectProp cannot be exported


at chemaxon.struc.prop.MObjectProp.convertToString(MObjectProp.java:44)


at chemaxon.struc.MPropertyContainer.getString(MPropertyContainer.java:116)


at chemaxon.struc.Molecule.getProperty(Molecule.java:298)


at chemaxon.marvin.view.swing.modules.MViewFrame$FieldView.<init>(MViewFrame.java:83)


at chemaxon.marvin.view.swing.modules.MViewFrame.makeLayout(MViewFrame.java:576)


at chemaxon.marvin.view.swing.modules.MViewFrame.callback(MViewFrame.java:163)


at chemaxon.marvin.view.swing.modules.GridBagView.setWinmode(GridBagView.java:865)


at chemaxon.marvin.view.swing.ViewPanel.setWinmode(ViewPanel.java:412)


at chemaxon.marvin.view.swing.ViewPanel.openViewer(ViewPanel.java:2759)


at chemaxon.marvin.view.swing.ViewPanel.doubleClick(ViewPanel.java:2713)


at chemaxon.marvin.view.swing.ViewCanvas.mouseClicked(ViewCanvas.java:389)


at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)


at java.awt.Component.processMouseEvent(Unknown Source)


at java.awt.Component.processEvent(Unknown Source)


at java.awt.Container.processEvent(Unknown Source)


at java.awt.Component.dispatchEventImpl(Unknown Source)


at java.awt.Container.dispatchEventImpl(Unknown Source)


at java.awt.Component.dispatchEvent(Unknown Source)


at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)


at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)


at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)


at java.awt.Container.dispatchEventImpl(Unknown Source)


at java.awt.Window.dispatchEventImpl(Unknown Source)


at java.awt.Component.dispatchEvent(Unknown Source)


at java.awt.EventQueue.dispatchEvent(Unknown Source)


at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)


at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)


at java.awt.EventDispatchThread.pumpEvents(Unknown Source)


at java.awt.EventDispatchThread.pumpEvents(Unknown Source)


at java.awt.EventDispatchThread.run(Unknown Source)





Pretty much everything else I am doing with regards to Molecule objects seems to work OK although I did have to change a few places where I was calling getProperty on a molecule to getPropertyObject otherwise I got pretty much the same exception ("MObjectProp cannot be exported") just caused from a different point in the code.





I have currently only taken the jchem.jar from the lib directory of JChem version 3.2.2 and used that in my application. In general do I need to include the other jar files into my application for rendering, loading compounds into structure tables and subsructure searching to work or is jchem.jar all that is needed?





If other jars are needed which ones?





Thanks,





James


Thanks,





James

ChemAxon 7c2d26e5cf

12-01-2007 19:29:06

We will check it.

User 2082812c83

12-01-2007 20:19:28

I just did some more testing and narrowed the situation down such that I only see the exception if I have made a call like:





mol.setPropertyObject("Compound ID", new Long (12345));





before double clicking on the molecule.





NOTE: That mol is an instance of Molecule in the code snippet above.





If a call like the one above has *not* been made before double clicking on the compound in the JTable then everything works fine and no exception is thrown.





Hope this help you to track down what is causing the exception.





James

User f359e526a1

13-01-2007 15:45:04

Hi, there is no MLongProp class only MIntgerProp - so you can use only





mol.setPropertyObject("Compound ID", new Integer(12345));





Do you badly need a Long ID?

User 2082812c83

14-01-2007 14:06:31

No, I dont really need to use a Long I suppose but just to be clear this used to work without exception in version 3.1.1 so I can only assume that you were either casting it back to a Long under the covers or you used to support properties that were a Long?





Anyway, changing over to using an Integer instead of a Long did stop the exception form being thrown, thanks for your help.





Also, the second half of my question still stands. For a swing application using 3.2.2 or 3.2.3 for that matter is the jchem.jar the only one needed for rendering compounds, loading them into structure tables and structure searching?





Thanks,





JAmes

ChemAxon 7c2d26e5cf

15-01-2007 18:26:20

jchem.jar refers to external jars and resources that are located in the same directory than jchem.jar.


When you update JChem, please copy evertyhing from the "lib" directory of the JChem package (not only the jchem.jar) into the same directory of the recent JChem. If you do not refresh all binary resources, your JChem may be inconsistent.