1

我按照本文档的说明进行操作,但它不起作用。

http://asciidoctor.org/docs/asciidoctorj/#running-asciidoctorj-on-wildfly-as

首先,我使用 jboss-cli 将 Asciidoctorj 模块安装到 WildFly 中:

module add \
 --name=org.asciidoctor \
 --resources=/tmp/asciidoctorj-1.5.2.jar,/tmp/jcommander-1.35.jar,/tmp/jruby-complete-1.7.16.1.jar \
 --resource-delimiter=, \
 --dependencies=javax.management.j2ee.api,javax.api

然后我部署了一个简单的 WAR,其中包含一个调用Asciidoctor.Factory.create(). 我也检查了它肯定包含Dependencies: org.asciidoctor在里面MANIFEST.MF整个项目都可以在我的 GitHub 存储库中找到

但它不起作用。怎么了?有没有人让 Asciidoctorj 在 WildFly 上工作?

我的环境是:

  • WildFly 8.2.0.Final
  • Asciidoctorj 1.5.2
  • 甲骨文JDK8u20

这是堆栈跟踪:

2015-01-12 23:23:06,764 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /asciidoctortest-1.0-SNAPSHOT/: java.lang.NoClassDefFoundError: Could not initialize class org.asciidoctor.internal.JRubyAsciidoctor
        at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:647) [asciidoctorj-1.5.2.jar:1.5.2]
        at asciidoctortest.MyServlet.doGet(MyServlet.java:17) [classes:]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_20]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_20]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]
4

2 回答 2

2

我错过了前面的堆栈跟踪,并从中找到了解决方案。似乎缺少一些依赖项。我也很奇怪java.lang.NoClassDefFoundError: sun/misc/Unsafe,但在这次谈话之后我也解决了。现在我的 module.xml 是:

<?xml version="1.0" ?>

<module xmlns="urn:jboss:module:1.1" name="org.asciidoctor">

    <resources>
        <resource-root path="asciidoctorj-1.5.2.jar"/>
        <resource-root path="jcommander-1.35.jar"/>
        <resource-root path="jruby-complete-1.7.16.1.jar"/>
    </resources>

    <dependencies>
        <module name="sun.jdk" export="true" >
            <imports>
                <include path="sun/misc/Unsafe" />
            </imports>
        </module>
        <module name="javax.management.j2ee.api"/>
        <module name="javax.api"/>
        <module name="org.slf4j"/>
    </dependencies>
</module>
于 2015-01-12T15:08:42.927 回答
0

我创建了一个名为 asciidoctor-wildfly-docker 的新 github 项目,以验证将 Asciidoctor 运行到 WildFly 所需的配置。该项目使您可以在 Docker 容器中执行测试并验证 Asciidoctor 是否可以将 AsciiDoc 内容转换为 HTML 和 PDF 输出。

我很想得到你的反馈: https ://github.com/mgreau/asciidoctor-wildfly-docker

马克西姆

于 2015-01-24T18:38:55.170 回答