NoSuchMehodError in Reactor.setReaction()

User 870ab5b546

19-05-2009 01:21:49

I got this error while trying to run Reactor.setReaction().  It is new since we started using JChem 5.2.1.


java.lang.NoSuchMethodError: org.w3c.dom.Node.getTextContent()Ljava/lang/String;
at chemaxon.jep.EvaluatorConfiguration.getTextContentsOfNodes(EvaluatorConfiguration.java:636)
at chemaxon.jep.EvaluatorConfiguration.getFuntab(EvaluatorConfiguration.java:276)
at chemaxon.jep.Evaluator.compile(Evaluator.java:775)
at chemaxon.jep.Evaluator.compile(Evaluator.java:743)
at chemaxon.reaction.Reaction.setReactivityRule(Reaction.java:587)
at chemaxon.reaction.Reactor.createReactionObject(Reactor.java:1301)
at chemaxon.reaction.Reactor.createReactionObject(Reactor.java:1245)
at chemaxon.reaction.Reactor.createReactionObject(Reactor.java:1201)
at chemaxon.reaction.Reactor.setReaction(Reactor.java:1026)
at chemaxon.reaction.Reactor.setReaction(Reactor.java:1008)
at com.prenhall.epoch.synthesis.SingleReactionSolver.calcProducts(SingleReactionSolver.java:164)

I'm not even able to catch the error.  Any ideas?

ChemAxon e08c317633

19-05-2009 09:49:28

Bob, please update your Java Virtual Machine to 1.5 version or later.


Zsolt

User 870ab5b546

19-05-2009 12:19:16

We are already running Java 1.5.


[bob@epoch synthesis]$ java -version
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)


See this perhaps-relevant discussion: http://forums.sun.com/thread.jspa?threadID=699041 .


Have you included a new jar file in the JChem 5.2 installation, like you did with ojdbc5.jar?


Here is Rafi's two cents.


xerces.jar is part of jchem's lib package; it

contains org/w3c/dom/Node.class, and this class hasn't changed since

11/15/2001.



On the othe hand, chemaxon/jep/EvaluatorConfiguration is part of

jchem.jar, and this class changed on 4/24/2009.  It is almost certainly

a jchem bug.



User fa1369adab

19-05-2009 13:00:10

JChem provides 2 different versions of org.w3c.dom.Node. One is in batik-core.jar and is dated DEC-20-2001. The other is in xerces.jar and is dated NOV-15-2001. I bet we are getting the wrong one first. Which of these two jar files should we remove, or is there a better fix?

ChemAxon e08c317633

19-05-2009 13:21:44

Refoyl wrote:











JChem provides 2 different versions of org.w3c.dom.Node. One is in batik-core.jar and is dated DEC-20-2001. The other is in xerces.jar and is dated NOV-15-2001. I bet we are getting the wrong one first. Which of these two jar files should we remove, or is there a better fix?


Neither of these two jars are required by chemaxon.jep.EvaluatorConfiguration class. org.w3c.dom.Node is part of JDK, and it contains the org.w3c.dom.Node.getTextContent() method since Java 1.5.


Please post your


- operating system version
- content of your classpath (result of "echo $CLASSPATH")


It seems to be a classpath problem.


Zsolt

User fa1369adab

19-05-2009 14:06:38

uname -a
Linux epoch.chem.uky.edu 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux

echo $CLASSPATH
.:/usr/local/java/lib:/opt/oracle/product/9.2.0/jdbc/lib/ojdbc14.jar

/usr/local/java is a symlink to /usr/local/jdk1.5.0/

None of the jar files in /usr/local/java/lib contains org.w3c.dom.Node.
Likewise, ojdbc14.jar does not contain org.w3c.dom.Node.

User 870ab5b546

20-05-2009 13:36:40

Any insights here?  Reactor is completely inoperable until this problems is solved.


We did not have this problem until we upgraded to JChem 5.2.1 (from JChem 5.1.5).

ChemAxon e08c317633

20-05-2009 14:06:01










