Never mind - it was staring me in the face...

I missed a semi-colon on the line 'String pref_ids = ",956088,3541752,54126386,17413808,956136,"'

I think I've been using Python too long...

I'm curious why this didn't raise an error in JMeter 2.3RC4 (same Beanshell JAR)...

        # r

Ronan Klyne wrote:

Morning all,

I've got a file full of BeanShell functions that I need to use to initialise pre- and post-processors. I've got the config sorted, but I get parse errors. The file is known to be good.
Any advice or pointers would be greatly appreciated....


I can see a long exception trace in the JMeter log file, starting with "jmeter.util.BeanShellInterpreter: Error invoking bsh method: source Parse error at line 88, column 9. Encountered: vars "
(The full error is at the end of this message)


This is a section of the code that I am trying to use (line 88 is the one beginning "vars.put("):

<beanshell>

void select_coll(JMeterContext ctx, JMeterVariables vars, SampleResult prev, AbstractSampler sampler) {
    String gpd = vars.get("gpd_href");
    String id = "";
    String pref_ids = ",956088,3541752,54126386,17413808,956136,"
// To help with error cases
    vars.put("container", "NONE");

    print("GPD: " + gpd);

</beanshell>



Full exception trace:

2008/07/01 09:11:11 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: source Parse error at line 88, column 9. Encountered: vars 2008/07/01 09:11:11 WARN - jmeter.util.BeanShellInterpreter: Cannot source init file: BC/funcs.bsh org.apache.jorphan.util.JMeterException: Error invoking bsh method: source Parse error at line 88, column 9. Encountered: vars at org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:192) at org.apache.jmeter.util.BeanShellInterpreter.source(BeanShellInterpreter.java:214) at org.apache.jmeter.util.BeanShellInterpreter.init(BeanShellInterpreter.java:151) at org.apache.jmeter.util.BeanShellInterpreter.<init>(BeanShellInterpreter.java:110) at org.apache.jmeter.util.BeanShellTestElement.init(BeanShellTestElement.java:87) at org.apache.jmeter.util.BeanShellTestElement.<init>(BeanShellTestElement.java:58) at org.apache.jmeter.extractor.BeanShellPostProcessor.<init>(BeanShellPostProcessor.java:33) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
at org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:108) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:77) at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at org.apache.jmeter.save.ScriptWrapperConverter.unmarshal(ScriptWrapperConverter.java:96) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:142) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:931)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:917)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)
    at org.apache.jmeter.save.SaveService.loadTree(SaveService.java:397)
    at org.apache.jmeter.gui.action.Load.loadProjectFile(Load.java:107)
at org.apache.jmeter.gui.action.LoadRecentProject.doAction(LoadRecentProject.java:64) at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:80) at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:42) at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:59)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:171)
    ... 89 more
Caused by: Parse error at line 88, column 9.  Encountered: vars
    at bsh.Parser.generateParseException(Unknown Source)
    at bsh.Parser.jj_consume_token(Unknown Source)
    at bsh.Parser.BlockStatement(Unknown Source)
    at bsh.Parser.Block(Unknown Source)
    at bsh.Parser.MethodDeclaration(Unknown Source)
    at bsh.Parser.BlockStatement(Unknown Source)
    at bsh.Parser.Line(Unknown Source)
    at bsh.Interpreter.Line(Unknown Source)
    at bsh.Interpreter.eval(Unknown Source)
    at bsh.Interpreter.source(Unknown Source)
    at bsh.Interpreter.source(Unknown Source)
    ... 94 more



Thanks,

    Ronan




--
Ronan Klyne
Business Collaborator Developer
Tel: +44 01189 028518
[EMAIL PROTECTED]
www.groupbc.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to