[Webtest] cannot get <scriptStep> to work - ClassNotFoundException: org.apache.bsf.engines.javascript.JavaScriptEngine

Chris Gerrard webtest@lists.canoo.com
Thu, 20 Apr 2006 21:06:50 -0400


I'm puzzled by this.

Trying to use a stripped down version of one of the scriptStep samples 
from the doc and am getting a message telling me:
[scriptStep] java.lang.ClassNotFoundException: 
org.apache.bsf.engines.javascript.JavaScriptEngine

I'm deliberately trying the simplest javascript I can think of, and the 
correct jar file(s) seem to be in place.

See below for the execution command, output, build file, and list of jar 
files.

I've looked for a reference about this but can't find a specific answer. 
Philippe Schoch's email of 4/13 describes the same problem, but Marc 
Guillemot's 4/14 response seems to assume it's the content of the 
Philippe's javascript rather than the inability to locate the 
JavaScriptEngine that's the problem, thus not helping my situation.

Can someone shed some light on this?

Thanks.

Chris Gerrard


======================================
the execution statement:
======================================
C:\Java\webtest\doc\doc\samples>webtest -buildfile scriptTest.xml


======================================
the execution output: <begin>
======================================
"java.exe" -Xms64M -Xmx256M -cp 
"C:\Java\webtest\bin\..\lib\runtime\ant-launcher.jar" 
-Dant.library.dir="C:\Java\webtest\bin\..\lib\runtime" 
org.apache.tools.ant.launch.Launcher -nouserlib -lib 
"C:\Java\webtest\bin\..\lib\build;C:\Java\webtest\bin\..\lib\build\clover.jar" 
-buildfile scriptTest.xml
Buildfile: scriptTest.xml
Trying to override old definition of task sleep

scriptTest:
  [webtest]  INFO (com.canoo.webtest.ant.WebtestTask) - Canoo Webtest: 
R_1217.
   [config]  INFO (com.canoo.webtest.engine.Configuration) - Surfing 
with browser Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)
   [invoke]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: 
invoke "dummy invoke" (1/2)
   [invoke]  INFO (com.canoo.webtest.steps.request.AbstractTargetAction) 
- -> gotoTarget by URL:
   [invoke]  INFO (com.canoo.webtest.steps.request.TargetHelper) - 
getting response for url: http://webtest.canoo.com
   [invoke]  INFO (com.canoo.webtest.engine.Configuration) - no refresh 
performed to http://webtest.canoo.com/webtest/manual/WebTestHome.html 
according to configuration
   [invoke]  INFO (com.canoo.webtest.engine.Context) - Content of window 
changed to http://webtest.canoo.com
   [invoke]  INFO (com.canoo.webtest.engine.Context) - Content loaded in 
newly opened window, its content will become current response
   [invoke]  INFO (com.canoo.webtest.engine.Context) - Current form set 
to none
   [invoke]  INFO (com.canoo.webtest.engine.Context) - Current response 
now: http://webtest.canoo.com
[scriptStep]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: 
scriptStep "<unknown>" (2/2)
[scriptStep] ERROR (org.apache.bsf.BSFManager) - Exception :
[scriptStep] java.lang.ClassNotFoundException: 
org.apache.bsf.engines.javascript.JavaScriptEngine
[scriptStep]     at java.net.URLClassLoader$1.run(Unknown Source)
[scriptStep]     at java.security.AccessController.doPrivileged(Native 
Method)
[scriptStep]     at java.net.URLClassLoader.findClass(Unknown Source)
[scriptStep]     at java.lang.ClassLoader.loadClass(Unknown Source)
[scriptStep]     at java.lang.ClassLoader.loadClass(Unknown Source)
[scriptStep]     at 
org.apache.bsf.BSFManager.loadScriptingEngine(Unknown Source)
[scriptStep]     at org.apache.bsf.BSFManager.exec(Unknown Source)
[scriptStep]     at 
com.canoo.webtest.boundary.ResetScriptRunner.executeScript(ResetScriptRunner.java:131)
[scriptStep]     at 
com.canoo.webtest.extension.ScriptStep.executeByRunner(ScriptStep.java:100)
[scriptStep]     at 
com.canoo.webtest.extension.ScriptStep.doExecute(ScriptStep.java:61)
[scriptStep]     at com.canoo.webtest.steps.Step.execute(Step.java:135)
[scriptStep]     at org.apache.tools.ant.Task.perform(Task.java:364)
[scriptStep]     at 
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:38)
[scriptStep]     at 
com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:105)
[scriptStep]     at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[scriptStep]     at org.apache.tools.ant.Task.perform(Task.java:364)
[scriptStep]     at org.apache.tools.ant.Target.execute(Target.java:341)
[scriptStep]     at 
org.apache.tools.ant.Target.performTasks(Target.java:369)
[scriptStep]     at 
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[scriptStep]     at 
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[scriptStep]     at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[scriptStep]     at 
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[scriptStep]     at org.apache.tools.ant.Main.runBuild(Main.java:668)
[scriptStep]     at org.apache.tools.ant.Main.startAnt(Main.java:187)
[scriptStep]     at 
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[scriptStep]     at 
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[scriptStep]  INFO (com.canoo.webtest.steps.Step) - Running with: Canoo 
Webtest: R_1217.
[scriptStep]  INFO (com.canoo.webtest.steps.Step) - Exception thrown 
from this class: com.canoo.webtest.engine.StepExecutionException
[scriptStep]  INFO (com.canoo.webtest.steps.Step) - Message was: Error 
invoking script: java.lang.ClassNotFoundException: 
org.apache.bsf.engines.javascript.JavaScriptEngine


