[jira] [Commented] (QPID-7824) ClassCastException on Broker class line 147

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (QPID-7824) ClassCastException on Broker class line 147

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/QPID-7824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16050675#comment-16050675 ]

Rob Godfrey commented on QPID-7824:

The Broker in the 6.x release is not really designed to be embedded.  Even if you fixed those lines there are likely other parts of the code where you will eventually run up against the fact the Broker simply assumes it is using logback as the logging provider.

On master (and thus in the forthcoming 7.0 release) the behaviour has already changed so that you can embed the broker class (though you'll want to change the default configuration so it doesn't try to instantiate the logback specific support for viewing / configuring the logging).  

> ClassCastException on Broker class line 147
> -------------------------------------------
>                 Key: QPID-7824
>                 URL: https://issues.apache.org/jira/browse/QPID-7824
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: qpid-java-6.1.1, qpid-java-6.1.2, qpid-java-6.1.3
>         Environment: - Java 8
> - Scala 2.11.8
>            Reporter: Gabriel Volpe
>             Fix For: qpid-java-6.1.1, qpid-java-6.1.2, qpid-java-6.1.3
> Explicit class casting makes integration with other libraries impossible. I've been trying to get a workaround but it seems I cannot do anything. The problem is in the Qpid library. Specifically Broker class line #147. Here's the full stack trace:
> {code:java}
> [info] Exception encountered when attempting to run a suite with class name: com.github.gvolpe.fs2rabbit.Fs2RabbitSpec *** ABORTED ***
> [info]   java.lang.ClassCastException: org.slf4j.helpers.SubstituteLogger cannot be cast to ch.qos.logback.classic.Logger
> [info]   at org.apache.qpid.server.Broker$1.run(Broker.java:147)
> [info]   at java.security.AccessController.doPrivileged(Native Method)
> [info]   at javax.security.auth.Subject.doAs(Subject.java:422)
> [info]   at org.apache.qpid.server.Broker.startup(Broker.java:142)
> [info]   at com.github.gvolpe.fs2rabbit.embedded.EmbeddedAmqpBroker$.start(EmbeddedAmqpBroker.scala:16)
> [info]   at com.github.gvolpe.fs2rabbit.Fs2RabbitSpec.beforeAll(Fs2RabbitSpec.scala:19)
> [info]   at org.scalatest.BeforeAndAfterAll$class.beforeAll(BeforeAndAfterAll.scala:187)
> [info]   at com.github.gvolpe.fs2rabbit.Fs2RabbitSpec.beforeAll(Fs2RabbitSpec.scala:14)
> [info]   at org.scalatest.BeforeAndAfterAll$class.run(BeforeAndAfterAll.scala:253)
> [info]   at com.github.gvolpe.fs2rabbit.Fs2RabbitSpec.run(Fs2RabbitSpec.scala:14)
> {code}
> The simple solution would be to avoid the unnecessary casting. Now this is happening on line 147:
> {code:java}
> ch.qos.logback.classic.Logger logger =
>                         (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
> {code}
> Simple fix:
> {code:java}
> org.slf4j.Logger logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
> {code}

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]