如何使用远程jboss容器从Log4J使用/部署Logger?

时间:2012-04-23 14:09:03

标签: log4j jboss7.x jboss-arquillian

我正在查看教程http://arquillian.org/guides/getting_started/。一切都运行良好。但是,如果我尝试使用log4j.xml(放置在src / main / resources中)从Log4J添加Logger,则只有嵌入式容器焊接和glassfish可以通过控制台log-appender运行。在控制台上我得到了我的信息:

2012-04-23T15:27:21,859 INFO  call greet (ejbtest.Greeter)

远程jboss失败。 我的部署:

  @Deployment
  public static JavaArchive createDeployment()
  {
    final JavaArchive deployment = ShrinkWrap.create(JavaArchive.class)
        .addClasses(Greeter.class, PhraseBuilder.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").addAsResource("log4j.xml");
    return deployment;
  }

stacktrace-snippet:

    15:33:11,375 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC0000
1: Failed to start service jboss.deployment.unit."a680b2b8-2dd6-4b0b-bc87-9082f2
4fc88d.jar".WeldService: org.jboss.msc.service.StartException in service jboss.d
eployment.unit."a680b2b8-2dd6-4b0b-bc87-9082f24fc88d.jar".WeldService: org.jboss
.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for t
ype [Greeter] with qualifiers [@Default] at injection point [[field] 

我也试过将Logger.class添加到JavaArchive中,但是这也失败了以下的stacktrace-snippet:

15:36:50,031 WARN  [org.jboss.modules] (MSC service thread 1-3) Failed to define
 class org.apache.log4j.Logger in Module "deployment.eb8033fe-29d7-4fa5-986f-303
4a1949020.jar:main" from Service Module Loader: java.lang.LinkageError: Failed t
o link org/apache/log4j/Logger (Module "deployment.eb8033fe-29d7-4fa5-986f-3034a
1949020.jar:main" from Service Module Loader)

我的错误是什么?

1 个答案:

答案 0 :(得分:0)

JBoss已经在log4j中构建了它。我想你有冲突。