JRuby/Nokogiri 在 Mule ESB 3 中找不到 Java XML 库

发布于 2024-11-25 16:53:16 字数 1977 浏览 1 评论 0原文

我在让 JRuby gem Nokogiri 工作时遇到了麻烦。它适用于吉尔布。我在 Mac OS X Lion 上运行 Java 6。 JRuby 是 1.6.3。

你知道如何解决这个问题吗?堆栈跟踪:

INFO  2011-07-22 19:12:53,520 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.DeploymentService: 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'muleesb3-1.0-SNAPSHOT'                 +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

java.lang.NoSuchMethodError: javax.xml.parsers.DocumentBuilderFactory.newInstance(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/parsers/DocumentBuilderFactory;
    at nokogiri.XmlDocument.createNewDocument(XmlDocument.java:220)
    at nokogiri.XmlDocument.<init>(XmlDocument.java:96)
    at nokogiri.HtmlDocument.<init>(HtmlDocument.java:57)
    at nokogiri.NokogiriService$2.allocate(NokogiriService.java:239)
    at nokogiri.internals.HtmlDomParserContext.wrapDocument(HtmlDomParserContext.java:121)
    at nokogiri.internals.XmlDomParserContext.parse(XmlDomParserContext.java:209)
    at nokogiri.HtmlDocument.do_parse(HtmlDocument.java:89)
    at nokogiri.HtmlDocument.read_memory(HtmlDocument.java:117)
    at nokogiri.HtmlDocument$s$0$0$read_memory.call(HtmlDocument$s$0$0$read_memory.gen:65535)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:71)
    at org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:120)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:272)
    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:80)

I've having troubles getting the JRuby gem Nokogiri to work. It works in jirb. I'm running Java 6 on Mac OS X Lion. JRuby is 1.6.3.

Do you know how to solve this? Stacktrace:

INFO  2011-07-22 19:12:53,520 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.DeploymentService: 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'muleesb3-1.0-SNAPSHOT'                 +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

java.lang.NoSuchMethodError: javax.xml.parsers.DocumentBuilderFactory.newInstance(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/parsers/DocumentBuilderFactory;
    at nokogiri.XmlDocument.createNewDocument(XmlDocument.java:220)
    at nokogiri.XmlDocument.<init>(XmlDocument.java:96)
    at nokogiri.HtmlDocument.<init>(HtmlDocument.java:57)
    at nokogiri.NokogiriService$2.allocate(NokogiriService.java:239)
    at nokogiri.internals.HtmlDomParserContext.wrapDocument(HtmlDomParserContext.java:121)
    at nokogiri.internals.XmlDomParserContext.parse(XmlDomParserContext.java:209)
    at nokogiri.HtmlDocument.do_parse(HtmlDocument.java:89)
    at nokogiri.HtmlDocument.read_memory(HtmlDocument.java:117)
    at nokogiri.HtmlDocument$s$0$0$read_memory.call(HtmlDocument$s$0$0$read_memory.gen:65535)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:71)
    at org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:120)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:272)
    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:80)

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

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

发布评论

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

评论(1

云胡 2024-12-02 16:53:16

DocumentBuilderFactory.newInstance(String, ClassLoader) 是 Java 6 中的一个新方法。听起来你还有另一个 jar包含此类的旧版本的类路径。您可以在 jarfinder.com。如果您能够在 Eclipse 中查看项目,则可以使用“打开类型”对话框检查哪些 jar 包含 DocumentBuilderFactory 类。

DocumentBuilderFactory.newInstance(String, ClassLoader) is a new method in Java 6. It sounds like you have another jar in your classpath that contains an older version of this class. You can see a potential list of jars that might contain the class at jarfinder.com. If you're able to view your project in Eclipse, you could check what jars contain the DocumentBuilderFactory class by using the 'Open Type' dialog.

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