Forum Discussion

vikram_9669's avatar
vikram_9669
Occasional Contributor
9 years ago

How to import external java classes in SoapUI 5.0.0 ?

I am trying to import some external java classes in my groovy script. All these classes are located under "C:\Program Files (x86)\SmartBear\SoapUI-5.0.0\bin\ext\DDDD" folder.

I am getting an error "unable to resolve class ITDConnection@ line 4, column 15 ITDConnection itdc= ClassFactory.createTDConnection()" for below code

 

import com4j.*;
import DDDD.*;

ITDConnection itdc = ClassFactory.createTDConnection()
itdc.initConnectionEx(url)

 

SoapuiError.jpg

8 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    That looks ok, at least at first glance...

     

    If you take this example of importing the H2 DB driver:

     

    import groovy.sql.Sql
    import org.h2.Driver

    com.eviware.soapui.support.GroovyUtils.registerJdbcDriver("org.h2.Driver")
    def db = Sql.newInstance("jdbc:h2:mem:test", "org.h2.Driver")

    ...

     

    If I don't add the h2-1.4.181.jar (for the org.h2.Driver class, groovy.sql.Sql is already in the SoapUI lib folder) then I get the same error as you i.e. unable to resolve class.

     

    If I then add h2-1.4.181.jar to <SoapUI Installation Directory>/java/app/bin/ext/ (Mac) then the code compiles and runs fine.

     

    I can't see your ITDConnection class in the screenshot though?

     

    Cheers,

    Rupert

    • rupert_anderson's avatar
      rupert_anderson
      Valued Contributor

      Hang on, are you providing your DDD classes just as a folder rather than a jar file? I can't quite remember, but I think the SoapUI ext class loader might only scan for *.jar files to add to the classpath...

       

      Hope this helps.

      Cheers,

      Rupert

    • vikram_9669's avatar
      vikram_9669
      Occasional Contributor

      Hi Rupert,

       

      There are more than 200 java classes at this location. Not able to get all of them in one screenshet.

      But, yes ITDConnection class is present at this location "C:\Program Files (x86)\SmartBear\SoapUI-5.0.0\bin\ext\DDDD"

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi,

         

        No problem about the screen shot.

         

        Is DDDD just a folder rather than a jar file? because I think it might need to be a jar file to get picked up.

         

        Cheers,

        Rupert