Back Forum Reply New

load-time weaving fails to parse XML file

.apache.xerces.internal.impl.XMLEntityM  anager$RewindableInputStream.read(XMLEntityManager  .java:2910)
at com.sun.org.apache.xerces.internal.impl.XMLEntityM  anager.setupCurrentEntity(XMLEntityManager.java:70  4)       [deleted]
at org.aspectj.weaver.loadtime.definition.DocumentPar  ser.parse(DocumentParser.java:108)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdap  tor.parseDefinitions(ClassLoaderWeavingAdaptor.jav  a:212)
at org.aspectj.weaver.loadtime.DefaultWeavingContext.  getDefinitions(DefaultWeavingContext.java:113)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdap  tor.initialize(ClassLoaderWeavingAdaptor.java:133)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializ  edClassLoaderWeavingAdaptor.initialize(Aj.java:151  )
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializ  edClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.j  ava:156)
at org.aspectj.weaver.loadtime.Aj$WeaverContainer.get  Weaver(Aj.java:122)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:  73)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgent  Adapter.transform(ClassPreProcessorAgentAdapter.ja  va:52)
at org..context.weaving.AspectJWeaving  Enabler$AspectJClassBypassingClassFileTransformer.  transform(AspectJWeavingEnabler.java:92)       [deleted]
[AppClassLoader@923e30] warning parse definitions failed -- (SAXParseException) Premature end of file.
Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandl  erWrapper.createSAXParseException(ErrorHandlerWrap  per.java:195)       [deleted]
at com.sun.org.apache.xerces.internal.parsers.Abstrac  tSAXParser.parse(AbstractSAXParser.java:1205)
at org.aspectj.weaver.loadtime.definition.DocumentPar  ser.parse(DocumentParser.java:108)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdap  tor.parseDefinitions(ClassLoaderWeavingAdaptor.jav  a:212)
at org.aspectj.weaver.loadtime.DefaultWeavingContext.  getDefinitions(DefaultWeavingContext.java:113)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdap  tor.initialize(ClassLoaderWeavingAdaptor.java:133)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializ  edClassLoaderWeavingAdaptor.initialize(Aj.java:151  )
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializ  edClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.j  ava:156)
at org.aspectj.weaver.loadtime.Aj$WeaverContainer.get  Weaver(Aj.java:122)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:  73)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgent  Adapter.transform(ClassPreProcessorAgentAdapter.ja  va:52)
at org..context.weaving.AspectJWeaving  Enabler$AspectJClassBypassingClassFileTransformer.  transform(AspectJWeavingEnabler.java:92)       [deleted]

Exception in thread quot;mainquot; org..beans.factory.BeanCreationExce  ption: Error creating bean with name 'com.apress.springrecipes.calculator.ComplexCachin  gAspect#0' defined in class path resource [beans.xml]: No matching factory method found: factory method 'aspectOf'
at org..beans.factory.support.Construc  torResolver.instantiateUsingFactoryMethod(Construc  torResolver.java:417)
at org..beans.factory.support.Abstract  AutowireCapableBeanFactory.instantiateUsingFactory  Method(AbstractAutowireCapableBeanFactory.java:903  )       [deleted]
-----------------

I'm starting the JVM with quot;-javaagent:lt;longpathgt;/spring-agent.jarquot;.

My aop.xml file ends up in a jar file, in the META-INF directory off the root of the file.  I tried adding 'options=quot;-verbose -showWeaveInfoquot;' to the quot;weaverquot; element in that file, but it didn't change the output.  It seems possible the failure is in trying to parse this file, but it appears to be valid (I didn't change it from the book download zip, except for adding those options).

Any ideas how to move forward with this?

I seem to have made a change that has gotten past the ZLIB error, only to hit another one.

Previously, the classpath I was using was just the quot;snapshotquot; jar that the maven build created (in addition to the maven dependencies).  I just decided to try something weird and change that to point to the quot;target/classesquot; directory instead.  For some reason, this fixed the ZLIB error, but not the quot;aspectOfquot; error.

In addition, instead of the ZLIB error, I'm getting the following output before the quot;aspectOfquot; error:

--------------------
INFO: Found Spring's JVM agent for instrumentation
[AppClassLoader@923e30] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT
[AppClassLoader@923e30] info register classloader sun.misc.Launcher$AppClassLoader@923e30
[AppClassLoader@923e30] info using configuration /home/davidkarr/workspace/Calculator/target/classes/META-INF/aop.xml
[AppClassLoader@923e30] info using configuration file:/home/davidkarr/.m2/repository/org//spring-aspects/2.5.6.SEC01/spring-aspects-2.5.6.SEC01.jar!/META-INF/aop.xml
[AppClassLoader@923e30] info register aspect com.apress.springrecipes.calculator.ComplexCaching  Aspect
[AppClassLoader@923e30] info register aspect org..beans.factory.aspectj.Annotati  onBeanConfigurerAspect
Apr 28, 2009 3:14:45 PM org.aspectj.weaver.tools.Jdk14Trace error
SEVERE: register definition failed
org.aspectj.weaver.BCException: Unable to continue, this version of AspectJ supports classes built with weaver version 3.0 but the class org..beans.factory.aspectj.Annotati  onBeanConfigurerAspect is version 6.0

at org.aspectj.weaver.bcel.BcelAttributes.readAjAttri  butes(BcelAttributes.java:53)
--------------------

Someone else ran into the same error showthread.php?t=65611, but their resolution doesn't really help me.

gt;  org.aspectj.weaver.BCException: Unable to continue, this version of AspectJ supports classes built with weaver version 3.0 but the class org..beans.factory.aspectj.Annotati onBeanConfigurerAspect is version 6.0

this error indicates that that the aspect was built with AspectJ of at least 1.6.1 and yet at runtime it is being fed to a weaver that is somewhere between 1.5.0 and 1.6.0 (those are the releases when the weaver version was 3).  

The first debug message:
[AppClassLoader@923e30] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT

shows the weaver is back level.

The solution would be to update the weaver being used at runtime/loadtime such that it matches or exceeds that used for the aspect.

You could raise an AspectJ bug about improving that error message if you like, I think it could be more helpful than it is...

Andy

I actually figured out the version problem earlier today. I neglected to get back to this to add a reply about this.

However, I'm finally left with the very last error message, about quot;aspectOfquot;. I had thought that would go away when I fixed the other problems, because I figured it was just aborting the weaving process, but I was wrong.  I sent the packaged project to the book author (because he asked for it), to see if he can figure out what the problem is.
¥
Back Forum Reply New