0

We are using Webmethods 8.2 and we are trying to setup the initial databases on the SQL server from a linux box. The command format is,

./dbConfigurator.sh -a create -d sqlserver -c storage -v latest -l jdbc:wm:sqlserver://<sqlserverip>:1433;databaseName=DBNAME" -u DBUSER -p Passwd -au ADMIN -ap Passwd

We are getting the following error. Can someone decipher what the error is for us. We appreciate any help we can get. Thanks!

Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.startDocument(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at com.webmethods.common.cdbc.engine.definition.ComponentStore.initialize(ComponentStore.java:128)
    at com.webmethods.common.cdbc.engine.definition.ComponentStore.instance(ComponentStore.java:98)
    at com.webmethods.common.cdbc.engine.definition.DatabaseDefinitionManager.<init>(DatabaseDefinitionManager.java:42)
    at com.webmethods.common.cdbc.engine.definition.DatabaseDefinitionManager.instance(DatabaseDefinitionManager.java:49)
    at com.webmethods.common.cdbc.install.DatabaseComponentInstaller.isValidComponentName(DatabaseComponentInstaller.java:258)
    at com.webmethods.common.cdbc.install.DatabaseComponentInstaller.validateDCIParams(DatabaseComponentInstaller.java:1021)
    at com.webmethods.common.cdbc.install.DatabaseComponentInstaller.checkMissingArgsAndValidate(DatabaseComponentInstaller.java:148)
    at com.webmethods.common.cdbc.install.DatabaseComponentInstaller.execute(DatabaseComponentInstaller.java:341)
    at com.webmethods.common.cdbc.client.CommandLineClient.main(CommandLineClient.java:19)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 31 more[/code]

Here is my dbConfigurator.sh

#!/bin/sh
# set env for CDC

ENV_PATH=/opt/softwareag/DB/common/db/bin/setEnv.sh
export ENV_PATH
source=$ENV_PATH
. ./setEnv.sh

if [ -z "$JAVA_HOME" ]; then
echo "The environment variable JAVA_HOME must be set"
    echo "Can't run the database component installer."
    exit
fi

if [ -z "$CDBS_HOME" ]; then
    echo "The environment variable CDBS_HOME must be set."
    echo "Can't run the database component installer."
    exit
fi

if [ -z "$DCI_HOME" ]; then
    echo "The environment variable DCI_HOME must be set."
    echo "Can't run the database component installer."
    exit
fi

#runJava

RUN="$JAVA_HOME/bin/java"

$RUN $JAVA_OPTS com.webmethods.common.cdbc.client.CommandLineClient "$@"

Also setEnv.sh which this file calls,

    #!/bin/sh
# set env for CDC

JAVA_HOME=/opt/softwareag/DB/jvm/jvm160
DCI_HOME=/opt/softwareag/DB/common/db
CDBS_HOME=/opt/softwareag/DB/common/db

#exportStartHeap


DCI_START_HEAP="${DCI_START_HEAP:-10}";export DCI_START_HEAP

DCI_MAX_HEAP="${DCI_MAX_HEAP:-512}";export DCI_MAX_HEAP

#exportJavaOpts

JAVA_OPTS="$JAVA_OPTS -DCDBS.home.path=$CDBS_HOME"
JAVA_OPTS="$JAVA_OPTS -DDCI.home.path=$DCI_HOME"
JAVA_OPTS="$JAVA_OPTS -Dlog.dir=$DCI_HOME/logs"
JAVA_OPTS="$JAVA_OPTS  -DtermOutOn=true"
JAVA_OPTS="$JAVA_OPTS  -DspoolOn=true"

##==================To enable debug, change this property to 'DEBUG'==========
JAVA_OPTS="$JAVA_OPTS  -DlogLevel=INFO"
##============================================================================

JAVA_OPTS="$JAVA_OPTS  -Xms${DCI_START_HEAP}m"
JAVA_OPTS="$JAVA_OPTS  -Xmx${DCI_MAX_HEAP}m"
JAVA_OPTS="$JAVA_OPTS  -Xss256k"

export JAVA_OPTS

##exportClassPath
CLASSPATH="$CLASSPATH:$DCI_HOME"
CLASSPATH="$CLASSPATH:$DCI_HOME/lib/wm-cdc-client.jar"
for file in $DCI_HOME%/lib/wm-cdc-client_*
do
  CLASSPATH=${CLASSPATH}:$file
done
CLASSPATH="$CLASSPATH:$DCI_HOME/lib/CDC_PELP_ja_Messages-ALL-Any.jar"
CLASSPATH="$CLASSPATH:$DCI_HOME/lib/CDC_PELP_ar_Messages-ALL-Any.jar"
CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/wm-cdc-core.jar"
CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/ext/jargs.jar"
CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/wm-g11nutils.jar"
CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/ext/log4j.jar"
CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/ext/derby.jar"
CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/wm-caf-common.jar"
for file in $DCI_HOME/../lib/ext/sl53*
do
  CLASSPATH=${CLASSPATH}:$file
done
CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/ext/xercesImpl.jar"
CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar"
CLASSPATH="$CLASSPATH:$JAVA_HOME/jre/lib/charsets.jar"
export CLASSPATH
Lego
  • 191
  • 2
  • 10
  • A bit off-topic on SO. This should be on SU. – David Foerster Jul 23 '13 at 15:13
  • please post dbConfigurator.sh as well – Sergii Shevchyk Jul 23 '13 at 15:20
  • I just added dbConfigurator.sh and setEnv.sh that file calls. Thank you. – Lego Jul 23 '13 at 15:55
  • 1
    You need `xml-apis.jar` in your CLASSPATH – anubhava Jul 23 '13 at 15:56
  • Actually, the `java` command ran just fine. But you have some sort of muck-up in your classpath. Precisely what is hard to say, though -- NoClassDefFoundError is a terribly vague exception that can be raised in a number of different scenarios, with different basic causes. – Hot Licks Jul 23 '13 at 16:06
  • I have the xml-apis.jar file under /opt/softwareag/DB/common/lib/ext/xml-apis.jar. can this be manually added to the CLASSPATH or in my setEnv.sh file I put above? Thanks! – Lego Jul 23 '13 at 17:26

4 Answers4

2

NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time.

In your particular case JAVA cannot find xml-apis.jar, add it to setEnv.sh like this(find the path and edit)

CLASSPATH="$CLASSPATH:$DCI_HOME/../lib/xml-apis.jar"

Sergii Shevchyk
  • 38,716
  • 12
  • 50
  • 61
0
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

Presumably your classpath misses some library org/w3c/dom/ElementTraversal.

David Foerster
  • 1,461
  • 1
  • 14
  • 23
  • Thanks David. I'm not sure how to search for this class. Presumably the class path has to be added on the setEnv.sh file I just attached? – Lego Jul 23 '13 at 15:55
0

According to one post, they had this issue:

I had an issue when I tried using version 2.0.2, but found that when I reverted back to version 1.4.01 and everything worked again.

If you're using Maven:

<dependency> 
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>1.4.01</version> 
</dependency>

You can also download the necessary library if you simply don't have it:

http://www.jarfinder.com/index.php/java/info/org.w3c.dom.ElementTraversal

reference 1: Eclipse java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

reference 2: http://www.coderanch.com/t/534171/XML/org-dom-ElementTraversal

Community
  • 1
  • 1
Ted
  • 3,212
  • 25
  • 20
0

First you need to determine whether you're dealing with a missing class, or some class's missing class:

http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html

You've got a java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal, so you're dealing with a missing class (an easier scenario). You need to see what JAR typically contains org.w3c.dom.ElementTraversal. I like to use http://search.maven.org/, even if you're not using Maven, just because it's a comprehensive index of commonly available Java libraries. To search for a class, use fc:org.w3c.dom.ElementTraversal:

http://search.maven.org/#search%7Cga%7C1%7Cfc%3Aorg.w3c.dom.ElementTraversal

You'll find the 1.401 version of xml-apis among others. It does not seem like any of the common JARs in the search results are in your CLASSPATH, unless they're somewhere inside of $DCI_HOME/../lib/ext/sl53, for instance. You can verify this by putting in a line after #runJava like echo $CLASSPATH and look for any of the JARs listed in the search results above.

If they are not there, you need to put the JAR somewhere on the box and edit setEnv.sh to include it (unless you can put it in $DCI_HOME/../lib/ext/sl53 where it will get picked up automatically).

davidfmatheson
  • 3,539
  • 19
  • 27