Refoyl wrote:
echo $CLASSPATH .:/usr/local/java/lib:/opt/oracle/product/9.2.0/jdbc/lib/ojdbc14.jar /usr/local/java is a symlink to /usr/local/jdk1.5.0/ None of the jar files in /usr/local/java/lib contains org.w3c.dom.Node. Likewise, ojdbc14.jar does not contain org.w3c.dom.Node.

/usr/local/java/jre/lib/rt.jar should contain org.w3c.dom.Node.


 


Please run the Evaluator command line tool:


evaluate -e "mass()" "CCCCC"


If the same exception is thrown as before, then try the following:


1. Delete batik-core.jar and xerces.jar, and run the reactor again. Let us know what happens.


2. Uninstall the JChem package, install MarvinBeans 5.2.1.1, run Evaluator again, and let us know the result.


Zsolt


 

User 870ab5b546

20-05-2009 14:08:50

Not exactly the same exception, but an exception nonetheless:


[bob@epoch bob]$ evaluate -e "mass()" "CCCCC"
Exception in thread "main" chemaxon.nfunk.jep.ParseException: chemaxon.jep.function.TotalCharge
at chemaxon.jep.EvaluatorConfiguration.getFuntab(EvaluatorConfiguration.java:297)
at chemaxon.jep.Evaluator.compile(Evaluator.java:779)
at chemaxon.jep.Evaluator.compile(Evaluator.java:743)
at chemaxon.jep.Evaluator.main(Evaluator.java:1047)
Caused by:
java.lang.ClassNotFoundException: chemaxon.jep.function.TotalCharge
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at chemaxon.jep.EvaluatorConfiguration.getFuntab(EvaluatorConfiguration.java:278)
at chemaxon.jep.Evaluator.compile(Evaluator.java:779)
at chemaxon.jep.Evaluator.compile(Evaluator.java:743)
at chemaxon.jep.Evaluator.main(Evaluator.java:1047)

After removing batik.jar and xerces.jar, the same exception.


One more bit of information: the problem is most definitely new to JChem 5.2.

[bob@epoch aceorg]$ ~aceorg/aceorg/jchem5.1.05/bin/evaluate -e "mass()" "CCCCC"
72.15

User 870ab5b546

20-05-2009 15:00:22

evaluate in MarvinBeans 5.2.1.1 works properly.


[bob@epoch aceorg]$ /tmp/new/bin/evaluate -e "mass()" "CCCCC" 
72.15

What now?

ChemAxon e08c317633

21-05-2009 11:48:57










bobgr wrote:

Not exactly the same exception, but an exception nonetheless:


[bob@epoch bob]$ evaluate -e "mass()" "CCCCC"
Exception in thread "main" chemaxon.nfunk.jep.ParseException: chemaxon.jep.function.TotalCharge
at chemaxon.jep.EvaluatorConfiguration.getFuntab(EvaluatorConfiguration.java:297)
at chemaxon.jep.Evaluator.compile(Evaluator.java:779)
at chemaxon.jep.Evaluator.compile(Evaluator.java:743)
at chemaxon.jep.Evaluator.main(Evaluator.java:1047)
Caused by:
java.lang.ClassNotFoundException: chemaxon.jep.function.TotalCharge
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at chemaxon.jep.EvaluatorConfiguration.getFuntab(EvaluatorConfiguration.java:278)
at chemaxon.jep.Evaluator.compile(Evaluator.java:779)
at chemaxon.jep.Evaluator.compile(Evaluator.java:743)
at chemaxon.jep.Evaluator.main(Evaluator.java:1047)

After removing batik.jar and xerces.jar, the same exception.


One more bit of information: the problem is most definitely new to JChem 5.2.


This exception indicates a completely different error.


As I know you define your own Chemical Terms functions (like dynamicpKa()) in the evaluator.xml config file (see the Default function definitions, plugin definitions and matching conditions section in the Evaluator manual). From Marvin/JChem 5.1.1 version the exaluator.xml files defined by the users should only contain the functions defined by the users, and not all of the functions. I think there is a


<Function ID="totalCharge" Class="chemaxon.jep.function.TotalCharge"/>


