Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] ClassCastException using JAVA_OPTS="-javaagent:lib/aspectjweaver.jar"


The only time I have seen this problem was in testing and it turned out to be a problem with the context class loader. Xerces uses the context class loader to dynamically load parsers. However if this is a different class loader than the one used to load AspectJ then you get the ClassCastException. Others have successfully used AspectJ LTW with Tomcat so you might have a configuration problem. You might have multiple copies of Xerces including one packaged with Spring. Have you tried LTW without Spring? Can you give some more information about your setup including JDK level?

Cheers

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/



"Laurent Perez" <hakimm@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

11/09/2006 19:37

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
[aspectj-users] ClassCastException using        JAVA_OPTS="-javaagent:lib/aspectjweaver.jar"





Hello

I'm using aspectjweaver from aspectj1.5.2a to enable load-time-weaving
of spring2.0rc2 beans inside my webapp, hosted under tomcat5.5.17.

Whenever I set this environment variable in catalina.sh, I get the
following exception on webapp startup :

warning parse definitions failed -- (ClassCastException) org.apache.xerces.jaxp.
SAXParserFactoryImpl
org.apache.xerces.jaxp.SAXParserFactoryImpl
java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl
at javax.xml.parsers.SAXParserFactory.newInstance(SAX ParserFactory.java:
107)
at org.aspectj.weaver.loadtime.definition.DocumentPar ser.getXMLReader(Do
cumentParser.java:129)
at org.aspectj.weaver.loadtime.definition.DocumentPar ser.parse(DocumentP
arser.java:85)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdap tor.parseDefinition
s(ClassLoaderWeavingAdaptor.java:170)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdap tor.initialize(Clas
sLoaderWeavingAdaptor.java:104)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializ edClassLoaderWeavin
gAdaptor.initialize(Aj.java:130)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializ edClassLoaderWeavin
gAdaptor.getWeavingAdaptor(Aj.java:135)
at org.aspectj.weaver.loadtime.Aj$WeaverContainer.get Weaver(Aj.java:101)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java: 61)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgent Adapter.transform(C
lassPreProcessorAgentAdapter.java:55)

I do believe the weaver isn't happy with my xerces/xml-apis jars,
unfortunately I don't know which version to use to get rid of the
casting exception.
Jars version I use are : xercesImpl-2.8.0.jar, xml-apis-1.3.02.jar,
jdk is 1.5.0_08.

Does aspectj require a specific version of them ?

Thanks!

--
<a href=""> - Mobile world, technology and more</a>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top