Problems using MSketchPane

User ee508a317e

01-11-2010 15:36:55


Hello,


I am investigating trying to embed the Marvin bean in an app and am having a couple of issues using MSketchPane as shown above:


(1) How do I set no molecule (i.e. empty) in MSketchpane when it has a molecule set? setMol (aString) with aString = "" does not work. I am using setMol (aString) to set a peptide structure.


(2) I get an exception every time in the console on creating the MSKetchPane despite including ALL of the jars on my classpath (except the DLL which is presumably platform specific):


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at chemaxon.marvin.sketch.swing.SketchPanel.molLoaded(Unknown Source)
at chemaxon.marvin.sketch.swing.SketchPanel.setMol(Unknown Source)
at chemaxon.marvin.beans.MSketchPane.setMol(Unknown Source)
at chemaxon.marvin.beans.MSketchPane.setMol(Unknown Source)
at ...


Also are any parameters required to be set for this simple usage? The example does not set any so presumably it works by default without setting any?


Thanks.


Tim


ChemAxon 7c2d26e5cf

02-11-2010 12:23:13

Create an empty molecule or pass null value for setMol.


sketchpane.setMol(new Molecule());

or


sketchpane.setMol(null);

User ee508a317e

04-11-2010 19:08:18

Hello Tamas,


 


Okay setMol (new Moelcule()) works for me but setMol (null) does not compile as of course there are two such methods so you have to cast null to Molecule or String. With setMol ((String) null) you still get an exception.


Unfortunately despite including all jars in <marvin install dir>/lib on the classpath within Eclipse I still get an exception when MSketchpane is created on MacOSX:


chemaxon.formats.MolFormatException: Cannot create record reader for ChemAxon Marvin Documents / MRV



at chemaxon.formats.MFileFormat.createRecordReader(Unknown Source)


at chemaxon.formats.MFileFormatUtil.createRecordReader(Unknown Source)


at chemaxon.formats.MFileFormatUtil.createRecordReader(Unknown Source)


at chemaxon.marvin.io.MRecordImporter.<init>(Unknown Source)


at chemaxon.marvin.sketch.templates.TemplateSetLocation.readMoleculeStream(Unknown Source)


at chemaxon.marvin.sketch.templates.TemplateSetLocation.importTemplates(Unknown Source)


at chemaxon.marvin.sketch.templates.TemplateSet.getTemplates(Unknown Source)


at chemaxon.marvin.sketch.swing.templates.TemplateHandler$ToolBarActionValidator.addTemplatesToToolBar(Unknown Source)


at chemaxon.marvin.sketch.swing.templates.TemplateHandler$ToolBarActionValidator.validateToolbarActions(Unknown Source)


at chemaxon.marvin.sketch.swing.templates.TemplateHandler$ToolBarActionValidator.run(Unknown Source)


at java.lang.Thread.run(Thread.java:680)


Caused by: java.lang.NullPointerException


at chemaxon.marvin.io.formats.XmlImport.initImport(Unknown Source)


at chemaxon.marvin.io.formats.cml.CMLRecordReader.<init>(Unknown Source)


at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)


at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)


at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)


at java.lang.reflect.Constructor.newInstance(Constructor.java:513)



 


Any ideas?


 


Thank you.


Tim Mowlem

ChemAxon 7c2d26e5cf

05-11-2010 10:36:39

Can you send use your Eclipse classpath file (.classpath)?


I assume something is missing from the classpath or different Marvin versions are mixing in the classpath. If I can take a look at it, probably we can get closer to the solution.


If you do not like to share your setting on the forum, we can continue this discussion in private.

User ee508a317e

08-11-2010 10:18:04

Hello Tamas,



If you do not like to share your setting on the forum, we can continue this discussion in private.



 


Okay we can continue in private. If you can send me an email I can reply with the details.


 


Regards,


 


Tim Mowlem

ChemAxon 7c2d26e5cf

12-11-2010 13:20:08

Thanks for info about your classpath.


It seems it is not a classpath issue. As I see, the problem occurs at runtime when MSketchPane tries to load templates. I assume that Marvin cannot load of your marvin.mytemplates file from HOME/.chemaxon directory.


But it is only a suspect, we are still investigating the issue.


Please try Marvin after you removed (temporary) the marvin.mytemplates file. Probably it solves the problem.

User ee508a317e

15-11-2010 13:56:04

Hello Tamas,


Yes your suggested fix of removing the marvin.mytemplates file did work. No exception was created upon startup. A new marvin.mytemplates file was created and this new file did not cause the problem on a subsequent startup.


Contents of newly created file:



<?xml version="1.0" ?>


<cml>


</cml>


Installed file was 0 bytes so had no content.


ChemAxon 7c2d26e5cf

15-11-2010 16:15:13

I am glad that the issue has been solved.