|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[webtest][JIRA] Created: (WT-541) NullpointerException when executing custom stepNullpointerException when executing custom step
----------------------------------------------- Key: WT-541 URL: http://webtest-community.canoo.com/jira/browse/WT-541 Project: WebTest Type: Bug Versions: 3.0 Environment: Ant 1.7.1 Java SE 1.6.0.16 Ubuntu Jaunty (9.04) Reporter: Thomas Vöcking When trying to execute a custom step, I get the following exception: /home/thomas/development/canoo/webtest.xml:11: Unexpected exception caught: org.apache.tools.ant.BuildException at com.canoo.webtest.steps.StepUtil.handleException(StepUtil.java:122) at com.canoo.webtest.steps.Step.handleException(Step.java:387) at com.canoo.webtest.steps.Step.execute(Step.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at com.canoo.webtest.ant.WebtestTask.executeSteps(WebtestTask.java:236) at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:208) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.Main.runBuild(Main.java:758) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused by: /home/thomas/development/canoo/firstWebTest.xml:18: java.lang.NullPointerException at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116) 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:103) ... 25 more Caused by: java.lang.NullPointerException at com.canoo.webtest.engine.WebTestException.readUrlCurrentResponse(WebTestException.java:29) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:25) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:40) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:48) at com.canoo.webtest.engine.StepExecutionException.<init>(StepExecutionException.java:25) at com.canoo.webtest.steps.Step.checkContextDefined(Step.java:129) at com.canoo.webtest.steps.Step.execute(Step.java:99) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) ... 29 more --- Nested Exception --- /home/thomas/development/canoo/firstWebTest.xml:18: java.lang.NullPointerException at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116) 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:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at com.canoo.webtest.ant.WebtestTask.executeSteps(WebtestTask.java:236) at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:208) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.Main.runBuild(Main.java:758) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused by: java.lang.NullPointerException at com.canoo.webtest.engine.WebTestException.readUrlCurrentResponse(WebTestException.java:29) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:25) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:40) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:48) at com.canoo.webtest.engine.StepExecutionException.<init>(StepExecutionException.java:25) at com.canoo.webtest.steps.Step.checkContextDefined(Step.java:129) at com.canoo.webtest.steps.Step.execute(Step.java:99) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) ... 29 more --- Nested Exception --- java.lang.NullPointerException at com.canoo.webtest.engine.WebTestException.readUrlCurrentResponse(WebTestException.java:29) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:25) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:40) at com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:48) at com.canoo.webtest.engine.StepExecutionException.<init>(StepExecutionException.java:25) at com.canoo.webtest.steps.Step.checkContextDefined(Step.java:129) at com.canoo.webtest.steps.Step.execute(Step.java:99) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 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:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at com.canoo.webtest.ant.WebtestTask.executeSteps(WebtestTask.java:236) at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:208) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.Main.runBuild(Main.java:758) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) This is the interesting part of my buildfile: <project name="SimpleTest" basedir="." default="wt.full"> <property name="webtest.home" location="." /> <import file="${webtest.home}/webtest.xml"/> <target name="wt.testInWork"> <webtest name="Test Case"> <config useInsecureSSL="true" /> <taskdef name="myCustomStep" classname="de.mycompany.webtests.support.StoreOrderId" classpathref="wt.defineTasks.classpath.webtest" /> <!-- Homepage --> <invoke url="http://localhost" /> <myCustomStep xpath="//*"/> ... .. and this is my java class (Just an empty class, only for testing): public class StoreOrderId extends com.canoo.webtest.steps.StoreXPath { } ------- The problem here seems to be the definition of my class inside a taskdef element: <taskdef name="myCustomStep" classname="de.mycompany.webtests.support.StoreOrderId" classpathref="wt.defineTasks.classpath.webtest" /> When I remove this line and add the step-definition to "webtest.taskdef" file in the webtest.jar, everything works fine. Seems to me that the static definition of the ThreadLocal CONTEXT_HOLDER in WebtestTask.java is the problem.. maybe caused by a different classloader that is called by the taskdef-Element and so the ThreadLocal is defined twice. I hope, this helps you. Regards, Thomas -- 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@... http://lists.canoo.com/mailman/listinfo/webtest |
| Free embeddable forum powered by Nabble | Forum Help |