Main Content

Magnolia Community Forums: Get help with Magnolia: Error calling IcndbService via restfn templating function


  • butta
    butta
    Full name: Marco
    Posts: 6
    Last post: Jun 12, 2017 6:28:36 PM
    Registered on: May 11, 2017
    Error calling IcndbService via restfn templating function
    #1 by butta on May 11, 2017 6:20:15 PM

    Hello,

    I have implemented an interface IcndbService to make a REST call to http://api.icndb.com, as indicated at: https://documentation.magnolia-cms.com/display/DOCS/REST+client+module#RESTclientmodule-Serviceinterfacedeclaration
    If I make the call using Rest Client App it works succesfully, but if I make the call in a page using restfn templating function, in this way:

    [#assign response = restfn.call("icndbClient", "com.example.IcndbService", "com.example.IcndbService.joke", ["random"]) /]

    I receive the following error:

    Java method "info.magnolia.resteasy.client.functions.RestTemplatingFunctions.call(String, String, String, Object...)" threw an exception when invoked on info.magnolia.resteasy.client.functions.RestTemplatingFunctions object "info.magnolia.resteasy.client.functions.RestTemplatingFunctions@61f8cd28"; see cause exception in the Java stack trace.

    ----
    FTL stack trace ("~" means nesting-related):
    - Failed at: #assign response = restfn.call("icndb... [in template "startbootstrap-blog-home-gh-pages/templates/pages/myEndPoint.ftl" at line 20, column 1]
    ----

    Java stack trace (for programmers):
    ----
    freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
    at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:289)
    at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:261)
    at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:65)
    at freemarker.core.MethodCall._eval(MethodCall.java:65)
    at freemarker.core.Expression.eval(Expression.java:81)
    at freemarker.core.Assignment.accept(Assignment.java:134)
    at freemarker.core.Environment.visit(Environment.java:327)
    at freemarker.core.Environment.visit(Environment.java:333)
    at freemarker.core.Environment.process(Environment.java:306)
    at freemarker.template.Template.process(Template.java:386)
    at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:168)
    at info.magnolia.rendering.renderer.FreemarkerRenderer.onRender(FreemarkerRenderer.java:95)
    at info.magnolia.rendering.renderer.AbstractRenderer.render(AbstractRenderer.java:164)
    at info.magnolia.rendering.engine.DefaultRenderingEngine.render(DefaultRenderingEngine.java:118)
    at info.magnolia.rendering.engine.DefaultRenderingEngine$$EnhancerByCGLIB$$f4f3e95c.render(<generated>)
    at info.magnolia.rendering.engine.RenderingFilter.render(RenderingFilter.java:195)
    at info.magnolia.rendering.engine.RenderingFilter.handleTemplateRequest(RenderingFilter.java:140)
    at info.magnolia.rendering.engine.RenderingFilter.doFilter(RenderingFilter.java:94)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.rendering.model.ModelExecutionFilter.doFilter(ModelExecutionFilter.java:109)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.AggregatorFilter.doFilter(AggregatorFilter.java:100)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.security.BaseSecurityFilter.doFilter(BaseSecurityFilter.java:57)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.RepositoryMappingFilter.doFilter(RepositoryMappingFilter.java:108)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.CompositeFilter.doFilter(CompositeFilter.java:65)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:74)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.CompositeFilter.doFilter(CompositeFilter.java:65)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.VirtualUriFilter.doFilter(VirtualUriFilter.java:69)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.module.cache.executor.Bypass.processCacheRequest(Bypass.java:58)
    at info.magnolia.module.cache.executor.CompositeExecutor.processCacheRequest(CompositeExecutor.java:67)
    at info.magnolia.module.cache.filter.CacheFilter.doFilter(CacheFilter.java:220)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.i18n.I18nContentSupportFilter.doFilter(I18nContentSupportFilter.java:74)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.RangeSupportFilter.doFilter(RangeSupportFilter.java:84)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.security.BaseSecurityFilter.doFilter(BaseSecurityFilter.java:57)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.security.SecurityCallbackFilter.doFilter(SecurityCallbackFilter.java:84)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.security.LogoutFilter.doFilter(LogoutFilter.java:94)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.module.site.filters.SiteMergeFilter.doFilter(SiteMergeFilter.java:119)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MultiChannelFilter.doFilter(MultiChannelFilter.java:83)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.module.cache.filter.GZipFilter.doFilter(GZipFilter.java:73)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.security.auth.login.LoginFilter.doFilter(LoginFilter.java:127)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.CosMultipartRequestFilter.doFilter(CosMultipartRequestFilter.java:92)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.ContentTypeFilter.doFilter(ContentTypeFilter.java:155)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.ContextFilter.doFilter(ContextFilter.java:128)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.CompositeFilter.doFilter(CompositeFilter.java:65)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.SafeDestroyMgnlFilterWrapper.doFilter(SafeDestroyMgnlFilterWrapper.java:107)
    at info.magnolia.cms.filters.MgnlFilterDispatcher.doDispatch(MgnlFilterDispatcher.java:67)
    at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:108)
    at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:94)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.NoSuchMethodException: com.sun.proxy.$Proxy126.com.example.IcndbService.joke(java.lang.String)
    at java.lang.Class.getMethod(Class.java:1786)
    at info.magnolia.resteasy.client.functions.RestTemplatingFunctions.call(RestTemplatingFunctions.java:80)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1458)
    at freemarker.ext.beans.ReflectionCallableMemberDescriptor.invokeMethod(ReflectionCallableMemberDescriptor.java:56)
    at freemarker.ext.beans.MemberAndArguments.invokeMethod(MemberAndArguments.java:51)
    at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:61)
    ... 113 more

    What is wrong?
    Thank you in advance!

  • had
    had
    Full name: Jan Haderka
    Posts: 1,406
    Last post: May 12, 2017 8:31:00 AM
    Re: Error calling IcndbService via restfn templating function
    #2 by had on May 12, 2017 8:31:00 AM

    Hi Marco,

    while the 2 query parameters are optional, rest functions have no means of knowing that, so you need to provide values for all parameters that method requires. changing your code to restfn.call("icndbClient", "com.example.IcndbService", "com.example.IcndbService.joke", ["random", null, null]) should fix the problem.

    HTH,
    Jan

  • butta
    butta
    Full name: Marco
    Posts: 6
    Last post: Jun 12, 2017 6:28:36 PM
    Registered on: May 11, 2017
    Re: Error calling IcndbService via restfn templating function
    #3 by butta on May 12, 2017 9:23:32 AM

    Hi Jan,

    thanks for your reply, I've tried as you suggested but it doesn't work.
    I've tried also in the following ways:

    [#assign response = restfn.call("icndbClient", "com.example.IcndbService", "joke", ["random", "Lisa", "Klein"]) /]

    or

    [#assign jokesService = restfn.getService("icndbClient", "com.example.IcndbService")]
    [#assign params = ["random", "Lisa", "Klein"]]
    [#assign response = restfn.call(jokesService, "joke", params)]

    but I receive always the same error:

    Java method "info.magnolia.resteasy.client.functions.RestTemplatingFunctions.call(Object, String, Object...)" threw an exception when invoked on info.magnolia.resteasy.client.functions.RestTemplatingFunctions object "info.magnolia.resteasy.client.functions.RestTemplatingFunctions@6c896bd"; see cause exception in the Java stack trace.

    ----
    FTL stack trace ("~" means nesting-related):
    - Failed at: #assign response = restfn.call(jokesS... [in template "startbootstrap-blog-home-gh-pages/templates/pages/myEndPoint.ftl" at line 14, column 1]
    ----

    Java stack trace (for programmers):
    ----
    freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
    at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:289)
    at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:261)
    at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:65)
    at freemarker.core.MethodCall._eval(MethodCall.java:65)
    at freemarker.core.Expression.eval(Expression.java:81)
    at freemarker.core.Assignment.accept(Assignment.java:134)
    at freemarker.core.Environment.visit(Environment.java:327)
    at freemarker.core.Environment.visit(Environment.java:333)
    at freemarker.core.Environment.process(Environment.java:306)
    at freemarker.template.Template.process(Template.java:386)
    at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:168)
    at info.magnolia.rendering.renderer.FreemarkerRenderer.onRender(FreemarkerRenderer.java:95)
    at info.magnolia.rendering.renderer.AbstractRenderer.render(AbstractRenderer.java:164)
    at info.magnolia.rendering.engine.DefaultRenderingEngine.render(DefaultRenderingEngine.java:118)
    at info.magnolia.rendering.engine.DefaultRenderingEngine$$EnhancerByCGLIB$$b5b56404.render(<generated>)
    at info.magnolia.rendering.engine.RenderingFilter.render(RenderingFilter.java:195)
    at info.magnolia.rendering.engine.RenderingFilter.handleTemplateRequest(RenderingFilter.java:140)
    at info.magnolia.rendering.engine.RenderingFilter.doFilter(RenderingFilter.java:94)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.rendering.model.ModelExecutionFilter.doFilter(ModelExecutionFilter.java:109)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.AggregatorFilter.doFilter(AggregatorFilter.java:100)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.security.BaseSecurityFilter.doFilter(BaseSecurityFilter.java:57)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.RepositoryMappingFilter.doFilter(RepositoryMappingFilter.java:108)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.CompositeFilter.doFilter(CompositeFilter.java:65)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:74)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.CompositeFilter.doFilter(CompositeFilter.java:65)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.VirtualUriFilter.doFilter(VirtualUriFilter.java:69)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.module.cache.executor.Bypass.processCacheRequest(Bypass.java:58)
    at info.magnolia.module.cache.executor.CompositeExecutor.processCacheRequest(CompositeExecutor.java:67)
    at info.magnolia.module.cache.filter.CacheFilter.doFilter(CacheFilter.java:220)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.i18n.I18nContentSupportFilter.doFilter(I18nContentSupportFilter.java:74)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.RangeSupportFilter.doFilter(RangeSupportFilter.java:84)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.security.BaseSecurityFilter.doFilter(BaseSecurityFilter.java:57)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.security.SecurityCallbackFilter.doFilter(SecurityCallbackFilter.java:84)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.security.LogoutFilter.doFilter(LogoutFilter.java:94)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.module.site.filters.SiteMergeFilter.doFilter(SiteMergeFilter.java:119)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MultiChannelFilter.doFilter(MultiChannelFilter.java:83)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.module.cache.filter.GZipFilter.doFilter(GZipFilter.java:73)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.security.auth.login.LoginFilter.doFilter(LoginFilter.java:127)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:81)
    at info.magnolia.cms.filters.CosMultipartRequestFilter.doFilter(CosMultipartRequestFilter.java:92)
    at info.magnolia.cms.filters.OncePerRequestAbstractMgnlFilter.doFilter(OncePerRequestAbstractMgnlFilter.java:59)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.ContentTypeFilter.doFilter(ContentTypeFilter.java:155)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.ContextFilter.doFilter(ContextFilter.java:128)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.MgnlFilterChain.doFilter(MgnlFilterChain.java:79)
    at info.magnolia.cms.filters.CompositeFilter.doFilter(CompositeFilter.java:65)
    at info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:85)
    at info.magnolia.cms.filters.SafeDestroyMgnlFilterWrapper.doFilter(SafeDestroyMgnlFilterWrapper.java:107)
    at info.magnolia.cms.filters.MgnlFilterDispatcher.doDispatch(MgnlFilterDispatcher.java:67)
    at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:108)
    at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:94)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.NoSuchMethodException: com.sun.proxy.$Proxy120.joke(java.lang.String)
    at java.lang.Class.getMethod(Class.java:1786)
    at info.magnolia.resteasy.client.functions.RestTemplatingFunctions.call(RestTemplatingFunctions.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1458)
    at freemarker.ext.beans.ReflectionCallableMemberDescriptor.invokeMethod(ReflectionCallableMemberDescriptor.java:56)
    at freemarker.ext.beans.MemberAndArguments.invokeMethod(MemberAndArguments.java:51)
    at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:61)
    ... 113 more

  • cmeier
    cmeier
    Full name: Christoph Meier
    Posts: 211
    Last post: Aug 29, 2017 3:50:38 PM
    Re: Error calling IcndbService via restfn templating function
    #4 by cmeier on May 12, 2017 10:04:59 AM

    Hi Marco
    I have tried out the expression proposed by Jan. I had te same result as you.

    To be honest, i also was struggling a few times while using restfn.
    And at some point i started to use it this way:

    [#assign res5 = restfn.call( "icndbClient", "info.magnolia.documentation.modules.restclientexamples.service.IcndbService", "joke", ["random", "John", "Doe"]) /]
    <i>${res5.get("value").get("joke").getTextValue()!"Nix found"}</i><br/>


    On our git repo is a public but never announced module with rest-client-examples examples.
    It contains a component where i fiddle around with the jokes service.

    cheers,
    Christoph

  • butta
    butta
    Full name: Marco
    Posts: 6
    Last post: Jun 12, 2017 6:28:36 PM
    Registered on: May 11, 2017
    Re: Error calling IcndbService via restfn templating function
    #5 by butta on May 15, 2017 1:01:32 PM

    Hi Christoph,

    I've looked at your examples and the following ways don't work due to the same error:

    [#assign res3 = restfn.call(jokesService, "joke",params ) /]

    [#assign res4 = restfn.call( "icndbClient", "info.magnolia.documentation.modules.restclientexamples.service.IcndbService", "joke", params) /]

    [#assign res5 = restfn.call( "icndbClient", "info.magnolia.documentation.modules.restclientexamples.service.IcndbService", "joke", ["random", "John", "Doe"]) /]

    But, thanks to your examples, I've found that in this way it works:

    [#assign response = jokesService.joke("random", "Tiger", "Lilly") /]

    So I will use it in that way.
    Thank you very much for your help!

    Ciao
    Marco

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/