line in one of your evaluator.xml config files, and it is causing this (the second) error. Please remove your evaluator.xml files from the marvin/config, jchem/config and .chemaxon/MARVIN_MAJOR_VERSION/ directories (MARVIN_MAJOR_VERSION is the major version of Marvin, e.g. "5.1") and run the reactor and evaluator again (with removed batik-core.jar and xerces.jar).


 


Do you get the original exception only on epoch.chem.uky.edu?


Zsolt

User 870ab5b546

21-05-2009 16:16:26

After removing the configuration files from JChem 5.2.1:


[bob@epoch aceorg]$ bin/evaluate -e "mass()" "CCCCC"
72.15

This is with batik-core.jar and xerces.jar in OR out of the lib directory.  


However, I am still getting the NoSuchMethodError when I use the API, regardless of whether batik-core.jar and xerces.jar are in or out of the lib directory.


What next?

ChemAxon e08c317633

22-05-2009 10:24:10

bobgr wrote:












However, I am still getting the NoSuchMethodError when I use the API, regardless of whether batik-core.jar and xerces.jar are in or out of the lib directory.




Do you get the exception when you run Reactor GUI, or Reactor command line application?


Do you get the original exception only on epoch.chem.uky.edu?


Zsolt

User 870ab5b546

22-05-2009 12:32:09

I get it when I run the Reactor GUI.  


From the command line, it appears to work fine, even when using an MRV file as the reaction definition.  (I created the MRV file by converting your example RDF file to MRV.)


[bob@epoch bin]$ react -r "[Cl:4][C:3]=O.[#7:2][H:1]>>[#7:2][C:3]=O.[Cl:4][H:1]..r:charge(ratom(4)) > -1.2" "CCCC(Cl)=O" "NCCC1CCCCC1" -x 1
CCCC(=O)NCCC1CCCCC1

[bob@epoch bin]$ react -r ../examples/reactor/acid-halide+nucleophile.rdf "CCCC(Cl)=O" "NCCC1CCCCC1"     
Cl
CCCC(=O)NCCC1CCCCC1

[bob@epoch bin]$ react -r ../examples/reactor/acid-halide+nucleophile.mrv "CCCC(Cl)=O" "NCCC1CCCCC1"
Cl
CCCC(=O)NCCC1CCCCC1

	
	

User 870ab5b546

22-05-2009 12:34:30

Oh, and I don't know what you mean by do we get the exception only on epoch.chem.uky.edu.  We don't have any other server that runs ACE with JChem 5.2.1.  We did not get the error when we ran ACE with JChem 5.1.5 on epoch.chem.uky.edu.  The problem is not in ACE or Tomcat per se, it's in a clash between some part of JChem new to 5.2.1 and some part of ACE or Tomcat.

ChemAxon e08c317633

22-05-2009 13:51:49

Bob, please run your application from command line with java -verbose:class option.


Example:


$ java -verbose:class chemaxon.jep.Evaluator -e "logP()" "CCCCCC"
[Loaded java.lang.Object from shared objects file]
[Loaded java.io.Serializable from shared objects file]
[Loaded java.lang.Comparable from shared objects file]
[Loaded java.lang.CharSequence from shared objects file]
[Loaded java.lang.String from shared objects file]
...


It will display all java classes loaded by the JVM. My example runs the Evaluator class with its command line options. Maybe you have to modify your application before you can do this (add a main() method, etc.).


Filter the messages with grep:


$ java -verbose:class chemaxon.jep.Evaluator -e "logP()" "CCCCCC" | grep org.w3c.dom.Node
[Loaded org.w3c.dom.Node from shared objects file]
[Loaded org.w3c.dom.NodeList from shared objects file]


This will be a short list; loaded org.w3c.dom.Node* classes will be listed only.


Zsolt

User 870ab5b546

22-05-2009 14:29:03

From which directory do I run this application?  I tried it from jchem/bin and got this message:


[bob@epoch bin]$ java -verbose:class chemaxon.jep.Evaluator -e "logP()" "CCCCCC" | grep org.w3c.dom.Node
Exception in thread "main" java.lang.NoClassDefFoundError: chemaxon/jep/Evaluator


