Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Tobias Käfer
PortletPreferences in Control Panel (LR 6.0.5 CE)
January 30, 2011 11:57 PM
Answer

Tobias Käfer

Rank: Regular Member

Posts: 128

Join Date: March 28, 2008

Recent Posts

Hi!

I just wanted to place the configuration for a portlet into the Control Panel.
Everything works fine until you have saved a something into the PortletPreferences, eg. using Sping Portlet MVC:
 1  @Override
 2  protected void onSubmitAction(ActionRequest request, ActionResponse response, Object command, BindException errors) {
 3    FormBackingObject formBackingObject = (FormBackingObject) command;
 4    PortletPreferences portletPreferences = request.getPreferences();
 5    String _urlString = FormBackingObject.getUrl();
 6    portletPreferences.setValue(FormBackingObject.PREF_KEY_URL, _urlString);
 7
 8    try {
 9      portletPreferences.store();
10    } catch (Exception e) {
11      logger.error("onSubmitAction: portletPreferences.store();");
12      logger.error(e);
13    }
14
15  }


If you afterwards try to access the Control Panel (it does not matter, if you do it for a community, user etc.) you will end up with a NullPointException:
  108:35:47,781 INFO  [PortalImpl:3812] Current URL /group/control_panel?doAsGroupId=11602&refererPlid=14901 generates exception: java.lang.NullPointerException
  208:35:47,868 ERROR [jsp:?] org.apache.jasper.JasperException: java.lang.NullPointerException
  3org.apache.jasper.JasperException: java.lang.NullPointerException
  4    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
  5    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
  6    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
  7    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
  8    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  9    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 10    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 11    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
 12    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
 13    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
 14    at com.liferay.portal.action.LayoutAction.includeLayoutContent(LayoutAction.java:361)
 15    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:618)
 16    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:229)
 17    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 18    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
 19    at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:152)
 20    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 21    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
 22    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 23    at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:508)
 24    at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:485)
 25    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 26    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 27    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 28    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 29    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
 30    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 31    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 32    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 33    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
 34    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 35    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 36    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 37    at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:309)
 38    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 39    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 40    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 41    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 42    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
 43    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 44    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 45    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 46    at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:137)
 47    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 48    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 49    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 50    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 51    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
 52    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 53    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 54    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 55    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 56    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:254)
 57    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 58    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 59    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 60    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
 61    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
 62    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 63    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 64    at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:133)
 65    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 66    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 67    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 68    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 69    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
 70    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 71    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 72    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 73    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
 74    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 75    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 76    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 77    at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:261)
 78    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 79    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 80    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 81    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 82    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
 83    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 84    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 85    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 86    at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:126)
 87    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 88    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 89    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 90    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 91    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
 92    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 93    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 94    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 95    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
 96    at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:221)
 97    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
 98    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 99    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
100    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
101    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
102    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
103    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
104    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
105    at com.liferay.portal.servlet.filters.cache.CacheFilter.processFilter(CacheFilter.java:440)
106    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
107    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
108    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
109    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
110    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
111    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
112    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
113    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
114    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:254)
115    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
116    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
117    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
118    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
119    at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:81)
120    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
121    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
122    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
123    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
124    at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:179)
125    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
126    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
127    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
128    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
129    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:239)
130    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
131    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
132    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
133    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
134    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
135    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
136    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
137    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
138    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
139    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
140    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
141    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
142    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
143    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
144    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
145    at com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter.processFilter(ThreadLocalFilter.java:35)
146    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
147    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
148    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
149    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
150    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
151    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
152    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
153    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
154    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
155    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
156    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
157    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
158    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
159    at java.lang.Thread.run(Thread.java:619)
160Caused by: java.lang.NullPointerException
161    at com.liferay.portlet.PortletConfigFactoryImpl.create(PortletConfigFactoryImpl.java:39)
162    at com.liferay.portlet.PortletConfigFactoryUtil.create(PortletConfigFactoryUtil.java:31)
163    at com.liferay.portal.util.PortalImpl.getPortletTitle(PortalImpl.java:2521)
164    at com.liferay.portal.util.PortalUtil.getPortletTitle(PortalUtil.java:774)
165    at org.apache.jsp.html.portal.layout.view.control_005fpanel_jsp._jspService(Unknown Source)
166    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
167    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
168    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
169    ... 154 more



Any hints on this? Is it a bug or do the portlet standard mechanisms for PortletPreferences not apply to the Control Panel?

Cheers
Tobias