Class instantiation failure within groovy block of webtest
----------------------------------------------------------

         Key: WT-503
         URL: http://webtest-community.canoo.com/jira/browse/WT-503
     Project: WebTest
        Type: Bug

    Versions: 2.6    
 Environment: OS: Various windows-based (ie. XP, 2000, etc)

    Reporter: Chris Carman
 Attachments: javahack.xml, t5.java

 There appears to be a class instantiation bug of some kind when groovy code is 
executed within a webtest.
 
 In the attached webtest (javahack.xml) tests 1 - 4 work fine, but test 5 fails.

 This is test 4:
 
       <groovy description="groovy test 4">
         import org.apache.log4j.Logger;
         l = Logger.getLogger(Logger.class);
         println("Groovy test 4 completed!");
       </groovy>
 
 And this is test 5 (which fails even though the "t5" class it instantiates 
calls the same "getLogger" method as test 4):
 
       <groovy description="groovy test 5">
         test = new t5();
         println("Groovy test 5 completed!");
       </groovy>
 
 t5.java contains only the following:
    import org.apache.log4j.Logger;
 
    public class t5
    {
      public Logger LOGGER;
 
      public t5() {
        LOGGER = Logger.getLogger(Logger.class);
      }
    }

 Additionally, both test4 and test5 work fine when run through Groovy alone, so 
this appears to be a problem with Webtest.

 The following stack trace is generated: 
 Caused by: ...\javaHack.xml:38: java.lang.NoClassDefFoundError: 
Lorg/apache/log4j/Logger;
                  at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at 
com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
                  at 
com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
                  at com.canoo.webtest.steps.Step.execute(Step.java:101)
                  ... 35 more
 Caused by: java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger;
                  at java.lang.Class.getDeclaredFields0(Native Method)
                  at java.lang.Class.privateGetDeclaredFields(Unknown Source)
                  at java.lang.Class.getDeclaredFields(Unknown Source)
                  at 
org.codehaus.groovy.reflection.CachedClass$2.run(CachedClass.java:217)
                  at java.security.AccessController.doPrivileged(Native Method)
                  at 
org.codehaus.groovy.reflection.CachedClass.getFields(CachedClass.java:214)
                  at 
groovy.lang.MetaClassImpl.addFields(MetaClassImpl.java:1719)
                  at 
groovy.lang.MetaClassImpl.inheritFields(MetaClassImpl.java:1714)
                  at 
groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:1603)
                  at 
groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2508)
                  at 
groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2479)
                  at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getGlobalMetaClass(MetaClassRegistryImpl.java:253)
                  at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.access$100(MetaClassRegistryImpl.java:45)
                  at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getFromGlobal(MetaClassRegistryImpl.java:112)
                  at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getMetaClass(MetaClassRegistryImpl.java:88)
                  at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$MyThreadLocal.getMetaClass(MetaClassRegistryImpl.java:361)
                  at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:265)
                  at 
org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:808)
                  at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNewN(ScriptBytecodeAdapter.java:230)
                  at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNew0(ScriptBytecodeAdapter.java:237)
                  at Script1.run(Script1.groovy:2)
                  at groovy.lang.GroovyShell.evaluate(GroovyShell.java:543)
                  at groovy.lang.GroovyShell.evaluate(GroovyShell.java:518)
                  at 
com.canoo.webtest.extension.groovy.GroovyInvoker.doExecute(GroovyInvoker.java:40)
                  at 
com.canoo.webtest.extension.groovy.GroovyStep.doExecute(GroovyStep.java:37)
                  at com.canoo.webtest.steps.Step.execute(Step.java:101)
                  at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
                  at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
                  ... 39 more
 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to