Community
Participate
Working Groups
We are running junit testcases through maven1. The Builder class startes up the Avalon Fortress container. Once that is weaved we get a java.io.IOException when trying to read the configuration file via ClassLoader.getResourceAsStream. Removing the pointcut on that very class seems solve the problem. Though it's not really understanable why. Attached you find o weaved Builder.class o non-weaved Builder.class o source code Builder.java and here is the stacktrace java.io.IOException: Bad file descriptor at java.io.FileInputStream.read(Native Method) at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.avalon.framework.configuration.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:254) at org.apache.avalon.framework.configuration.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:202) at container.Builder.createContainer_aroundBody0(Builder.java:28) at container.Builder.createContainer_aroundBody1$advice(Builder.java:191) at container.Builder.createContainer(Builder.java) at com.managesoft.distribution.AbstractComponentTestCase.setUpContainer(AbstractComponentTestCase.java:80) at com.managesoft.distribution.AbstractComponentTestCase.setUp(AbstractComponentTestCase.java:128) at junit.framework.TestCase.runBare(TestCase.java:125)
Created attachment 26187 [details] Builder.java
Created attachment 26188 [details] weaved Builder.class
Created attachment 26189 [details] not-weaved Builder.class
Thanks for reporting this bug, but I'm not sure I understand why this is a bug with AspectJ. I assume that without the pointcut (i.e., without the around advice) the file-load is not attempted (and that functionality is lost), so it makes sense that it wouldn't tickle this problem. There's an aspect (not provided in source?) which uses around advice to build something, and somewhere in the bowels the file descriptor is bad. I don't know from this where the file descriptor comes from, etc. It sounds like the aspect and the woven class is loading correctly, so the the AspectJ runtime classes are available. One option is to enable or disable around advice inlining and see if that makes a difference. Could you isolate this a bit more? Also, if anything it's a compiler bug.
Created attachment 26221 [details] aspect
Sorry for not being clear. The file load is always being attempted but only without the aspect it succeeds. With the aspect I get the exeception. For now I am using the commented out "within" expression so there are no pointcuts for that very class to make it work in my app. (In all the other classes the aspect seems to work just fine!) But to me this sounds really strange and I would like to track that down. (It's just the container startup!?) Just tell me what information you need.
Wes, this bug report came out of a discussion on the users list that you might have missed whilst you were out. The aspect was a simple (harmless looking) logging aspect, and adding !within(Builder) to the pointcuts in it stopped this bug from happening. Although I can't imagine how at the moment, it seems highly probably that something the weaver has done is causing this problem.