embidding MarvinSketch in JSP

User 581eabb90d

18-11-2008 11:47:21

Hi I am able to embed Marvin Sketch into my JSP however on right side I am not able to see those buttons of C,O,H,S etc. I can see one button C with tool tip more but after clicking on that button nothing has happened.





Will you please help me to solve this issue?





I appreciate your reply in advance.

ChemAxon 909aee4527

18-11-2008 14:33:53

Hello,





the first button with C should be the Periodic System button. Can you please send us a screenshot about the applet?


Can you see any (error) messages in the Java Console?





Kind regards,


Judit

User 581eabb90d

21-11-2008 06:15:43

Hi,





As per your requirement I am sending you an attachment of my application.





Please have a look on the same and observe that I am not able to display right side button list of (C,N,H,Br,I,O etc) as well as when I click on Periodic System button I cant get the expected window.

ChemAxon 909aee4527

21-11-2008 08:21:04

Hi,





thank you, this helps to understand the problem, maybe some resources are missing from your application, I suspect the icon file of the atom buttons.





To find it out can you please open the sun Java Consol from the Tools menu of Internel Explorer before starting the applet and


- check if there is any message appearing when the applet is loading


- check if there is any message appearing when you press the periodic system button.





You may already know that our Applet Examples can help you when building a custom web application: http://www.chemaxon.com/marvin/examples/applets/sketch/index.html





Thank you for the additional information in advance.


Judit

User 581eabb90d

21-11-2008 13:01:47

Hello,


Thanks for your information. I checked the Java Console and observed that after clicking on Periodic System button I am getting below exceptions





java.lang.NullPointerException: in is null


at java.util.zip.ZipInputStream.<init>(Unknown Source)


at chemaxon.struc.PeriodicSystem.a(Unknown Source)


at chemaxon.struc.PeriodicSystem.<clinit>(Unknown Source)


at chemaxon.marvin.sketch.swing.actions.template.AtomActionFactory.createActions(Unknown Source)


at chemaxon.marvin.uif.builder.impl.action.ActionSet.a(Unknown Source)


at chemaxon.marvin.uif.builder.impl.action.ActionSet.a(Unknown Source)


at chemaxon.marvin.uif.builder.impl.action.ActionSet.installActions(Unknown Source)


at chemaxon.marvin.uif.builder.DefaultModuleConfiguration.createLocalActions(Unknown Source)


at chemaxon.marvin.uif.module.GUIModule.b(Unknown Source)


at chemaxon.marvin.uif.module.GUIModule.bindComponent(Unknown Source)


at chemaxon.marvin.sketch.swing.SketchPanel.molInit(Unknown Source)


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


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


at JMSketch.a(Unknown Source)


at JMSketch.a(Unknown Source)


at JMSketch$1.run(Unknown Source)


at java.awt.event.InvocationEvent.dispatch(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)





Could you please guide me to solve this?





Looking forward to your reply

ChemAxon 909aee4527

24-11-2008 14:42:02

Hello,





do you have the chemaxon\elements.zip and chemaxon\isotopes.zip files beside the jmarvin.jar file? They could be the missing ones.





Please tell us if this helps or not.





Kind regards,


Judit

User 2d94675c91

16-01-2009 18:20:19

I am also facing the same problem and don't know where to get these files can somebody show me the way how to get pass this issue? Attached the error file that I am facing.

ChemAxon 909aee4527

19-01-2009 09:55:07

Dear Atul,





when you download and extract Marvin Applets, the elements.zip and isotopes.zip files should be located in the chemaxon subdirectory. This problem appears when the applet doesn't find the two zip files in the chemaxon subdirectory.





Installation guide of Marvin Applets: http://www.chemaxon.com/marvin/det-download.html#marvinapplets





Please tell us if the two zip files are there and you still have the problem.





Kind regards,





Judit

User 60b60eaf80

19-01-2009 10:16:41

thanks - we've had the same exception because we missed the chemaxon dir completely - exception is history for us now.

User 2d94675c91

20-01-2009 07:57:27

Hi I did got the files but I need to run this applet throuh web application I am using JBoss to run the application. I copied both the zip files but it is still giving the same error. But if i run on command line it runs very well.

ChemAxon 7c2d26e5cf

20-01-2009 16:05:17

Do not copy files individually. Move the whole marvin directory to the proper place.





The marvin-bin-VERSION.zip is the minimal set that contains everything for running applet. The marvin-all-VERSION.zip package is its extension that inculdes also the documuntation and examples for the usage.





required files to run Marvin applets

User 2d94675c91

28-01-2009 10:25:58

Did the same thing download the version and copied the whole directory. But same result I had following configuration





1) Jboss server running on jdk 1.4





Prod server





1) Web sphere running on jdk 1.4





Please help me out.

User 2d94675c91

28-01-2009 10:26:20

Did the same thing download the version and copied the whole directory. But same result I had following configuration





1) Jboss server running on jdk 1.4





