Version 3

    When I run an Arquillian test that uses ShrinkWrap descriptors, I get a nonsensical SAXParseException saying that "content is not allowed in prolog". Why?

     

    Most likely you've passed a file name where the descriptors API expected a string containing XML data. It's an easy mistake to make - compare the following incorrect example with the corrected example that follows it:

     

    BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
                    .from("src/main/webapp/WEB-INF/beans.xml");
    

     

    vs the corrected:

     

    BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
                    .from(new File("src/main/webapp/WEB-INF/beans.xml"));
    

     

    So, next time you see an trace like this from one of your tests, you'll know what's wrong:

     

    java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.JavaArchive com.example.shrinkwraptestsk
    eleton.DemoTest.createDeployment()
       ....
    Caused by: java.lang.reflect.InvocationTargetException
       ....
    Caused by: org.jboss.shrinkwrap.descriptor.api.DescriptorImportException: Could not import XML from stream
       ....
    Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
    

     

    There's an open issue with a proposed API change to make this error harder to make.