BUILD FAILED
C:\Java\webtest\doc\doc\samples\scriptTest.xml:14: Canoo Webtest: R_1217.
Test failed.
Exception raised: com.canoo.webtest.engine.StepExecutionException: Error 
invoking script: java.lang.ClassNotFoundException: org.apache.bsf.e
ngines.javascript.JavaScriptEngine, Step: ScriptStep at 
C:\Java\webtest\doc\doc\samples\scriptTest.xml:22:  with 
(script="calc_qty = 0;", de
scription="<unknown>", language="javascript", 
stepType="scriptStep")com.canoo.webtest.engine.StepExecutionException: 
Error invoking script:
java.lang.ClassNotFoundException: 
org.apache.bsf.engines.javascript.JavaScriptEngine, Step: ScriptStep at 
C:\Java\webtest\doc\doc\samples\sc
riptTest.xml:22:  with (script="calc_qty = 0;", description="<unknown>", 
language="javascript", stepType="scriptStep")
        at 
com.canoo.webtest.extension.ScriptStep.doExecute(ScriptStep.java:71)
        at com.canoo.webtest.steps.Step.execute(Step.java:135)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:38)
        at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:105)
        at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at 
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


Total time: 2 seconds
======================================
the execution output: <end>
======================================


======================================
the build file: scriptTest.xml <begin>
======================================

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE project SYSTEM "WebTest.dtd"
 [<!ENTITY sharedConfiguration SYSTEM "WEPSInclude.xml">]
 >

<project name="scriptTest Test" basedir="." default="scriptTest">

<property name="webtest.home" location="C:/Java/webtest" />

<import file="${webtest.home}/lib/taskdef.xml"/>

<target name="scriptTest">
    <webtest name="scriptTest">
    <config host="yahoo.com"
            protocol="http"
            basepath=""
            >
    </config>
        <steps>
            <scriptStep language="javascript">calc_qty = 
0;</scriptStep>       
        </steps>
    </webtest>
</target>

</project>

======================================
the build file: scriptTest.xml <end>
======================================



======================================
the build environment: <begin>
======================================
C:\Java\webtest\doc\doc\samples>set | grep WEBTEST
WEBTEST_HOME=C:\Java\webtest

ls -l \java\webtest\lib >> scriptTest.txt

total 12658
-rwxrwxrwa   1 Everyone        Everyone          14067 Aug 13  2005 
JavaDiff.jar
-rwxrwxrwa   1 Everyone        Everyone         100600 Mar  5 03:12 
bsf-20060305.jar
-rwxrwxrwa   1 Everyone        Everyone         100600 Apr 20 19:35 bsf.jar
-rwxrwxrwa   1 Everyone        Everyone            907 Feb  3 13:25 
classpath.xml
-rwxrwxrwa   1 Everyone        Everyone         188671 Oct 29  2004 
commons-beanutils-1.7.0.jar
-rwxrwxrwa   1 Everyone        Everyone          32377 Oct 29  2004 
commons-cli-1.0.jar
-rwxrwxrwa   1 Everyone        Everyone          46725 Jan  3  2005 
commons-codec-1.3.jar
-rwxrwxrwa   1 Everyone        Everyone         559366 Oct 29  2004 
commons-collections-3.1.jar
-rwxrwxrwa   1 Everyone        Everyone         279383 Dec 21 12:19 
commons-httpclient-3.0.jar
-rwxrwxrwa   1 Everyone        Everyone          61562 Dec 11 05:31 
commons-io-1.1.jar
-rwxrwxrwa   1 Everyone        Everyone         207723 Dec  1 03:22 
commons-lang-2.1.jar
-rwxrwxrwa   1 Everyone        Everyone          38015 Oct 29  2004 
commons-logging-1.0.4.jar
-rwxrwxrwa   1 Everyone        Everyone         364806 Feb 18 13:20 
htmlunit-1.8.jar
-rwxrwxrwa   1 Everyone        Everyone          79160 Sep  4  2001 
jakarta-oro-2.0.4.jar
-rwxrwxrwa   1 Everyone        Everyone           1591 Jan 24  2005 jars.txt
-rwxrwxrwa   1 Everyone        Everyone         231706 Nov 11 11:53 
jaxen-1.1-beta-8.jar
-rwxrwxrwa   1 Everyone        Everyone        1718811 Sep 20  2004 
jemmy.jar
-rwxrwxrwa   1 Everyone        Everyone         701049 Nov  2 13:58 
js-1.6R2.jar
-rwxrwxrwa   1 Everyone        Everyone         358180 Dec 20 03:13 
log4j-1.2.13.jar
-rwxrwxrwa   1 Everyone        Everyone            985 Feb 11  2005 
log4j.junit.xml
-rwxrwxrwa   1 Everyone        Everyone           1654 Aug 18  2005 
log4j.properties
-rwxrwxrwa   1 Everyone        Everyone           1007 Mar  7  2005 
log4j.selftest_jetty.xml
-rwxrwxrwa   1 Everyone        Everyone         153117 Mar 13  2003 
mailapi.jar
-rwxrwxrwa   1 Everyone        Everyone         105672 Aug  8  2005 
nekohtml-0.9.5.jar
drwxrwxrwx   1 Everyone        Everyone              0 Mar 31 13:44 plugins
drwxrwxrwx   1 Everyone        Everyone              0 Mar 31 13:44 runtime
-rwxrwxrwa   1 Everyone        Everyone          23563 Oct 29  2004 
saxpath-1.0-FCS.jar
-rwxrwxrwa   1 Everyone        Everyone            840 Jan 30 22:55 
taskdef.xml
-rwxrwxrwa   1 Everyone        Everyone        1098032 Mar  5 20:44 
webtest.jar
-rwxrwxrwa   1 Everyone        Everyone           3050 Apr 20 20:12 
webtestScriptStep500.jar

======================================
the build environment: <end>
======================================