0

我们正在使用 Webmethods 8.2,我们正在尝试从 linux 机器上设置 SQL 服务器上的初始数据库。命令格式为,

./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

我们收到以下错误。有人可以破译我们的错误是什么。我们感谢我们能得到的任何帮助。谢谢!

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]

这是我的 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 "$@"

还有这个文件调用的 setEnv.sh,

    #!/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
4

4 回答 4

2

当 Java 虚拟机无法在运行时找到在编译期间可用的特定类时,Java 中的NoClassDefFoundError就会出现。

在您的特定情况下,JAVA 找不到 xml-apis.jar,像这样将它添加到 setEnv.sh(找到路径并编辑)

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

于 2013-07-23T19:09:11.810 回答
0
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

大概您的类路径错过了一些库org/w3c/dom/ElementTraversal

于 2013-07-23T15:12:49.673 回答
0

根据一篇帖子,他们遇到了这个问题:

我在尝试使用 2.0.2 版时遇到了问题,但是当我恢复到 1.4.01 版时发现一切都恢复正常了。

如果您使用的是 Maven:

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

如果您根本没有,您也可以下载必要的库:

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

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

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

于 2013-07-23T16:02:23.393 回答
0

首先,您需要确定您是在处理缺失的课程,还是某个课程的缺失课程:

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

你有一个java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal,所以你正在处理一个缺失的类(一个更简单的场景)。您需要查看 JAR 通常包含什么org.w3c.dom.ElementTraversal。我喜欢使用http://search.maven.org/,即使你不使用 Maven,只是因为它是常用 Java 库的综合索引。要搜索类,请使用fc:org.w3c.dom.ElementTraversal

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

您会发现 1.401 版本xml-apis等等。搜索结果中的任何常见 JAR 似乎都不在您的 CLASSPATH 中,$DCI_HOME/../lib/ext/sl53例如,除非它们位于 . #runJava您可以通过在like之后输入一行echo $CLASSPATH并查找上面搜索结果中列出的任何 JAR 来验证这一点。

如果它们不在那里,您需要将 JAR 放在盒子上的某个位置并编辑 setEnv.sh 以包含它(除非您可以将它放在$DCI_HOME/../lib/ext/sl53它会自动拾取的位置)。

于 2013-07-23T16:55:51.217 回答