PDA

View Full Version : problem with books mvc portlet in jboss


mackcom
Dec 28th, 2005, 03:35 PM
I've been having problems getting the spring-portlet-sample, books example to work in JBoss portal 2.2. I've tried with the older set of samples and with the new (as of today) set of samples that are refactored to work with Spring 2.0m1.

My environment:
JBoss AS 4.0.3SP1 with JBoss Portal 2.2
Sun Java 1.5.0_05
Spring 2.0m1
Spring-portlet-sample (current version just downloaded today).

This is what I'm experiencing:
I can view all the pages in the books sample with out any problems. The issue occurs with I submit any of the forms (edit book details, add new book) in this example, or click on any of the “update” icons (from book inventory, Increase count, descrease count, or delete book). When I submit any of these actions I get the following exception:

15:10:50,149 ERROR [InvokeWindowActionCommand] An portlet exception occured in portlet /spring-portlet-sample.books
java.lang.NullPointerException
at org.jboss.portal.portlet.impl.ActionRequestImpl.ge tPortletMode(ActionRequestImpl.java:45)
at org.springframework.web.portlet.FrameworkPortlet.p rocessRequest(FrameworkPortlet.java:448)
at org.springframework.web.portlet.FrameworkPortlet.p rocessAction(FrameworkPortlet.java:399)
at org.jboss.portal.portlet.PortletContainer.invokeAc tion(PortletContainer.java:470)
at org.jboss.portal.portlet.PortletContainer.dispatch (PortletContainer.java:411)
at org.jboss.portal.server.app.ComponentInvocation.di spatch(ComponentInvocation.java:66)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:127)
at org.jboss.portal.core.aspects.component.Transactio nInterceptor.invoke(TransactionInterceptor.java:59 )
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.core.aspects.component.HeaderInte rceptor.invoke(HeaderInterceptor.java:37)
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.server.aspects.component.Navigati onInterceptor.invoke(NavigationInterceptor.java:63 )
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.server.aspects.component.CacheInt erceptor.invoke(CacheInterceptor.java:154)
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.server.aspects.component.ModesInt erceptor.invoke(ModesInterceptor.java:38)
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.server.aspects.component.WindowSt atesInterceptor.invoke(WindowStatesInterceptor.jav a:32)
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.bridge.BridgeInterceptor.invoke(B ridgeInterceptor.java:36)
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.portlet.aspects.component.Session PostDispatchInterceptor.invoke(SessionPostDispatch Interceptor.java:71)
at org.jboss.portal.server.app.ComponentInterceptor.i nvoke(ComponentInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
at org.jboss.portal.server.aspects.component.ContextD ispatcherInterceptor$InvokeNextCommand.execute(Con textDispatcherInterceptor.java:116)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.portal.server.servlet.CommandServlet.doG et(CommandServlet.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.inv oke.java:117)
at org.jboss.portal.server.aspects.server.ContentType Interceptor.invoke(ContentTypeInterceptor.java:55)
at org.jboss.portal.server.ServerInterceptor.invoke(S erverInterceptor.java:25)
at org.jboss.portal.server.invocation.Invocation.invo keNext(Invocation.java:117)
.... CUT so that this thread is < 10000 characters.


I believe I have the deployed the portlet correctly because I don’t get any error on deployment. I have not changed anything in the sample code. I see in the readme for the samples that it is suggested that the web.xml may need to change (depending on the container), I didn’t change anything here because I could not find anything on the JBoss site that say I need to, and it has worked for me in the past without changes. Regarding the portlet.tld, the container copied it’s version of this into the WEB-INF/ dir of the deployment, so this should be ok.
I did add a books-object.xml file to the WEB-INF/ dir of the deployment as a descriptor to tell JBoss where to display the portlet. I believe this is correct since it is display the pages/windows correctly. Here are the contents of that file:

<?xml version="1.0" encoding="UTF-8"?>
<deployments>
<deployment>
<if-exists>overwrite</if-exists>
<parent-ref>default</parent-ref>
<properties/>
<page>
<page-name>Books</page-name>
<properties/>
<window>
<window-name>BooksPortletWindow</window-name>
<instance-ref>BooksPortletInstance</instance-ref>
<region>center</region>
<height>0</height>
</window>
</page>
</deployment>
<deployment>
<if-exists>overwrite</if-exists>
<instance>
<instance-name>BooksPortletInstance</instance-name>
<component-ref>/spring-portlet-sample.books</component-ref>
</instance>
</deployment>
</deployments>

I’ve also created my own Spring portlet-mvc portlet and I’m having the same results. It is working great for rendering pages, but is not working at all when handling actions.

Please help, any ideas you have will be appreciated. I’m very excited about getting Spring portlet MVC to work!

johnalewis
Dec 29th, 2005, 12:53 PM
Unfortunately, this looks like a bug in JBoss Portal. Based on your stack trace, it looks like they are throwing an exception when we try to call getPortletMode on an ActionRequest -- this is line with the JSR-168 Spec. Please report this issue to JBoss so that they can correct it on their end.

I've beefed up the code in FrameworkPortlet to catch this exception and simply not include the portlet mode in the application event if it's not available.

This is in JIRA entry SPR-1582: http://opensource2.atlassian.com/projects/spring/browse/SPR-1582

You can get the updated jar file from the nightly build for tonight:
http://oldwww.springframework.org/downloads/nightly/

Or you can send me an email and I will mail you the updated jar file. My email is jlewis -|AT|- arcanumintl -|DOT|- com

sgwood
Dec 29th, 2005, 02:43 PM
I have logged this with the JBoss Portal team. http://jira.jboss.com/jira/browse/JBPORTAL-539



Sherman
JasperSoft

sgwood
Dec 31st, 2005, 08:11 AM
I got the latest build and tested. Still have an NPE, but in a different place.

2005-12-31 04:49:52,171 WARN [org.springframework.web.portlet.DispatcherPortlet] Handler execution resulted in exception - forwarding to resolved error view
java.lang.NullPointerException
at org.jboss.portal.portlet.impl.ActionRequestImpl.ge tPortletMode(ActionRequestImpl.java:45)
at org.springframework.web.portlet.handler.PortletMod eParameterHandlerMapping.getHandlerInternal(Portle tModeParameterHandlerMapping.java:245)
at org.springframework.web.portlet.handler.AbstractHa ndlerMapping.getHandler(AbstractHandlerMapping.jav a:94)
at org.springframework.web.portlet.DispatcherPortlet. getHandler(DispatcherPortlet.java:715)
at org.springframework.web.portlet.DispatcherPortlet. doActionService(DispatcherPortlet.java:528)
at org.springframework.web.portlet.FrameworkPortlet.p rocessRequest(FrameworkPortlet.java:416)
at org.springframework.web.portlet.FrameworkPortlet.p rocessAction(FrameworkPortlet.java:399)
at org.jboss.portal.portlet.PortletContainer.invokeAc tion(PortletContainer.java:470)



Sherman
JasperSoft

johnalewis
Jan 1st, 2006, 11:48 AM
Well, there's not much we can do about that one. This is happening when the PortletModeParameterHandlerMapping tries to determine the portlet mode. Since this is essential to its function, the Exception is appropriate. I'm afraid you will need to take this up with the JBoss Portal gang. This is a pretty serious problem if one can never determine the portlet mode during an action request, so they should be willing to fix this quickly.

sgwood
Jan 1st, 2006, 01:07 PM
I will pass on the issue to the JBoss Portal team. JBPortal 2.2 Final has just been released, so a fix for this will have to be in a point release of 2.2. There may be issues with 2.0, too.


Sherman

sgwood
Jan 16th, 2006, 12:18 PM
This will be fixed in JBoss Portal 2.2.1.

See http://jira.jboss.com/jira/browse/JBPORTAL-539?page=all


Sherman
JasperSoft

mackcom
Jan 20th, 2006, 03:03 PM
I just downloaded JBoss Portal 2.2.1RC1 (dated 2006-01-18) and deployed the test spring portlet and it works now.

Thanks to everyone for their help with this.

ozGuy
Feb 7th, 2008, 05:26 PM
Hi
I am facing the similar problem with Jboss and books portlet.
When i deploy the portlets on Jobss and go to the Jboss portal page, i don't see the mode or book portlet ?
However, helloworld portlet shows up.

Is there anything else that needs to be done.
All i did was to put the portlet-instances.xml and object.xml and deploy this on Jboss.
Am using JBoss 4.2.2GA and Jboss Portal 2.6
====================
portlet-instances.xml:
====================
<deployment>
<instance>
<instance-id>BooksPortletInstance</instance-id>
<portlet-ref>books</portlet-ref>
</instance>
</deployment>

<deployment>
<instance>
<instance-id>HelloworldPortletInstance</instance-id>
<portlet-ref>helloworld</portlet-ref>
</instance>
</deployment>
<deployment>
<instance>
<instance-id>ModePortletInstance</instance-id>
<portlet-ref>modeXX</portlet-ref>
</instance>
</deployment>