Prod server





1) Web sphere running on jdk 1.4





Please help me out.

ChemAxon 909aee4527

28-01-2009 10:45:04

Hello Atul,





until my colleague Tamas tries to help with the JBoss configuration, can you please provide some more information to help us:Please excuse me if there are more questions than necessary to solve the problem.

User 2d94675c91

28-01-2009 11:30:02

  • Please confirm that the exception appearing is still the same while the two zip files are available at the proper location. Isn't there any AccessControlExceptions appearing on the console? Yes same exception is coming


  • Do the calculator plugins work in the applet? Please try anything from the Tools menu. No Tool menu is not working


  • On the screenshot it seems you use IE. Is the Java plugin properly installed for the browser? Can you check the same applet with a different browser?Yes plug in is properly installed





    Thanks





    Atul
  • ChemAxon 7c2d26e5cf

    29-01-2009 14:30:38

    Probably, there is a configuration problem on your server. I can imagine that the server does not let accessing the zip files via http protocol.





    Please check whether the zip files (elements.zip, isotopes.zip) are available via http protocol in your browser. Type the following URL in your browser. Does it download?





    http://MYSERVER/MARVINPATH/chemaxon/elements.zip





    (where MYSERVER is the address of your server and MARVINPATH is the location of the marvin directory. e.g.: http://localhost:8080/marvin/chemaxon/elements.zip)





    Can you show me how you insert the applet into your web page (relevant part of the HTML source)? It can be also useful to investigate the problem.

    User 2d94675c91

    30-01-2009 10:37:39

    Tamas,





    Still issue reamins the same I am able to download please see the screen image.

    User 2d94675c91

    30-01-2009 10:45:47

    <applet ARCHIVE="jmarvin.jar" CODE="JMSketch" NAME="JMSketch" WIDTH=550 HEIGHT=510>


           <strong>Your browser does not support the applet tag.</strong>


          </applet>

    ChemAxon 7c2d26e5cf

    30-01-2009 11:54:27

    Thanks for info.





    In your applet code, the codebase attribute is not specified. The codebase give the relative path of resources from docbase.


    In this case, codebase describes the path from the JSP file where applet code is embedded to the directory where jmarvin.jar and other marvin resources are located. From the screenshots, I try to find out location of JSP and marvin.





    The quality of the screenshot is very poor. The URL of "elements.zip" on the picture is hardly readable. I read it as "http://localhost/lillyPD2/MarvinSketch/elements.zip". Do I see well?


    One of your previous screenshot, I've seen that your JSP is located under the following address: "http://localhost:8080/lillyPD2/MarvinSketchDemo.jsp".





    If my conclusion is correct, the JSP is located in the "/lillyPD2" directory, meanwhile the Marvin directory is "/lillyPD2/MarvinSketch". In this case the value of the codebase attribute has to be "MarvinSketch".


    As I see, "elements.zip" is in the root of the marvin directory, instead of its "chemaxon" subdirectory. That's why applet can not load-in it. So the correct place of "elements.zip" is "/lillyPD2/MarvinSketch/chemaxon/elements.zip". By "isotopes.zip", there may be the same problem.


    Please take care to preserve the directory hierarchy of Marvin when you copy the unwrapped package to another place.





    As I see, on your server, JSP files are accessible via 8080 port, meanwhile other resources (like "elements.zip") are use the default port. I do not know how your server maps http requests from different port. If "http://localhost:8080/lillyPD2" and "http:/localhost/lillyPD2" do not point to the same directory in the file system, you may have to change settings or modify URL in the example. Instead of relative, you can also use absolute path in the codebase attribute.

    User 2d94675c91

    30-01-2009 14:27:10

    Tamas,





    We are getting following exception done all the chages suggested by you.





    Java Plug-in 1.6.0_05


    Using JRE version 1.6.0_05 Java HotSpot(TM) Client VM


    User home directory = C:\Documents and Settings\mmoharil








    ----------------------------------------------------


    c:   clear console window


    f:   finalize objects on finalization queue


    g:   garbage collect


    h:   display this help message


    l:   dump classloader list


    m:   print memory usage


    o:   trigger logging


    p:   reload proxy configuration


    q:   hide console


    r:   reload policy configuration


    s:   dump system and deployment properties


    t:   dump thread list


    v:   dump thread stack


    x:   clear classloader cache


    0-5: set trace level to <n>


    ----------------------------------------------------





    java.lang.NullPointerException: in is null


     at java.util.zip.ZipInputStream.<init>(Unknown Source)


     at chemaxon.struc.PeriodicSystem.a(Unknown Source)


     at chemaxon.struc.PeriodicSystem.<clinit>(Unknown Source)


     at chemaxon.marvin.sketch.swing.actions.template.AtomActionFactory.createActions(Unknown Source)


     at chemaxon.marvin.uif.builder.impl.action.ActionSet.a(Unknown Source)


     at chemaxon.marvin.uif.builder.impl.action.ActionSet.a(Unknown Source)


     at chemaxon.marvin.uif.builder.impl.action.ActionSet.installActions(Unknown Source)


     at chemaxon.marvin.uif.builder.DefaultModuleConfiguration.createLocalActions(Unknown Source)


     at chemaxon.marvin.uif.module.GUIModule.b(Unknown Source)


     at chemaxon.marvin.uif.module.GUIModule.bindComponent(Unknown Source)


     at chemaxon.marvin.sketch.swing.SketchPanel.molInit(Unknown Source)


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


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


     at JMSketch.a(Unknown Source)


     at JMSketch.a(Unknown Source)


     at JMSketch$1.run(Unknown Source)


     at java.awt.event.InvocationEvent.dispatch(Unknown Source)


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


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


     at java.awt.EventDispatchThread.pumpEventsForFilter(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)


    Invalid factory class class chemaxon.marvin.sketch.swing.actions.template.AtomActionFactory


    java.lang.NullPointerException


     at chemaxon.struc.PeriodicSystem.getElementCount(Unknown Source)


     at chemaxon.marvin.sketch.swing.actions.template.AtomActionFactory.createActions(Unknown Source)


     at chemaxon.marvin.uif.builder.impl.action.ActionSet.a(Unknown Source)


     at chemaxon.marvin.uif.builder.impl.action.ActionSet.a(Unknown Source)


     at chemaxon.marvin.uif.builder.impl.action.ActionSet.installActions(Unknown Source)


     at chemaxon.marvin.uif.builder.DefaultModuleConfiguration.createLocalActions(Unknown Source)


     at chemaxon.marvin.uif.module.GUIModule.b(Unknown Source)


     at chemaxon.marvin.uif.module.GUIModule.bindComponent(Unknown Source)


     at chemaxon.marvin.sketch.swing.SketchPanel.molInit(Unknown Source)


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


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


     at JMSketch.a(Unknown Source)


     at JMSketch.a(Unknown Source)


     at JMSketch$1.run(Unknown Source)


     at java.awt.event.InvocationEvent.dispatch(Unknown Source)


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


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


     at java.awt.EventDispatchThread.pumpEventsForFilter(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)


    Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException


     at chemaxon.struc.PeriodicSystem.getElementCount(Unknown Source)


     at chemaxon.marvin.sketch.swing.modules.PeriodicFrame.a(Unknown Source)


     at chemaxon.marvin.sketch.swing.modules.PeriodicFrame.init(Unknown Source)


     at chemaxon.marvin.sketch.swing.modules.PeriodicFrame.callback(Unknown Source)


     at chemaxon.marvin.sketch.swing.SketchPanel.d(Unknown Source)


     at chemaxon.marvin.sketch.swing.SketchPanel.setMoreVisible(Unknown Source)


     at chemaxon.marvin.sketch.swing.actions.ShowPeriodicSystemAction.actionPerformed(Unknown Source)


     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)


     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)


     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)


     at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source)


     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)


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


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


     at javax.swing.JComponent.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.Component.dispatchEvent(Unknown Source)


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


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


     at java.awt.EventDispatchThread.pumpEventsForFilter(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)


    Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException


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


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


     at chemaxon.marvin.sketch.swing.modules.PeriodicFrame.e(Unknown Source)


     at chemaxon.marvin.sketch.swing.modules.PeriodicFrame.callback(Unknown Source)


     at chemaxon.marvin.sketch.swing.SketchPanel.d(Unknown Source)


     at chemaxon.marvin.sketch.swing.SketchPanel.setMoreVisible(Unknown Source)


     at chemaxon.marvin.sketch.swing.actions.ShowPeriodicSystemAction.actionPerformed(Unknown Source)


     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)


     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)


     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)


     at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source)


     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)


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


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


     at javax.swing.JComponent.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.Component.dispatchEvent(Unknown Source)


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


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


     at java.awt.EventDispatchThread.pumpEventsForFilter(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)

    ChemAxon 7c2d26e5cf

    02-02-2009 23:38:10

    Since "chemaxon/elements.zip" is not accessible for the applet, Java throw an exception.





    Marvin uses the getResourceAsStream(String) of PeriodicSystem class (that inherited this method from Class) to load the file. Normally, it should return with a reference to the given file (if the file is on the right place). We tested its behaviour on several platform (applet, beans, web start) but we have not found any issue.





    If elements.zip is on the right place, it means that you have a special environment/configuration (with a non-standard Class loader) where getResourceAsStream give incorrect (null) result.





    We would be very appreciate if you share any info about your environment (e.g. classpath, web server settings, browser version) that helps to understand the strange behaviour your class loader.





    I can imagine that the classpath settings influence the evaluation of getResourceAsStream in this case.





    Probably, giving the "codebase" attribute of the "" tag can help. Codebase is important in most cases to determine the exact location of a resource. I can imagine that in some implementation its lack can cause problem.