User e34a92cce5
09-10-2006 23:08:03
Hello,
I have been looking at the JSP file in the JChem/Marvinbeans package to generate a structural image instead of a regular web applet. Under marvinbeans/examples/image-generation, there are a couple of examples with a SMILES string and format as input parameters into a form and the image is supposed to be displayed in the generate_image.jsp file. For some reasons, on my web server , though the SMILES string and format are being passed fine into the JSP file, the file does not display anything. The HTML source code on the page is empty.
In the generate_image.jsp file, up until the format conversion, everything seems to be working fine. After mol.toBinFormat(format) there is no output being registered in the OutputStream.
Any hints on why this might be happening?
Thanks!
ChemAxon 7c2d26e5cf
10-10-2006 11:07:49
User e34a92cce5
10-10-2006 19:08:55
Hi Tamas,
I did run the classpath command, but nothing seems to have changed
Code: |
java -classpath /path/to/Tomcat/WEB-INF/lib/MarvinBeans.jar -Djava.awt.headless=true |
When I run it though, the system just refers to me for the correct usage:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-server ...................
When I run it with chemaxon.formats.MolConverter, it just prints out the MolConverter options.
ChemAxon 7c2d26e5cf
10-10-2006 19:37:06
Because you have missed the class to execute from the command line.
You should type this (in one line):
Code: |
java -classpath /path/to/Tomcat/WEB-INF/lib/MarvinBeans.jar -Djava.awt.headless=true chemaxon.formats.MolConverter jpeg mystructure.mol |
Check also if all files from the marvinbeans/lib are copied in the .../WEB-INF/lib directory. (MarvinBeans.jar uses a couple of external jars and resources, like batik-core.jar for SVG export.)
User e34a92cce5
10-10-2006 20:36:39
I do have the other .jar files in the Tomcat web directory. I am not sure, I understand the rationale behind specifying mystructure.mol in the command line. I am looking to provide a SMILES string and a format type from the database and generate an image on my webpage based on that, by giving those paramaters to generate_image.jsp. I tried runnig the command line without specifying any structure and it looks like the MolConvert app is looking for a filename. SO I specified the caffeine.smi in the image-generation example folder. But it still fails to render the image on the webpage
ChemAxon 7c2d26e5cf
10-10-2006 20:49:49
Yes, my example was not exact.
So:
Code: |
java -classpath /path/to/Tomcat/WEB-INF/lib/MarvinBeans.jar -Djava.awt.headless=true chemaxon.formats.MolConverter jpeg mystructure.mol -o mystructure.jpeg |
It is not clear for me how you would like convert mols to images.
If you would like to do it from command line, see the above example. (It converts only one structure.)
If you would like to call it from API (in a JSP), you should use the chemaxon.formats.MolConverter API or the chemaxon.struc.Molecule.toBinFormat(String) method and set headless parameter in Tomcat Java's. Consult with Tomcat manual howto pass parameter to its Java VM.
User e34a92cce5
10-10-2006 21:12:54
I am wanting to do the latter(use web APIs). That's why I gave you the generate_image.jsp example from your website. In the source code(generate_image.jsp), you do include the relevant APIs, but without having any setting for JVM, the example seems to work fine on your web server. I am not certain on what should I include in the $TOMCAT_OPTS value to make this work. Can you let me know what options you changed on your tomcat server to make it work for you
ChemAxon 9c0afc9aaf
11-10-2006 04:59:05
Hi,
As far as I know you should use CATALINA_OPTS, not TOMCAT_OPTS (though this may depend on the Tomcat version)
We also have a short guide for Tomcat, although it may not cover the latest versions :
http://www.chemaxon.com/jchem/doc/admin/tomcat.html
I suggest contacting the Tomcat documentation for more details.
By looking at the command-line example of Tamas above it seems obvious that the required setting is
Code: |
-Djava.awt.headless=true |
Best regards,
Szilard
User e34a92cce5
11-10-2006 16:33:02
I exported the $CATALINA_OPTS = -Djava.awt.headless=true
variable and restarted the server. Nothing seems to have changed. I also tried using System.setProperty("java.awt.headless", "true") and still no image is being generated. Clearly, I am missing something simple that is giving me this trouble.
I'd appreciate if you can help me with some troubleshooting measures
Thanks!
ChemAxon 7c2d26e5cf
11-10-2006 20:17:31
Which format do you use in in Molecule.toBinFormat(String)? Are you sure that mol.toBinFormat returns with an empty byte array?
User e34a92cce5
12-10-2006 16:14:39
I am using the JPEG (jpeg:w200,h200,#ffffff) format. I do not really know whether the byte[] array is null, since the screen does not output anything at all after the mol.toBinFormat() line.
ChemAxon 7c2d26e5cf
21-10-2006 12:44:04
I suggest to check firstly the returning value of the toBinFormat method. Probably, you can write the output array size into the output html to check its state. Or try to save output into a file and check whether it is a valid image.
If yes, the problem may be in the jsp generated output streams' header.