Forum Discussion

JMcKinley's avatar
JMcKinley
Contributor
17 years ago

Problem instantiating a groovy class from another groovy class

When I bring up SOAP UI Pro, it gives me an error that it could not resolve a class... I call this class from another class...

Here is the class declaration:

package soapui.Test

class Testdebug

I didn't have any constructors as they weren't needed but I also tried adding a blank constructor.

In my second class, the line to instantiate the class is:

def currentClassDebug = new soapui.Test.Testdebug()

For what we are doing, I did move the script folder to a different path and changed the path to reflect where the classes are... and this works when instantiating a class from a script inside a test case.

The weird thing is that when I edit the classes while SOAP UI Pro is up, it recompiles the classes fine... it only gives me the error when opening up SOAP... plus the script in the test case won't work unless I comment the class in my second class (well, it does work if i compile the script while SOAP is up  ).

Any ideas? Is this a bug in SOAP in the system trying to find the class OR is there something I need to do to make it work?

One other thing:

The above instantiation works just fine from a script in the test case... it only doesn't work when used in another class.

Help!!

9 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    this sounds like an issue with the classloader and interdependencies.. I'll try to reproduce.. thanks for reporting!

    /Ole
    eviware.com
  • Was wondering what you found out... I have a lot of places now where it would be much better if I could break up my classes for better reusability but can't because of this issue. Also, since my classes have to contain all the code, the classes are getting pretty big... again, I could make the code a lot better if I could appropriately break out common methods.

    Note: I've also tried to extend a groovy "superclass" as well create a class method (vs. an instantiated method) to try to work around this issue but also get the same error (can't resolve class) so it APPEARS to be the same issue or related to it.

    Have you been able to reproduce and/or has it been fixed?

    Thanks!
    Jim
  • Great! Thanks!

    One question:

    Can you respond with the URL again? I got the following error when clicking on the link provided:

    Object not found!

    The requested URL was not found on this server.

    Thanks!
    Jim
  • One final question before installing from the current lastest build... will the install retain the fact that I'm using SOAP UI Pro?

    The reason I ask is that the first screen in the install seems to indicate to me that this is not the pro version.

    Thanks!
  • Nevermind... got the pro release 

    I will report if it fixes my issue.

    Thanks!
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Jim,

    just wanted to check if this has been fixed for you.. let me know!

    regards,

    /Ole
    eviware.com