Problem with TypedActor proxy
Hi everyone, I'm current facing an IllegalArgumentException related to org.codehaus.backport175 (see below) during execution of my Akka Boot class in an integration test. The error, however, appears to have no impact on the test functionality?! There's no problem when using untyped actors only... I'm using Akka 1.0-M1, JUnit 4.5, and Specs 1.6.5 The exception trace is shown only once per Akka launch - during creation of the first TypedActor (regardless of actor creation order). My test setup may appear a bit odd, as I was trying to reproduce the production setup. The integration test launches a jetty instance with the WAR file (see code below). I haven't been able to reproduce the exception outside the integration tests, so maybe this problem is related to how I start Akka/Jetty!?. I'm happy about any hints and ideas. Thanks! -Tom Test Code ------------------------------ trait JettySupport { protected val jettyServer = new Server(8080) protected val webappContext = new WebAppContext def startJetty = { webappContext.setContextPath("/") webappContext.setWar("integration/target/scala_2.8.0/web.war") jettyServer.setHandler(webappContext) jettyServer.start } def stopJetty = jettyServer.stop } class ChargerSimulatorRestEndpointTest extends Specification with JettySupport { "Doing this" should { doBefore(startJetty) doAfter(stopJetty) "result in that" in { ... } } } Akka Boot ------------------------------ trait Hello object HelloImpl { var count: Int = 1 } class HelloImpl extends TypedActor with Hello with Logging { log info ("Hello " + HelloImpl.count) HelloImpl.count += 1 } class Boot extends Logging with ConfigSupport { TypedActor.newInstance[Hello](classOf[Hello], classOf[HelloImpl], 5000) TypedActor.newInstance[Hello](classOf[Hello], classOf[HelloImpl], 5000) ... } Exception ------------------------------ [INFO] [2010-11-25 14:32:23,982] [Thread-48] s.s.a.s.AkkaLoader: Running version 1.0-M1 [INFO] [2010-11-25 14:32:23,997] [Thread-48] s.s.a.s.AkkaLoader: ================================================== [INFO] [2010-11-25 14:32:23,997] [Thread-48] s.s.a.s.AkkaLoader: Starting Akka... [INFO] [2010-11-25 14:32:23,997] [Thread-48] s.s.a.s.Initializer$$anon $1: Creating /deploy class-loader [INFO] [2010-11-25 14:32:23,997] [Thread-48] s.s.a.s.Initializer$$anon $1: Loading boot class [com.tom.akka.Boot] [INFO] [2010-11-25 14:32:24,091] [Thread-48] c.t.a.HelloImpl: Hello 1 java.lang.IllegalArgumentException: interface org.codehaus.backport175.reader.Annotation is not visible from class loader at java.lang.reflect.Proxy.getProxyClass(Unknown Source) at java.lang.reflect.Proxy.newProxyInstance(Unknown Source) at org.codehaus.backport175.reader.proxy.ProxyFactory.newAnnotationProxy(ProxyFactory.java: 43) at org.codehaus.backport175.reader.bytecode.AnnotationReader.getAnnotation(AnnotationReader.java: 283) at org.codehaus.aspectwerkz.annotation.AsmAnnotations.getAnnotation(AsmAnnotations.java: 36) at org.codehaus.aspectwerkz.annotation.AspectAnnotationParser.doParse(AspectAnnotationParser.java: 71) at org.codehaus.aspectwerkz.annotation.AspectAnnotationParser.parse(AspectAnnotationParser.java: 56) at org.codehaus.aspectwerkz.definition.DocumentParser.parseAspectElements(DocumentParser.java: 441) at org.codehaus.aspectwerkz.definition.DocumentParser.parsePackageElements(DocumentParser.java: 353) at org.codehaus.aspectwerkz.definition.DocumentParser.parseSystemElement(DocumentParser.java: 238) at org.codehaus.aspectwerkz.definition.DocumentParser.parseSystemElements(DocumentParser.java: 181) at org.codehaus.aspectwerkz.definition.DocumentParser.parse(DocumentParser.java: 168) at org.codehaus.aspectwerkz.definition.XmlParser.parseNoCache(XmlParser.java: 178) at org.codehaus.aspectwerkz.definition.SystemDefinitionContainer.registerClassLoader(SystemDefinitionContainer.java: 140) at org.codehaus.aspectwerkz.definition.SystemDefinitionContainer.registerClassLoader(SystemDefinitionContainer.java: 105) at org.codehaus.aspectwerkz.definition.SystemDefinitionContainer.getHierarchicalDefinitionsFor(SystemDefinitionContainer.java: 319) at org.codehaus.aspectwerkz.definition.SystemDefinitionContainer.getDefinitionsFor(SystemDefinitionContainer.java: 227) at org.codehaus.aspectwerkz.transform.inlining.ContextImpl.<init>(ContextImpl.java: 99) at org.codehaus.aspectwerkz.transform.inlining.InliningWeavingStrategy.newContext(InliningWeavingStrategy.java: 258) at org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor._preProcess(AspectWerkzPreProcessor.java: 168) at org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor.preProcess(AspectWerkzPreProcessor.java: 150) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java: 107) at org.codehaus.aspectwerkz.proxy.ProxyDelegationStrategy.getNewProxyClassFor(ProxyDelegationStrategy.java: 131) at org.codehaus.aspectwerkz.proxy.ProxyDelegationStrategy.getProxyClassFor(ProxyDelegationStrategy.java: 58) at org.codehaus.aspectwerkz.proxy.ProxyDelegationStrategy.newInstance(ProxyDelegationStrategy.java: 80) at org.codehaus.aspectwerkz.proxy.Proxy.newInstance(Proxy.java: 137) at se.scalablesolutions.akka.actor.TypedActor $.newInstance(TypedActor.scala:524) at se.scalablesolutions.akka.actor.TypedActor
Leave a comment
I think the problem is that the WebAppContext probably uses it's own classloader, and it doesn't delegate properly in respect with jars already loaded. We have changed how we handle classloaders wince M1, so you might want to re-check this issue.
Reopen ticket if still unresolved.
Reopen ticket if still unresolved.