Obtaining image from a Molfile

User d68ef9d5a9

02-06-2011 14:49:22

Hi,


I am trying to get image from a molfile. Here is my codes;


 public static byte [] getStructureImage(String molfile, String format){
MolHandler mh=null;
try{
System.out.println("molfile="+molfile);
mh=new MolHandler(molfile);
System.out.println("molhandler established");
}catch(MolFormatException me){
return null;
}
Molecule mol=mh.getMolecule();
return mol.toBinFormat(format);
}


The error message is:


Jun 2, 2011 10:04:51 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/erms] threw exception [javax.servlet.ServletException: java.lang.NoClassDefFoundError: chemaxon/formats/MolFormatException] with root cause
java.lang.ClassNotFoundException: chemaxon.formats.MolFormatException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.jsp.jsp.structureImage_jsp._jspService(structureImage_jsp.java:119)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


 


I also attached my mol file.


Please advise!


Ben


 

ChemAxon 5433b8e56b

02-06-2011 15:44:09

I think, the marvinbeans.jar, and the files from the lib directory of marvinbeans package are not in the classpath of the used webcontainer, are they?

User d68ef9d5a9

13-06-2011 12:46:35

Would you please be more specific how I should deal with it? Do you mean MarvinBeans.jar and marvinbeans directory in JChem package should be copied to context (in may case erms)/WEB-INF/? I am confused.


I use Tomcat as my web server and the project called erms. I have chosen all the jars in JChem package as my library in Eclipse project.

User d68ef9d5a9

14-06-2011 18:56:24

Hi,


We figured it out. It was not marvinbeans.jar. The jchem.jar needs to be in classpath in tomcat. Once we add the jchem.jar, it worked.


Ben Li