Results 1 to 3 of 3

Thread: Portlet plugin - portlet api objects not being injected?

  1. #1
    Join Date
    Sep 2010
    Posts
    26

    Default Portlet plugin - portlet api objects not being injected?

    Hi everyone,

    I am trying to do a proof of concept for a grails portlet for our Liferay web portal and can't get the basic out of the box portlet working.

    I create a new Grails project and do the following to create a standard portlet to test the basic functionality:
    • grails install-plugin portlets
    • grails install-plugin portlets-liferay
    • grails create-portlet edu.myschool.GrailsPortlet
    • grails generate-portlet-views Grails
    • Modify the views/grails/view.gsp file so that 'method="POST"' is on the <form> tag (I did this because without it, it appeared to be calling the render phase and bypassing the action phase)
    • grails prod war
    • copy the war over to my liferay hot-deploy directory


    Liferay picks it up and deploys the portlet with no issue. I then log into Liferay and add my portlet, again with no issue. When I click the submit button, the GrailsPortletDispatcher correctly finds the actionView method in the Portlet but I get the following error stating that the portletResponse object cannot be found. The portlet api documentation states that the portletResponse, portletRequest, portletSession, and portletConfiguration are all injected into the your portlet class but that does not seem to be the case here.

    Any ideas? I don't see any bean config for these portlet objects in the application-context or plugin configs. I'm not 100% sure how Grails is auto-injecting beans with its convention over config logic. I tried just using the request and response variables but those are the ServletRequest/Response objects and don't give me what I need.

    I'm compiling with JDK 1.6 and Grails 2.0.1 and deploying to Liferay 6.x running tomcat-7.0.23 on a test OS X Snow Leopard machine

    Here's the error (had to shorten some of the liferay/tomcat lines to make it fit):
    Code:
    13:18:48,414 INFO  [PortletHotDeployListener:433] 1 portlet for GrailsPortlet is available for use
    13:18:59,001 ERROR [PortletServlet:97] javax.portlet.PortletException: Request processing failed
    javax.portlet.PortletException: Request processing failed
        at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:544)
        at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:470)
        at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
        at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
        at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
        at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        ...
    Caused by: groovy.lang.MissingPropertyException: No such property: portletResponse for class: edu.conncoll.examples.portlets.GrailsPortlet
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
        at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
        at edu.conncoll.examples.portlets.GrailsPortlet$_closure1.doCall(GrailsPortlet.groovy:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:226)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at edu.conncoll.examples.portlets.GrailsPortlet$_closure1.doCall(GrailsPortlet.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1047)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
        at groovy.lang.Closure.call(Closure.java:412)
        at groovy.lang.Closure.call(Closure.java:406)
        at org.codehaus.grails.portlets.GrailsPortletHandlerAdapter.handleAction(GrailsPortletHandlerAdapter.java:49)
        at org.springframework.web.portlet.DispatcherPortlet.doActionService(DispatcherPortlet.java:641)
        at org.codehaus.grails.portlets.GrailsDispatcherPortlet.doActionService(GrailsDispatcherPortlet.java:18)
        at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:519)
        at org.springframework.web.portlet.FrameworkPortlet.processAction(FrameworkPortlet.java:460)
        at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
        at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
        at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
        at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
        at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:637)
        at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:686)
        at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:361)
        at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:845)
        at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:633)
        ... 111 more
    13:18:59,007 ERROR [render_portlet_jsp:154] groovy.lang.MissingPropertyException: No such property: portletResponse for class: edu.conncoll.examples.portlets.GrailsPortlet
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
        at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
        at edu.conncoll.examples.portlets.GrailsPortlet$_closure1.doCall(GrailsPortlet.groovy:28)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:226)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1047)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
        at groovy.lang.Closure.call(Closure.java:412)
        at groovy.lang.Closure.call(Closure.java:406)
        at org.codehaus.grails.portlets.GrailsPortletHandlerAdapter.handleAction(GrailsPortletHandlerAdapter.java:49)
        at org.codehaus.grails.portlets.GrailsDispatcherPortlet.doActionService(GrailsDispatcherPortlet.java:18)
        at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
        at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)

  2. #2
    Join Date
    Sep 2010
    Posts
    26

    Default

    UPDATE:

    I tried including the portlet-api-2.0.jar in the WAR file and then dropping it into the tomcat shared lib folder. Neither made a difference

    I also tried adding 'def portletResponse' at the top of the portlet class thinking maybe this was required but just missing from the stub portlet created by 'grails create-portlet'. The error in catalina.out just said that it could not invoke the .setRenderParameter() on a NULL object. So clearly Grails is not injecting these portlet objects for some reason.

    Any help or advice is greatly appreciated!

  3. #3

    Default

    Quote Originally Posted by Brian Riley View Post
    UPDATE:

    I tried including the portlet-api-2.0.jar in the WAR file and then dropping it into the tomcat shared lib folder. Neither made a difference

    I also tried adding 'def portletResponse' at the top of the portlet class thinking maybe this was required but just missing from the stub portlet created by 'grails create-portlet'. The error in catalina.out just said that it could not invoke the .setRenderParameter() on a NULL object. So clearly Grails is not injecting these portlet objects for some reason.

    Any help or advice is greatly appreciated!
    I also think so.

    __________________
    Watch What to Expect When You’re Expecting Online Free

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •