我遵循了本文档的说明,但它没有用。
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()
的servlet。我确定在Dependencies: org.asciidoctor
中检查了它包含MANIFEST.MF
。 whole project is available in my GitHub repo
但它不起作用。怎么了?是否有人让Asciidoctorj在WildFly上工作?
我的环境是:
这里的堆栈跟踪:
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]
答案 0 :(得分:2)
我错过了之前的堆栈跟踪,我找到了一个解决方案。似乎缺少某些依赖项。我也很奇怪java.lang.NoClassDefFoundError: sun/misc/Unsafe
但我在this conversation之后也解决了它。现在我的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>
答案 1 :(得分:0)
我创建了一个名为asciidoctor-wildfly-docker的新github项目,以验证将Asciidoctor运行到WildFly所需的配置。 该项目使您可以在Docker容器中执行测试,并验证Asciidoctor可以将AsciiDoc内容转换为HTML和PDF输出。
我很乐意收到您的反馈意见: https://github.com/mgreau/asciidoctor-wildfly-docker
马克西姆