Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6789661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:37:52+00:00 2026-05-26T17:37:52+00:00

I’m using Scala 2.9.1 I’ve defined a Logging trait as such: trait Logging {

  • 0

I’m using Scala 2.9.1

I’ve defined a Logging trait as such:

 trait Logging {
    def debug(msg: String, throwables: Throwable*) = ....
    ....
 }

And I have a JMSPublisher class which mixes-in the Logging trait:

 class JMSPublisher extends Publisher with Logging {
    def publishProducts(list: List[_ <: Product]) = ....
    def publish(list: Seq[Product]) = ....
 }

This all compiles fine. My issue is that I have a user who wants to load my JMSPublisher into Spring. He’s using Spring 2.5.6.

When the ApplicationContext is loaded during startup, the app crashes with an IllegalStateException, complaining that it can’t find a bridged-method related to my Logging trait.

Initialization of bean failed; nested exception is java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public void com.app.messaging.JmsPublisher.debug(java.lang.String, scala.collection.Seq)' 
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
    .....stack trace follows.......

This code worked under Scala-2.8, and I heard that Scala is marking trait that have some methods as bridged in 2.9. I think this is what is causing Spring to fail. I can’t upgrade to Scala-2.9 if my class can’t be loaded by Spring.

Has anyone run into this issue? Is there any fix or work-around?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:37:52+00:00Added an answer on May 26, 2026 at 5:37 pm

    We saw the same thing. I never figured out what change in Scala 2.9.x triggered this, but I think the real problem is with Spring itself.

    When you mix a trait into a class, the adds synthetic methods to in the class, marked in the byte code as bridge methods, that forward to the implementation of the method in the trait.

    Java also adds bridge methods to classes, when a sub-class overrides a method in a superclass or interface, but refines the return type. Because the return type is part of the method signature at the bytecode level, a forwarding method is needed so that clients who only know about the parent method signature can still call the method in the subclass. (More details: What Method.isBridge used for?)

    Spring inspects the bytecode for bridge methods for reasons described in the article A Bridge Too Far. The name of that article is ironic — Spring calls this "a perfect example of Spring solving the hard infrastructure problems that Java developers face and integrating them into the application stack", but it makes too many assumptions about the source of the bytecode, and worse, can’t be disabled.

    Short term workaround, is to avoid mixing traits into classes you use in Spring. You should lodge a bug with Spring to allow you to disable this check for non-Java bytecode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.