[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=16050756#comment-16050756 ]

Alex Rudyy commented on QPID-7824:
----------------------------------

Hi Gabriel,

I would like to point out that module {{qpid-broker}}  depends on {{logback}} but module {{qpid-broker-core}} does not depend on it. Thus, you can try to embed {{qpid-broker-core}} into your application instead of {{qpid-broker}}. It is trickier and requires some boilerplate code, but possible. I described some of the approaches you can use to embed Qpid 6.1.x {{qpid-broker-core}} [in  QPID-7747|https://issues.apache.org/jira/secure/EditComment!default.jspa?id=13064341&commentId=15971267]. I attached some code samples there as well. Alternatively, you can embed 7.0.0-SNAPSHOT as suggested by Rob.

> 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
(v6.4.14#64029)

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