我正在尝试创建一个包含在Wildfly中的自定义记录器追加器
(使用jboss cli:/subsystem=logging/custom-handler=LOG4J_MY:add
和/subsystem=logging/root-logger=ROOT:root-logger-assign-handler(name=LOG4J_MY)
问题是记录器需要使用resteasy,似乎resteasy-jackson2-provider
不起作用,因为我在尝试发送json时遇到以下异常:
19:07:18,813 ERROR [stderr] (pool-1-thread-1) javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request
19:07:18,814 ERROR [stderr] (pool-1-thread-1) at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287)
19:07:18,814 ERROR [stderr] (pool-1-thread-1) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:436)
19:07:18,815 ERROR [stderr] (pool-1-thread-1) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:479)
19:07:18,815 ERROR [stderr] (pool-1-thread-1) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation$5.call(ClientInvocation.java:542)
19:07:18,815 ERROR [stderr] (pool-1-thread-1) at java.util.concurrent.FutureTask.run(FutureTask.java:266)
19:07:18,816 ERROR [stderr] (pool-1-thread-1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
19:07:18,816 ERROR [stderr] (pool-1-thread-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
19:07:18,816 ERROR [stderr] (pool-1-thread-1) at java.lang.Thread.run(Thread.java:745)
19:07:18,817 ERROR [stderr] (pool-1-thread-1) Caused by: javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/json type: my.MyJsonMessage
我在<wildfly>modules/.../module.xml
中定义了这样的appender:
<module xmlns="urn:jboss:module:1.1" name="my.appender">
<resources><resource-root path="my-appender-1.0.1.jar"/></resources>
<dependencies>
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.jboss.resteasy.resteasy-jaxrs" />
<module name="org.apache.log4j" />
<module name="javax.ws.rs.api" />
<module name="org.jboss.logmanager" />
</dependencies>
</module>
我正在运行Wildfly 10。