Marvin 5.0 NullPointerException

User 9852713200

17-01-2008 17:29:57

Hi,





We can use MViewPane and MSketchPane successfully in our Java application, but if we click on Help > About or Edit > Preferences menu in MarvinView or MarvinSketch launched from our application, it will throw the following NullPointerException. Running standalone MarvinView or MarvinSketch does not have this problem.





We're using JRE1.4.2 and Marvin 5.0.





Exception occurred during event dispatching:


java.lang.NullPointerException


at chemaxon.marvin.common.swing.MolPanel.doHelp(Unknown Source)


at chemaxon.marvin.common.swing.action.HelpAction.doAction(Unknown Source)


at chemaxon.marvin.swing.MAction.actionPerformed(Unknown Source)


at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)


at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)


at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)


at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)


at javax.swing.AbstractButton.doClick(AbstractButton.java:289)


at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)


at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)


at java.awt.Component.processMouseEvent(Component.java:5100)


at java.awt.Component.processEvent(Component.java:4897)


at java.awt.Container.processEvent(Container.java:1569)


at java.awt.Component.dispatchEventImpl(Component.java:3615)


at java.awt.Container.dispatchEventImpl(Container.java:1627)


at java.awt.Component.dispatchEvent(Component.java:3477)


at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)


at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)


at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)


at java.awt.Container.dispatchEventImpl(Container.java:1613)


at java.awt.Window.dispatchEventImpl(Window.java:1606)


at java.awt.Component.dispatchEvent(Component.java:3477)


at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)


at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)


at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)


at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)


at java.awt.Dialog$1.run(Dialog.java:542)


at java.awt.Dialog$3.run(Dialog.java:569)


at java.security.AccessController.doPrivileged(Native Method)


at java.awt.Dialog.show(Dialog.java:567)








thanks,

ChemAxon 7c2d26e5cf

18-01-2008 14:17:19

Indeed, invoking Help/Content (in MarvinView) and Help/Help Contents (in MarvinSketch) from the menu throw an exception (the stack trace is the same than yours).


But Edit/Preferences and Help/About works fine.


If it does not work for you please check whether all jars are avaialble in the marvinbeans/lib directory (not only MarvinBeans.jar).


If it is OK, please check you CLASSPATH, probably an old Marvin / JChem is also in the CLASSPATH that can cause problem.

User 9852713200

18-01-2008 15:51:02

Hi,





As I mentioned in my post, if we click on Help > About or Edit > Preferences menu in MarvinView or MarvinSketch launched from our application (we only included MarvinBeans.jar in CLASSPATH), the NullPointerException is throwed. However, invoking Help/Content (in MarvinView) and Help/Help Contents (in MarvinSketch) in our application works fine.





Interesting enough, if running standalone MarvinView and MarvinSketch, it 's actually the other way around, which means invoking Help/Content (in MarvinView) and Help/Help Contents (in MarvinSketch) from the menu throw an exception. But Edit/Preferences and Help/About works fine.





One question, in order to use MarvinSketch and MarvinView in our application, which jars should be included in our classpath? The less, the better.





Thanks,

ChemAxon 7c2d26e5cf

18-01-2008 16:44:56

In the MANIFEST file of MarvinBeans.jar, all required extra jars are enumerated.


Because of it, normally you have to add MarvinBeans.jar only - explicitly - to the CLASSPATH.


The default classloader - normally - looks up classes from those jars that are enumerated in the Class-Path attribute of the MANIFEST file of the main jar (MarvinBeans.jar).


Probably, your classloader did not evaluate the MANIFEST of MarvinBeans.jar.


In this case, you have to add all jars that you can find in the marvinbeans/lib directory manually except native jars (whose name includes "native" like "inchi-native-windows-1_1.jar).


In Marvin 5.0.0 the jar list for the CLASSPATH is the following:


Code:
freehep-graphics2d.jar


freehep-graphicsio-emf.jar


freehep-graphicsio.jar


freehep-graphicsio-pdf.jar


gluegen-rt.jar


izmcomjni.jar


izmcom-natives.jar


izmcomtlb.jar


jextexp.jar


jnbtools.jar


jogl_1.1.0-rc2\jogl.jar


jogl_1.1.0-rc2\gluegen-rt.jar


forms-1.1.0.jar


aloe.jar


MarvinBeans.jar



Take care that the list can differ in different Marvin versions.

ChemAxon 909aee4527

23-01-2008 14:07:56

Note: the jar file list was just corrected.