XSLT 传输失败,因为 Weblogic 找不到位于 rt.jar 中的类

发布于 2024-08-24 13:35:20 字数 1503 浏览 8 评论 0原文

我们在 Weblogic 10.3 上运行的 Web 应用程序遇到了一个非常奇怪的类未找到问题。在我们的代码中,我们进行了相当标准的 XSLT 转换。

UtilRequestManagerBean.java:

TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(new StringReader(xslBuffer.toString())));            
transformer.transform(new StreamSource(new StringReader(sourceBuffer.toString())), new StreamResult(sw));

这在我们的生产环境(Solaris 10,如果这很重要)中会失败,并产生 java.lang.NoClassDefFoundError:

<Mar 11, 2010 1:44:08 PM EET> <Info> <EJB> <BEA-010227> <EJB Exception occurred during invocation from home or business: com.company.basicservice.ejb.util.UtilRequestManagerBean_temuyq_HomeImpl@1737be7 threw exception: java.lang.NoClassDefFoundError: Could not initialize class com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary>

该类是 rt.jar 的一部分,并且肯定位于类路径中。下面的 Weblogic 日志片段验证了这一点:

sun.boot.class.path = /opt/jdk1.6.0_12/jre/lib/resources.jar:/opt/jdk1.6.0_12/jre/lib/rt.jar:/opt/jdk1.6.0_12/jre/lib/sunrsasign.jar:/opt/jdk1.6.0_12/jre/lib/jsse.jar:/opt/jdk1.6.0_12/jre/lib/jce.jar:/opt/jdk1.6.0_12/jre/lib/charsets.jar:/opt/jdk1.6.0_12/jre/classes

最后列出 rt.jar 的内容表明该类存在:

jar tvf /opt/jdk1.6.0_12/jre/lib/rt.jar | grep BasisLibrary.class
24787 Sat Jan 17 02:25:58 EET 2009 com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.class

那么,这里到底是什么问题呢?

We have encountered a very strange class not found problem in our web app running on Weblogic 10.3. In our code we do a pretty standard XSLT transformation.

UtilRequestManagerBean.java:

TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(new StringReader(xslBuffer.toString())));            
transformer.transform(new StreamSource(new StringReader(sourceBuffer.toString())), new StreamResult(sw));

This fails in our production environment (Solaris 10, if that matters) and produces a java.lang.NoClassDefFoundError:

<Mar 11, 2010 1:44:08 PM EET> <Info> <EJB> <BEA-010227> <EJB Exception occurred during invocation from home or business: com.company.basicservice.ejb.util.UtilRequestManagerBean_temuyq_HomeImpl@1737be7 threw exception: java.lang.NoClassDefFoundError: Could not initialize class com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary>

This class is part of rt.jar and is definitely in classpath. This is verified by the following Weblogic log snippet:

sun.boot.class.path = /opt/jdk1.6.0_12/jre/lib/resources.jar:/opt/jdk1.6.0_12/jre/lib/rt.jar:/opt/jdk1.6.0_12/jre/lib/sunrsasign.jar:/opt/jdk1.6.0_12/jre/lib/jsse.jar:/opt/jdk1.6.0_12/jre/lib/jce.jar:/opt/jdk1.6.0_12/jre/lib/charsets.jar:/opt/jdk1.6.0_12/jre/classes

And finally listing the contents of rt.jar shows that the class is there:

jar tvf /opt/jdk1.6.0_12/jre/lib/rt.jar | grep BasisLibrary.class
24787 Sat Jan 17 02:25:58 EET 2009 com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.class

So, what on earth could be the problem here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只为一人 2024-08-31 13:35:20

NoClassDefFoundError 并不一定意味着未找到该类 - 它意味着未加载该类的正确版本

最有可能加载该类的多个版本。您能否检查是否存在冲突源 - 例如某些类也捆绑在 weblogic.jar 中。

检查此包 org/apache/xalan/internal/xsltc/runtime/BasisLibrary 或 BasisLibrary 类本身 - 它是否存在?

或者尝试将 rt.jar 作为类路径中的第一个 jar

NoClassDefFoundError does not necessarily mean the Class was not found - it means the correct version of the class was not loaded.

Most likely multiple versions of the class getting loaded. Can you check if there is a source of conflict - example some classes are bundled in weblogic.jar as well.

Check for this package org/apache/xalan/internal/xsltc/runtime/BasisLibrary or the BasisLibrary class itself - is it present ?

Or try by putting rt.jar as the first jar in the classpath

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文