Community
Participate
Working Groups
I'm trying to upgrade from AspectJ1.2.1 to AspectJ1.5. I'm trying to aspectize a jar and make a new jar. But this is working fine in AspectJ1.2.1 even now. But this problem occurs in aspectJ1.5. Is thr any workaround for this ---- Compiler Messages --- abort ABORT -- (BCException) Can't open archive: struts.jar: java.util.zip.ZipException: error in opening zip file Can't open archive: struts.jar: java.util.zip.ZipException: error in opening zip file org.aspectj.weaver.BCException: Can't open archive: struts.jar: java.util.zip.ZipException: error in opening zip file at org.aspectj.weaver.bcel.ClassPathManager$ZipFileEntry.ensureOpen (ClassPathManager.java:253) at org.aspectj.weaver.bcel.ClassPathManager$ZipFileEntry.find (ClassPathManager.java:225) at org.aspectj.weaver.bcel.ClassPathManager.find (ClassPathManager.java:92) at org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass (BcelWorld.java:259) at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate (BcelWorld.java:234) at org.aspectj.weaver.World.resolveToReferenceType(World.java:282) at org.aspectj.weaver.World.resolve(World.java:205) at org.aspectj.weaver.World.resolve(World.java:127) at org.aspectj.weaver.World.resolve(World.java:250) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld (AjBuildManager.java:594) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild (AjBuildManager.java:189) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild (AjBuildManager.java:140) at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) at org.aspectj.tools.ajc.Main.run(Main.java:324) at org.aspectj.tools.ajc.Main.runMain(Main.java:238) at org.aspectj.tools.ajc.Main.main(Main.java:82) ---- org.aspectj.weaver.bcel.BcelWorld ----
Hmmm, is struts.jar definetly a valid jar file? you can unzip/unjar it OK outside of AspectJ? Is this only happening on solaris like the other bug, or is it also happening on windows? All the code that is failing is basically doing is: zipFile = new ZipFile(new File("struts.jar")) Aspectj hasn't even had a chance to touch the contents of it by the time it goes wrong.
No this is happening even in windows when i tried with AspectJ1.5. But itz working quite fine when i tried with Ver1.2.1. Is thr any work around for this.. I was stuck up in the middle as i'm unable to change completely to Ver1.5 because of this kind of error nor i cudn't proceed with 1.2.1 because of that internal compiler error
But have you tried opening the struts.jar outside of AspectJ, just on the command line - is the jar OK?? It is possible that extra processing in AspectJ5 is requiring us to open that jar where we didn't bother previously - under AspectJ1.2.1 we may never have tried to open it. All I can suggest is moving struts.jar to the end of your classpath - AspectJ is not necessarily looking for a class from that archive, it is just opening all the jars on the classpath in turn trying to find something.
Yeah. I'm manually able to open tht jar. But this is not the case only with struts.jar. I'm getting this error for all the jars that i'm tryin to aspectize..
FWIW, I've verified that I can open (and weave) struts.jar on Windows with AJ 5.
Is this still a problem for you?
Finally I recreated this today by accident. It occurs if the output jar you are writing to is on your classpath !!
or if a jar on the classpath is zero size - which happens if you have it as the outjar - we open the file to write to then attempt to open it when resolving something from the classpath, bang.
investigate if still a problem for 1.5.4
per my comments 7 and 8, I think this is addressed now in AspectJ1.6 as those situations are now checked. please reopen if still an issue.