ChemAxon e08c317633

22-05-2009 14:34:58

From the directory where jchem.jar is located. It is jchem/lib.


Zsolt

User 870ab5b546

22-05-2009 14:46:40

Houston, we have a problem.


[bob@epoch jchem5.2.1]$ cd lib
[bob@epoch lib]$ java -verbose:class chemaxon.jep.Evaluator -e "logP()" "CCCCCC" | grep org.w3c.dom.Node
Exception in thread "main" java.lang.NoClassDefFoundError: chemaxon/jep/Evaluator
[bob@epoch lib]$ ls
aloe.jar inchi-native-macosx-ppc-1_1.jar
backport-util-concurrent.jar inchi-native-windows-1_1.jar
batik-core.jar izmcomjni.jar
castor-1.0.1-xml.jar izmcom-natives.jar
chart.jar izmcomtlb.jar
commons-lang-2.4.jar jar.properties
commons-logging-1.1.jar jchem.jar
db2jcc.jar jextexp.jar
dom4j.jar jh.jar
forms-1.1.0.jar jnbtools.jar
freehep-export-2.1.1.jar jogl_1.1.0-rc2
freehep-graphics2d-2.1.1.jar jogl.jar
freehep-graphicsio-2.1.1.jar looks-2.1.4.jar
freehep-graphicsio-emf-2.1.1.jar marvinOLEServer.exe
freehep-graphicsio-pdf-2.1.1.jar marvinOLEServer-native.jar
freehep-io-2.0.2.jar mysql-connector-java-5.1.6-bin.jar
freehep-swing-2.0.3.jar ojdbc5.jar
freehep-util-2.0.2.jar openide-lookup-1.9-patched-1.0.jar
gluegen-rt.jar postgresql-8.3-603.jdbc3.jar
hsqldb.jar sqljdbc.jar
inchi-native-linux-1_1.jar xerces.jar
inchi-native-macosx-1_1.jar
[bob@epoch lib]$


ChemAxon e08c317633

22-05-2009 14:52:35

jchem.jar has to be in the CLASSPATH, or should be specified with the -classpath option.


$ java -classpath jchem.jar -verbose:class chemaxon.jep.Evaluator -e "logP()" "CCCCCC" | grep org.w3c.dom.Node
[Loaded org.w3c.dom.Node from shared objects file]
[Loaded org.w3c.dom.NodeList from shared objects file]


Zsolt

User 870ab5b546

22-05-2009 15:03:46

I'm a Linux novice, so you have to spell these things out for me.


[bob@epoch lib]$ java -classpath jchem.jar -verbose:class chemaxon.jep.Evaluator -e "logP()" "CCCCCC" | grep org.w3c.dom.Node
[Loaded org.w3c.dom.Node from shared objects file]
[Loaded org.w3c.dom.NodeList from shared objects file]
[bob@epoch lib]$



I also did the one without the grep option at the end, and I got a ridiculously large amount of output.  Do you want to see it also?

ChemAxon e08c317633

22-05-2009 16:37:31

After our skype discussion I discussed this problem with one of my colleagues. He will send you the information how you can check the CLASSPATH used by your web application (this classpath is set by Tomcat), and will describe how Tomcat can be configured to log the loaded classes.


The browser thing will not work (I was wrong when I suggested this), web application runs on server.


Zsolt

ChemAxon e274e1bada

25-05-2009 13:25:08

Hi,


The Tomcat uses its own classloader and classpath to running a web application. In this case your system classpath will not be valid, you have to care about that your jar files are in the Tomcat's lib directory. The contents of the lib directory are got into the Tomcat's classpath automatically.


You can use two different lib directory; the fist one is a global for all web application (it is placed in <Tomcat home>/shared/lib in Tomcat 5.5. or <Tomcat home>/lib in Tomcat 6.0), the second one is relevant with the specified application. I recommend to take your library elements to the application's library (<Tomcat's root>/webapps/<appname>/WEB-INF/lib), elements in this directory will come before the global elements in the Tomcat's classpath.
I hope it can help you.


Regards, Evard

User fa1369adab

25-05-2009 14:38:48

