ActionScript Compiler Error – Flex Ant Tasks Bug

Apparently, there is a bug that involves the Flex 3 SDK and Ant using different versions of Xerxes.

Try Ant 1.6.5

If I run the ant script using Ant 1.7.0, I get the error described here. If I run with Ant 1.6.5, there’s no error.

Given the error message, my guess is that the different versions of Ant bring in different versions of Xerces. Either Xerces broke some backward compatability, or the mxmlc .jar files are using bits of Xerces that aren’t part of the published API.

But if that is the case, then my problem must be something else. Running this on the command line gave me the following result:

ant -version
Apache Ant version 1.6.5 compiled on July 2 2006

But I appear to be having similar problems when compiling on an Intel iMac at work.

flex/bin/mxmlc
Loading configuration file /Users/stephen/flex/frameworks/flex-config.xml
Error: class org.apache.xerces.util.XMLAttributesMMImpl$AttributeMMImpl cannot access its superclass org.apache.xerces.util.XMLAttributesImpl$Attribute

java.lang.IllegalAccessError: class org.apache.xerces.util.XMLAttributesMMImpl$AttributeMMImpl cannot access its superclass org.apache.xerces.util.XMLAttributesImpl$Attribute
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerMMImpl.<init>(XMLDocumentFragmentScannerMMImpl.java:105)
        at org.apache.xerces.impl.XMLDocumentScannerMMImpl.<init>(XMLDocumentScannerMMImpl.java:258)
        at org.apache.xerces.impl.XMLNSDocumentScannerMMImpl.<init>(XMLNSDocumentScannerMMImpl.java:120)
        at org.apache.xerces.parsers.IntegratedParserConfigurationMMImpl.createDocumentScanner(IntegratedParserConfigurationMMImpl.java:282)
        at org.apache.xerces.parsers.DTDConfiguration.<init>(Unknown Source)
        at org.apache.xerces.parsers.StandardParserConfiguration.<init>(Unknown Source)
        at org.apache.xerces.parsers.IntegratedParserConfigurationMMImpl.<init>(IntegratedParserConfigurationMMImpl.java:193)
        at org.apache.xerces.parsers.XML11ConfigurationMMImpl.<init>(XML11ConfigurationMMImpl.java:182)
        at org.apache.xerces.parsers.XML11ConfigurationMMImpl.<init>(XML11ConfigurationMMImpl.java:139)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.xerces.parsers.ObjectFactory.newInstance(Unknown Source)
        at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
        at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
        at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
        at flex2.compiler.config.FileConfigurator.load(FileConfigurator.java:113)
        at flex2.tools.Compiler.processConfiguration(Compiler.java:512)
        at flex2.tools.Compiler.processConfiguration(Compiler.java:428)
        at flex2.tools.Compiler.mxmlc(Compiler.java:82)
        at flex2.tools.Compiler.main(Compiler.java:53)

The solution was to disable the file that was causing the error by renaming it as a backup file. By running this on the command line, I can now compile using mxmlc.

mv ~/flex/lib/xercesPatch.jar ~/flex/lib/xercesPatch.jar.bak
Advertisements

About this entry