cancel
Showing results for 
Search instead for 
Did you mean: 

Why i cant export files with javascript console?

jagpanadero
Champ on-the-rise
Champ on-the-rise

Im using javascript console in alfresco 6.2 and im following this https://hub.alfresco.com/t5/alfresco-content-services-forum/alfresco-export-tool-for-version-6/td-p/... but Unfortunatly im getting this error, what can i do?

500 Internal Error
Stacktrace-Details:
org.springframework.extensions.webscripts.WebScriptException: 09140004 Wrapped Exception (with status template): 09140029 Failed to execute script 'Javascript Console Script': 09140028 The choice of Java method org.alfresco.repo.jscript.ScriptAction.execute matching JavaScript argument types (null) is ambiguous; candidate methods are: 
    void execute(org.alfresco.repo.jscript.ScriptNode)
    void execute(org.alfresco.service.cmr.repository.NodeRef) (Javascript Console Script#16)
	at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1139)
	at de.fme.jsconsole.ExecuteWebscript.executeScriptContent(ExecuteWebscript.java:405)
	at de.fme.jsconsole.ExecuteWebscript.access$100(ExecuteWebscript.java:56)
	at de.fme.jsconsole.ExecuteWebscript$2.execute(ExecuteWebscript.java:280)
	at de.fme.jsconsole.ExecuteWebscript$2.execute(ExecuteWebscript.java:273)
	at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)
	at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:338)
	at de.fme.jsconsole.ExecuteWebscript.runWithTransactionIfNeeded(ExecuteWebscript.java:272)
	at de.fme.jsconsole.ExecuteWebscript.access$000(ExecuteWebscript.java:56)
	at de.fme.jsconsole.ExecuteWebscript$1.doWork(ExecuteWebscript.java:250)
	at de.fme.jsconsole.ExecuteWebscript$1.doWork(ExecuteWebscript.java:247)
	at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
	at de.fme.jsconsole.ExecuteWebscript.runScriptWithTransactionAndAuthentication(ExecuteWebscript.java:247)
	at de.fme.jsconsole.ExecuteWebscript.execute(ExecuteWebscript.java:121)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:467)
	at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:656)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:428)
	at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:308)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
	at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.alfresco.scripts.ScriptException: 09140029 Failed to execute script 'Javascript Console Script': 09140028 The choice of Java method org.alfresco.repo.jscript.ScriptAction.execute matching JavaScript argument types (null) is ambiguous; candidate methods are: 
    void execute(org.alfresco.repo.jscript.ScriptNode)
    void execute(org.alfresco.service.cmr.repository.NodeRef) (Javascript Console Script#16)
	at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:211)
	at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:219)
	at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:181)
	at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:109)
	at de.fme.jsconsole.ExecuteWebscript.executeScriptContent(ExecuteWebscript.java:348)
	... 46 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: 09140028 The choice of Java method org.alfresco.repo.jscript.ScriptAction.execute matching JavaScript argument types (null) is ambiguous; candidate methods are: 
    void execute(org.alfresco.repo.jscript.ScriptNode)
    void execute(org.alfresco.service.cmr.repository.NodeRef) (Javascript Console Script#16)
	at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:533)
	at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:207)
	... 50 more
Caused by: org.mozilla.javascript.EvaluatorException: The choice of Java method org.alfresco.repo.jscript.ScriptAction.execute matching JavaScript argument types (null) is ambiguous; candidate methods are: 
    void execute(org.alfresco.repo.jscript.ScriptNode)
    void execute(org.alfresco.service.cmr.repository.NodeRef) (Javascript Console Script#16)
	at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:77)
	at org.mozilla.javascript.Context.reportRuntimeError(Context.java:998)
	at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1053)
	at org.mozilla.javascript.Context.reportRuntimeError4(Context.java:1040)
	at org.mozilla.javascript.NativeJavaMethod.findFunction(NativeJavaMethod.java:468)
	at org.mozilla.javascript.NativeJavaMethod.findCachedFunction(NativeJavaMethod.java:262)
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:139)
	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
	at org.mozilla.javascript.gen.Javascript_Console_Script_29._c_script_0(Javascript Console Script:16)
	at org.mozilla.javascript.gen.Javascript_Console_Script_29.call(Javascript Console Script)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:405)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3508)
	at org.mozilla.javascript.gen.Javascript_Console_Script_29.call(Javascript Console Script)
	at org.mozilla.javascript.gen.Javascript_Console_Script_29.exec(Javascript Console Script)
	at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:509)
	... 51 more


An error inside the HTTP server which prevented it from fulfilling the request.
09140028 The choice of Java method org.alfresco.repo.jscript.ScriptAction.execute matching JavaScript argument types (null) is ambiguous; candidate methods are: 
    void execute(org.alfresco.repo.jscript.ScriptNode)
    void execute(org.alfresco.service.cmr.repository.NodeRef) (Javascript Console Script#16)
1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

It looks like some part of the Alfresco JS API has evolved, adding an overloaded method. The JavaScript integration in Alfresco cannot deal with a null-value as a parameter when there are overloaded methods because it cannot decide which overload to call. In this case you must call the method with a non-null value - there is no other way. When you followed the thread you linked, you are using something like

companyhome.childByNamePath("Sites/swsdp/documentLibrary")

to resolve the parameter value. If the path in that call does not exist, the method will return a null value - when you use that return value without checking against null in your call to execute, then you will run into the problem you currently have. Either you must adapt the parameter to childByNamePath to a path that really exists, or at least use a null-check in an if-condition to avoid executing the rest of the code if the path cannot be resolved.

View answer in original post

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

It looks like some part of the Alfresco JS API has evolved, adding an overloaded method. The JavaScript integration in Alfresco cannot deal with a null-value as a parameter when there are overloaded methods because it cannot decide which overload to call. In this case you must call the method with a non-null value - there is no other way. When you followed the thread you linked, you are using something like

companyhome.childByNamePath("Sites/swsdp/documentLibrary")

to resolve the parameter value. If the path in that call does not exist, the method will return a null value - when you use that return value without checking against null in your call to execute, then you will run into the problem you currently have. Either you must adapt the parameter to childByNamePath to a path that really exists, or at least use a null-check in an if-condition to avoid executing the rest of the code if the path cannot be resolved.

And where does that get exported? i cant find it anywhere