Search code examples
jmeterpreprocessorjsr223

Script6.groovy: : Unexpected input: Jmeter JSR233 preprocessor error


I am trying to import a jar(imported the jar in testplan) and use the methods to help generate a digital signature in my XML message. But I am seeing the groovy error:

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script6.groovy: 7: Unexpected input: '(' @ line 7, column 59.
   alSignatureFactory.getInstance("C\:\Proj
                                 ^

The code is simple and is as below. why is this complaining at the '('

import com.aciworldwide.generic.stress.simulator.crypto.xml.signing.DigitalSignature;
import com.aciworldwide.generic.stress.simulator.crypto.xml.signing.DigitalSignatureFactory;
import java.util.*
import groovy.xml.*


DigitalSignature sig = DigitalSignatureFactory.getInstance("C:\Projects\NFRPERF\trunk\BI-Fast_CI_HUB\jmeterscripts\crypto\server.keys.p12", "server.key.pair", "aciworldwide", "PKCS12");

Solution

  • You need to either escape these backward slashes with another backward slash, i..e

    "C:\\Projects\\NFRPERF\\trunk\\BI-Fast_CI_HUB\\jmeterscripts\\crypto\\server.keys.p12"
    

    or use forward slashes instead:

    "C:/Projects/NFRPERF/trunk/BI-Fast_CI_HUB/jmeterscripts/crypto/server.keys.p12"
    

    or use Groovy's Slashy String:

    /C:\Projects\NFRPERF\trunk\BI-Fast_CI_HUB\jmeterscripts\crypto\server.keys.p12/
    

    More information: