0

Alfresco Enterprise 4.1.5 の JavaScript コンソールで、パラメータとして json 文字列または json オブジェクトを指定してjsonUtils.toObjectメソッドを使用しようとすると、次のエラーが発生します。

参照:

http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Freferences%2Fapi-ws-obj-jsonUtils.html

toObject(jsonString) JSON 文字列を受け取り、それをネイティブ JavaScript オブジェクトに変換します。

toObject(jsonObject) JSON オブジェクトを受け取り、それをネイティブ JavaScript オブジェクトに変換します。

テスト 1

var jsonString = '{"test": "test"}';
logger.log( jsonUtils.toObject(jsonString) );

エラー:

500 Internal Error
An error inside the HTTP server which prevented it from fulfilling the request.
10080038 Wrapped Exception (with status template): 10080143 Failed to execute script 'Javascript Console Script': 10080142 TypeError: Cannot find default value for object. (fb91e06fb1303a88bc57085eaaf9692f.js#2)

Wrapped Exception (with status template): 10080063 Failed to execute script 'Javascript Console Script': 10080062 TypeError: Cannot find default value for object. (b7b11bfd779a718cabdce9ea9162012f.js#5)
 org.springframework.extensions.webscripts.WebScriptException: 10080013 Wrapped Exception (with status template): 10080063 Failed to execute script 'Javascript Console Script': 10080062 TypeError: Cannot find default value for object. (b7b11bfd779a718cabdce9ea9162012f.js#5)
    at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1067)
    at de.fme.jsconsole.ExecuteWebscript.executeScriptContent(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript.access$100(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$2.execute(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$2.execute(Unknown Source)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:401)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:291)
    at de.fme.jsconsole.ExecuteWebscript.runWithTransactionIfNeeded(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript.access$000(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$1.doWork(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$1.doWork(Unknown Source)
    at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:529)
    at de.fme.jsconsole.ExecuteWebscript.runScriptWithTransactionAndAuthentication(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript.execute(Unknown Source)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:365)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:517)
    at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:333)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
    at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:680)
Caused by: org.alfresco.scripts.ScriptException: 10080063 Failed to execute script 'Javascript Console Script': 10080062 TypeError: Cannot find default value for object. (b7b11bfd779a718cabdce9ea9162012f.js#5)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:202)
    at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
    at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
    at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
    ... 36 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: 10080062 TypeError: Cannot find default value for object. (b7b11bfd779a718cabdce9ea9162012f.js#5)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:516)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:198)
    ... 39 more
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot find default value for object. (b7b11bfd779a718cabdce9ea9162012f.js#5)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
    at org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3368)
    at org.mozilla.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:758)
    at org.mozilla.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:677)
    at org.mozilla.javascript.ScriptRuntime.toString(ScriptRuntime.java:707)
    at org.mozilla.javascript.NativeJavaObject.coerceTypeImpl(NativeJavaObject.java:633)
    at org.mozilla.javascript.Context.jsToJava(Context.java:1705)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:209)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
    at org.mozilla.javascript.gen.c19._c0(b7b11bfd779a718cabdce9ea9162012f.js:5)
    at org.mozilla.javascript.gen.c19.call(b7b11bfd779a718cabdce9ea9162012f.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
    at org.mozilla.javascript.gen.c19.call(b7b11bfd779a718cabdce9ea9162012f.js)
    at org.mozilla.javascript.gen.c19.exec(b7b11bfd779a718cabdce9ea9162012f.js)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:492)         

テスト 2

var jsonString = "{'test': 'test'}"; 
logger.log( jsonUtils.toObject(jsonString) );

エラー:

500 Internal Error
An error inside the HTTP server which prevented it from fulfilling the request.
10080036 Wrapped Exception (with status template): 10080132 Failed to execute script 'Javascript Console Script': null

org.springframework.extensions.webscripts.WebScriptException: 10080037 Wrapped Exception (with status template): 10080138 Failed to execute script 'Javascript Console Script': null
    at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1067)
    at de.fme.jsconsole.ExecuteWebscript.executeScriptContent(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript.access$100(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$2.execute(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$2.execute(Unknown Source)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:401)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:291)
    at de.fme.jsconsole.ExecuteWebscript.runWithTransactionIfNeeded(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript.access$000(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$1.doWork(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript$1.doWork(Unknown Source)
    at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:529)
    at de.fme.jsconsole.ExecuteWebscript.runScriptWithTransactionAndAuthentication(Unknown Source)
    at de.fme.jsconsole.ExecuteWebscript.execute(Unknown Source)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:365)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:517)
    at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:333)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
    at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:680)
Caused by: org.alfresco.scripts.ScriptException: 10080138 Failed to execute script 'Javascript Console Script': null
    at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:202)
    at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
    at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
    at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
    ... 36 more
Caused by: java.lang.NullPointerException
    at org.springframework.extensions.webscripts.json.JSONUtils.toObject(JSONUtils.java:138)
    at org.springframework.extensions.webscripts.json.JSONUtils.toObject(JSONUtils.java:118)
    at sun.reflect.GeneratedMethodAccessor582.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
    at org.mozilla.javascript.gen.c48._c0(9070d44753d964f375056b15cfef5a86.js:7)
    at org.mozilla.javascript.gen.c48.call(9070d44753d964f375056b15cfef5a86.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
    at org.mozilla.javascript.gen.c48.call(9070d44753d964f375056b15cfef5a86.js)
    at org.mozilla.javascript.gen.c48.exec(9070d44753d964f375056b15cfef5a86.js)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:492)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:198)
    ... 39 more 

テスト 3

var jsonString = {'test': 'test'};
logger.log( jsonUtils.toObject(jsonString) );  

エラー:

500 Internal Error
An error inside the HTTP server which prevented it from fulfilling the request.
10080041 Wrapped Exception (with status template): 10080162 Failed to execute script 'Javascript Console Script': null
4

1 に答える 1