Forum Discussion

Anonymous's avatar
Anonymous
15 years ago

BUG in class loader ?

USE CASE 1

(only one library xmltypeswsb9.jar <=> SASNormalisationtype)

a groovy script is used in assertion:

log.info("SAScheckVersion 3 "+rsp) ;
    sasNormalisationTypes.ResponseDocument rspDoc = sasNormalisationTypes.ResponseDocument.Factory.parse(rsp.toString());
log.info("SAScheckVersion 4 ") ;

Run soapui : every thing is OK. Soapui works well and the log.info have the expected value.

USE CASE 2
the library xmltypeswsb9.jar <=> SASNormalisationtype is present,
but we add a new library in ...soapui.../bin/ext
library refxmltypeswsb9.jar <=> SASNormalisationtype

This refxmltypeswsb9 library will be used later. The code of the grovy assertion script is the same between use case 1 and use case 2.

here is an extract of the libraries
$ grep -i responsedocumentimpl l*
l1:  1702 Mon Feb 01 11:47:02 CET 2010 sasNormalisationTypes/impl/ResponseDocumentImpl.class
l2:  1722 Mon Feb 01 19:21:54 CET 2010 REF_SASNormalisationTypes/impl/ResponseDocumentImpl.class

run soapui ui :
log.info("SAScheckVersion 3 "+rsp) ;
=> log.info have the expected value
    sasNormalisationTypes.ResponseDocument rspDoc = sasNormalisationTypes.ResponseDocument.Factory.parse(rsp.toString());
=> exception
  REF_SASNormalisationTypes.impl.ResponseDocumentImpl cannot be cast to sasNormalisationTypes.ResponseDocument
 

log.info("SAScheckVersion 4 ") ;
=> log.info never printed

my questions
Why have I an exception, just by adding a new librarie. Of course, both libraries have a object ResponseDocument, but
the ResponseDocument objects are not in the same package. So I don't understand why is soaopui speaking about
REF_SASNormalisationTypes.impl.ResponseDocumentImpl?
It seems that the soapui class loader is confused by the ResponseDocument class.
How to prouve that ? How to debug ? How to correct ?

Comments

 An eclipse project that containts the both libraries works without any problem. So
 sasNormalisationTypes.ResponseDocument rspDoc = sasNormalisationTypes.ResponseDocument.Factory.parse(rsp.toString());
 parse string as expected.
 
 The same problem occurs with soapui 3.5

Thanks
PHL.
  • Anonymous's avatar
    Anonymous
    Test on other system
    I test the same code on linux : no bug. The parsing and the XREF objets are OK.

    How to reproduce?

    Put the 3 libraries into the ext folder of soapui. I can give you the 3 librairies (but each libararies is 7 Mo. How can I send you them?).

    Then create a new project, and in the setup script add :
    def objsetup  = new wsb9_toto() ;
        objsetup.titi(log) ;

    Add also the wsb9_toto.groovy script into the bin/script folder :
    import org.apache.log4j.Logger ;
    import com.lds.test.wsb9.xmlparsewsb9 ;
    import com.lds.test.wsb9.REFxmltypeswsb9 ;

    class wsb9_toto
    {

      wsb9_toto(Logger log)
      {


      }

      public String titi(Logger log)
      {
          String ScriptFile = "C:/temp/x.xml" ;
          StringBuffer content = new StringBuffer("") ;
          new File(ScriptFile).eachLine{ line -> content.append(line+"\n") ; }

          // content == xml
          def op = new com.lds.test.wsb9.xmlparsewsb9(new String(content),log) ;
          log.info("Test de Parsing : "+op.getCNI()) ;

          REFxmltypeswsb9 x = new REFxmltypeswsb9(10,log) ;
          x.def_ThirdPartyListSearch("P",log) ;
          log.info("Test Ref "+x.buildMessage()) ;

      }

    }

    I have also the x.xml file :

            4
           
               
                  4
                 
                     
                        NFO002
                       
                        4
                       
                       
                            PREQUAL 1C.ter.094 100202
                            MBTG0AD1
                            39390041
                            2010-02-02
                            2010-02-02
                            19:36:09
                       

                        0
                       
                        WSA_Souscription;WSA_Générique;Gestion SM/WS;Ajoute contexte
                     

                     
                        NFO003
                       
                        4
                       
                       
                            MIWI-S2
                            D:\prog\magic\94sp8bWS
                            SYSTEM
                            MIWI-S2/3620
                       

                        0
                       
                        WSA_Souscription;WSA_Générique;Gestion SM/WS;Ajoute contexte
                     

                 

                  99992799
                 
               

               
                 
                      /dataflow/data/event/SavingsPolicySubscription/SubscriptionHeader/contributorId
                      1
                     
                     
                 

                 
                      /dataflow/data/event/SavingsPolicySubscription/SubscriptionHeader/CommercialSelection
                     
                       
                            0
                           
                              PAS DE SELECTION
                             
                              80
                              0
                           

                       

                       
                            1
                           
                              selection1
                             
                              80
                              0
                           

                       

                       
                            102
                           
                              Gestion sous mandat équilibre
                              GAETAN
                              50
                              1
                           

                       

                       
                            123
                           
                              LES SELECTIONS COMMERCIALES DE LA REBUBLIQUE TESTS
                              LA SELECTION COMMERCIAL DE LA REPUBLIQUE
                              180
                              0
                           

                       

                     

                      0
                     
                     
                 

                 
                      /dataflow/data/event/SavingsPolicySubscription/SubscriptionHeader/isUnique
                      No
                     
                     
                 

                 
                      /dataflow/data/event/SavingsPolicySubscription/SubscriptionHeader/contractType
                     
                       
                            Individuel
                       

                       
                            Maître
                       

                     

                     
                     
                     
                 

                 
                      /dataflow/data/event/SavingsPolicySubscription/SubscriptionHeader/signingType
                     
                       
                            Anonyme
                       

                       
                            Nominatif
                       

                     

                      Anonyme
                     
                     
                 

               

           

         


    If the xref...jar is in the ext folder => Bug
    If  the xref...jar is in the ext folder : no parsing bug, but of course I can't create the REFxmltypeswsb9(10,log) object.
  • Anonymous's avatar
    Anonymous
    I build a java project to test directly without soapui. No problem !

    I decide to test directly the code, without eclipse. So with a single .bat, I can test the java code and manage the classpath.

    So, according the order of inclusion of the two xmlbeans generated jar, the code runs without problem or has the same cast bug.

    As the linux and windows class loader are differents, the order of inclusion of the  two xmlbeans generated jar are not the same. So there is bug or not bug.

    Now, I have to understand how to manage the inclusion order in soapui-Pro.

    I have just tested by putting a .jar into the lib folder (so it is first loaded) and the second one is in bin/ext folder (so it is loaded later) : No bug,