OpenScript错误:脚本部分:未指定。 java.lang.NoSuchFieldError:id_ecPublicKey

时间:2017-04-21 16:48:22

标签: openscript

我们正在尝试使用OpenScript为OATS生成负载测试。该脚本将调用org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter进行身份验证。我们在脚本中遇到以下错误:

10:22:56,860 ERROR [1] Error in section Unspecified at line unknown. 
       ScriptException occured. 
       An unexpected exception occurred in the script. 
       Script section: Unspecified.

java.lang.NoSuchFieldError: id_ecPublicKey
    at org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter.<clinit>(Unknown Source)
    at com.oracle.bmc.http.signing.internal.PEMFileRSAPrivateKeySupplier.<init>(PEMFileRSAPrivateKeySupplier.java:46)
    at com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory.createKeySupplier(DefaultRequestSignerFactory.java:108)
    at com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory.createRequestSigner(DefaultRequestSignerFactory.java:51)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:98)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:73)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:59)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:48)
    at script.run(script.java:38)
    at oracle.oats.scripting.modules.basic.api.IteratingVUser.run(IteratingVUser.java:353)
    at oracle.oats.scripting.modules.basic.api.internal.IteratingAgent.run(IteratingAgent.java:801)
    at java.lang.Thread.run(Thread.java:745)

之前有没有人见过同样的问题?

仅当项目创建为脚本时才会发生此错误。如果我们将项目创建为通用Java项目,它可以正常工作。我们的猜测是在使用脚本时有一些lib不匹配导致它使用id_ecPublicKey。

感谢。

1 个答案:

答案 0 :(得分:0)

我也有这个错误。它来自jar文件冲突。

当我排除相对于“org.bouncycastle”的某些依赖项时,如下面的Maven代码,那么错误就会消失。

    <dependency>
        <groupId>com.googlecode.rapid-framework</groupId>
        <artifactId>rapid-core</artifactId>
        <version>4.0.5</version>
        <exclusions>
            <exclusion>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk15on</artifactId>
        <version>1.52</version>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-jdk15on</artifactId>
        <version>1.52</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.10</version>
    </dependency>