Forum Discussion

tempo66's avatar
tempo66
Occasional Contributor
7 years ago

Trouble loading XSD-compliant DOM-parser when using testRunner.sh vs. UI

Hi forum

 

I have added a jar-file containing some groovy code that uses a SchemaFactory to validate an xml file using schema 1.1. For that purposes I have also added the special Xerces beta library that supports 1.1. This works fine when I run my test with assertion from the user interface. But - If I try the same test script using testRunner.sh it fails, even though it seems that the extension jars are loaded:

 

16:41:37,723 INFO  [SoapUI] Adding [/Applications/SoapUI-5.4.0.app/Contents/java/app/bin/ext/RDFinedSoapUILib.jar] to extensions classpath

16:41:37,724 INFO  [SoapUI] Adding [/Applications/SoapUI-5.4.0.app/Contents/java/app/bin/ext/saxon9pe.jar] to extensions classpath

16:41:37,724 INFO  [SoapUI] Adding [/Applications/SoapUI-5.4.0.app/Contents/java/app/bin/ext/xercesImpl-xsd11-shaded-2.12-beta-r1667115.jar] to extensions classpath

16:41:37,724 INFO  [SoapUI] Adding [/Applications/SoapUI-5.4.0.app/Contents/java/app/bin/ext/xml-apis-1.4.01.jar] to extensions classpath

16:41:37,955 INFO  [DefaultSoapUICore] initialized soapui-settings from [/Users/runestilling/soapui-settings.xml]

...

16:41:44,715 INFO  [log] Validate begin

16:41:44,758 INFO  [log] No SchemaFactory that implements the schema language specified by: http://www.w3.org/XML/XMLSchema/v1.1 could be loaded

16:41:44,759 INFO  [log] [Ljava.lang.StackTraceElement;@3e2fc448

java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified by: http://www.w3.org/XML/XMLSchema/v1.1 could be loaded

at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:215)

at javax.xml.validation.SchemaFactory$newInstance.call(Unknown Source)

 

What could the solution be to this?

 

Regards,

Rune

 

 

  • tempo66's avatar
    tempo66
    Occasional Contributor

    Hi

     

    I don't understand why this is off topic SoapUI. I have documented an odd behavior using SoapUI, where SoapUI does work running in one mode, and doing exactly the same thing is not working running in another mode. To me it seems like som sort of bug og at least an undocumented difference between running a SoapUI test from the UI and running it using the testrunner script.

     

    Regards,

    Rune

    • nmrao's avatar
      nmrao
      Champion Level 3
      Because, in the exception, no where it seen the soapui package name such as "com.eviware.*"
    • nmrao's avatar
      nmrao
      Champion Level 3
      By the way, it is not confirmed in your reply anything on the other suggestions. Have you tried any?
      • tempo66's avatar
        tempo66
        Occasional Contributor

        First of all I didn't post the entire exception. But I'll do that.

         

        Regarding suggestions. Do you mean looking on the net? I'm very well aware of the meaning of the exception, and yes I did look on the net. But since my groovy plugin work well when running the test from the SoapUI GUI I assume the problem is around testrunner.sh not being able to load the plugin dependent libraries properly. Any other ideas?

         

        /Rune

  • JHunt's avatar
    JHunt
    Community Hero

    Here's some more information about the call that's failing:

     

    https://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#newInstance(java.lang.String)

     

    If that's behaving oddly and it can't figure out what classes to use, can you specify for it using this?

     

    https://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#newInstance(java.lang.String,%20java.lang.String,%20java.lang.ClassLoader)

     

    To find out what value to use for factoryClassName, try just getting the name of the class that's generated successfully when you run in the UI. After:

     

    def sf = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1");

    simply:

     

    log.info sf.class

    You could try also importing that class specifically in your constructor or in your assertion script etc.

     

  • tempo66's avatar
    tempo66
    Occasional Contributor

    I have now checked out the “Schema Compliance” assertion. I can’t find much documentation around so I don’t know what it’s actually supposed to validate. To me it seems it doesn’t validate the XML-content in the response. I have tried to supply some xsd’s in the grammar section which it seems to ignore.

     

    Regarding the original question I have finally figured out that also SoapUI cannot load the relevant schema factory. The message about this was hidden in a log and the assertion just showed that it worked.

     

    I’m back to square on and will test the groovy based xml validation outside SoapUI and play around with libraries thereafter.