Our version of Tomcat uses /common/lib as its directory from which to load classes. There are no jar files here that contain any w3c classes. The jar files are:

ant-launcher.jar jdbc2_0-stdext.jar@
ant.jar jsp-api.jar
aspectjrt.jar@ jta-spec1_0_1.jar@
aspectjtools.jar@ mysql-connector-java-3.1.8-bin-g.jar@
commons-collections-3.1.jar mysql-connector-java-3.1.8-bin.jar@
commons-dbcp-1.2.1.jar naming-common.jar
commons-el.jar naming-factory.jar
commons-fileupload-1.2.1.jar naming-java.jar
commons-pool-1.2.jar naming-resources.jar
gnu-regexp-1.1.4.jar ojdbc5.jar
jasper-compiler.jar servlet-api.jar
jasper-runtime.jar servlet.jar

Tomcat also picks up jar files from two WEB-INF library directories. The first contains

LewisSketch.jar@ bb-persistence-layer.jar@ dom4j.jar jchem.jar@

The second contains only jchem.jar@. The symlinks point to jchem5.2.1/lib.

None of these jar files contains w3c code. Only batik.jar and xerces.jar contain w3c code.

User 870ab5b546

25-05-2009 16:12:33

Does this discussion help?


http://www.velocityreviews.com/forums/t144510-problems-with-jboss-an-xerces.html


Or this comment from http://nicklothian.com/blog/index.php?s=string ?


Getting this error in Tomcat?
java.lang.NoSuchMethodError: org.w3c.dom.Node.getTextContent()Ljava/lang/String;
There’s a good chance you installed Tomcat with the JDK 1.4 Compatibility package and are now running under JDK 5.
To fix it, delete xercesImpl.jar, xml-apis.jar and xalan.jar from $CATALINA_HOME\common\endorsed\

ChemAxon e08c317633

25-05-2009 16:27:06

Yes, this helps. You should check your Tomcat installation.


Zsolt

User 870ab5b546

25-05-2009 16:36:58

What do you mean, "check your Tomcat installation"?  Please be more specific about what exactly we need to check.


And let me say this once more: We did not get any of these errors when we were running JChem 5.1.  These errors only started when we started running JChem 5.2.  All that changed in switching from JChem 5.1 to JChem 5.2 was moving a symlink to point to JChem 5.2 instead of JChem 5.1.  The unavoidable conclusion is that something new in JChem 5.2 is clashing with our installation.  It would be much appreciated if you tried to figure out what new feature in JChem 5.2 is clashing with our installation, instead of just trying to blame our installation for the problem.

ChemAxon e08c317633

25-05-2009 16:56:45

JChem 5.1 was Java 1.4.2 compatible, but JChem 5.2 requires Java 1.5 or later.


We try to help. Please check your Tomcat installation, because "There’s a good chance you installed Tomcat with the JDK 1.4 Compatibility package and are now running under JDK 5.". I'm not too familiar with Tomcat, so Edvard will get back to you and will help to diagnose Tomcat related issues.


Zsolt


 

User 870ab5b546

25-05-2009 17:27:16

I believe we did indeed install Tomcat under Java 1.4 and later upgraded to Java 1.5.


I found xercesImpl.jar and xml-apis.jar in tomcat5/common/endorsed/ .  I moved them into tomcat5/common/oldEndorsed/ .  But then I was unable to shut down Tomcat cleanly; I got this error:


java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:336)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427)
Caused by: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:113)
at org.apache.commons.digester.Digester.getFactory(Digester.java:512)
at org.apache.commons.digester.Digester.getParser(Digester.java:686)
at org.apache.commons.digester.Digester.getXMLReader(Digester.java:902)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:399)
... 6 more

I restored the two jar files to endorsed/ and was able to shut down.  I moved them back into oldEndorsed/ , but then I was unable to start up (same error).






 


 

User 870ab5b546

25-05-2009 18:08:17

I downloaded newer versions of xercesImpl.jar (2.9.0 instead of 2.6.2) and xml-apis.jar from www.java2s.com and placed them in common/endorsed.  I restarted Tomcat, and everything appears to work now.