0

我遇到了非常有线的问题。脚本工作正常,但是当我在 ForgeRock idm 下运行它时出现错误。我不确定那个错误是什么。

100] Jun 14, 2020 5:18:24.214 PM org.forgerock.openidm.servlet.internal.ServletConnectionFactory$3 lambda$handleRequestWithLogging$8
WARNING: Resource exception: 500 Internal Server Error: "onCreate script encountered exception"
org.forgerock.json.resource.InternalServerErrorException: onCreate script encountered exception
    at org.forgerock.openidm.managed.ManagedObjectSet.lambda$execScript$3(ManagedObjectSet.java:517)
    at org.forgerock.openidm.metrics.MetricsCollector.time(MetricsCollector.java:51)
    at org.forgerock.openidm.metrics.MetricsCollector.time(MetricsCollector.java:68)
    at org.forgerock.openidm.managed.ManagedObjectSet.execScript(ManagedObjectSet.java:495)
    at org.forgerock.openidm.managed.ManagedObjectSet.execScriptHook(ManagedObjectSet.java:474)
    at org.forgerock.openidm.managed.ManagedObjectSet.createInstance(ManagedObjectSet.java:959)
    at org.forgerock.json.resource.InterfaceCollectionHandler.handleCreate(InterfaceCollectionHandler.java:35)
    at org.forgerock.json.resource.Router.handleCreate(Router.java:265)
    at org.forgerock.openidm.managed.ManagedObjectService$ManagedObjectSetRequestHandler.handleCreate(ManagedObjectService.java:259)
    at org.forgerock.json.resource.FilterChain$Cursor.handleCreate(FilterChain.java:65)


Caused by: javax.script.ScriptException: TypeError: Cannot call method "replace" of undefined
    at org.forgerock.openidm.script.javascript.RhinoScriptEngine$3.newScriptException(RhinoScriptEngine.java:499)
    at org.forgerock.openidm.script.javascript.RhinoScript.eval(RhinoScript.java:261)
    at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.forgerock.openidm.script.registry.ScriptRegistryImpl$LibraryRecord.invoke(ScriptRegistryImpl.java:539)
    at com.sun.proxy.$Proxy55.eval(Unknown Source)
    at org.forgerock.openidm.script.registry.ScriptRegistryImpl$ScriptImpl.eval(ScriptRegistryImpl.java:814)
    at org.forgerock.openidm.script.registry.ScriptRegistryImpl$ScriptImpl.eval(ScriptRegistryImpl.java:825)
    at org.forgerock.openidm.managed.ManagedObjectSet.lambda$execScript$3(ManagedObjectSet.java:509)
    ... 150 more
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "replace" of undefined (file:/opt/openidm/script/generateSamAccountName.js#24)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712)
    at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3731)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2258)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2251)
    at org.mozilla.javascript.gen.file__opt_openidm_script_generateSamAccountName_js_41._c_replaceString_4(file:/opt/openidm/script/generateSamAccountName.js:24)
    at org.mozilla.javascript.gen.file__opt_openidm_script_generateSamAccountName_js_41.call(file:/opt/openidm/script/generateSamAccountName.js)
    at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
    at org.mozilla.javascript.gen.file__opt_openidm_script_generateSamAccountName_js_41._c_generateSamAccountName_5(file:/opt/openidm/script/generateSamAccountName.js:39)
    at org.mozilla.javascript.gen.file__opt_openidm_script_generateSamAccountName_js_41.call(file:/opt/openidm/script/generateSamAccountName.js)
    at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
    at org.mozilla.javascript.gen.file__opt_openidm_script_generateSamAccountName_js_41._c_anonymous_1(file:/opt/openidm/script/generateSamAccountName.js:6)
    at org.mozilla.javascript.gen.file__opt_openidm_script_generateSamAccountName_js_41.call(file:/opt/openidm/script/generateSamAccountName.js)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
    at org.mozilla.javascript.gen._1E59BF9390C34C7ACCB99E616798559AD7DDD85B_15._c_script_0(1E59BF9390C34C7ACCB99E616798559AD7DDD85B:2)
    at org.mozilla.javascript.gen._1E59BF9390C34C7ACCB99E616798559AD7DDD85B_15.call(1E59BF9390C34C7ACCB99E616798559AD7DDD85B)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.mozilla.javascript.gen._1E59BF9390C34C7ACCB99E616798559AD7DDD85B_15.call(1E59BF9390C34C7ACCB99E616798559AD7DDD85B)
    at org.mozilla.javascript.gen._1E59BF9390C34C7ACCB99E616798559AD7DDD85B_15.exec(1E59BF9390C34C7ACCB99E616798559AD7DDD85B)
    at org.forgerock.openidm.script.javascript.RhinoScript.eval(RhinoScript.java:231)

有谁知道为什么我不能运行这个?

function replaceString(string) {
  string = string.replace("ö", "oe");
  return string;
}
4

0 回答 0