I am using Scala 2.9.1
I defined the Logging trait as such:
trait Logging { def debug(msg: String, throwables: Throwable*) = .... .... }
And I have a JMSPublisher class that mixes in the Logging dash:
class JMSPublisher extends Publisher with Logging { def publishProducts(list: List[_ <: Product]) = .... def publish(list: Seq[Product]) = .... }
All of this compiles perfectly. My problem is that I have a user who wants to load JMSPublisher in Spring. It uses Spring 2.5.6.
When the ApplicationContext loads during startup, the application crashes with an IllegalStateException, complaining that it cannot find the bridge method associated with my logging characteristic.
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 a sign of marking, which has some methods as a bridge in 2.9. I think this is what leads to Spring error. I cannot upgrade to Scala -2.9 if my class cannot be loaded by Spring.
Has anyone encountered this problem? Is there a fix or workaround?
source share