5 Replies Latest reply on Jan 10, 2007 12:12 PM by peterj

    Can't setValue to PortletPreferences in JBOSS_2.4.0

    trungquoc2080

      I'm using Jboss version 2.4.0 to host portlets but I can't setValue to PortletPrefernces. Once more thing, the methods below runs well in JetSpeed_2.0 and WebSphere, but it throws exception in Jboss_2.4.0. Please see the codes below:

      private void processSubmitEditLearningProgramAction(ActionRequest request){
      PortletPreferences portletPref = request.getPreferences();

      String loginUsername = request.getParameter(Constant.LOGIN_USERNAME);
      String loginPassword = request.getParameter(Constant.LOGIN_PASSWORD);
      System.out.println("+++++ spURL:"+spURL);
      try {
      portletPref.setValue(Constant.LOGIN_USERNAME, loginUsername);
      portletPref.setValue(Constant.LOGIN_PASSWORD, loginPassword);

      portletPref.store();
      } catch (Exception ex) {
      System.out.println("Error at function processSubmitEditLearningProgramAction store when submit....");
      ex.printStackTrace();
      }
      }

      When call this method, it throws an error:
      10:18:58,879 INFO [STDOUT] +++++ loginUsername:admin
      10:18:58,879 INFO [STDOUT] Error at function processSubmitEditLearningProgramAction store when submit....
      10:18:58,879 ERROR [STDERR] javax.portlet.ReadOnlyException: Key spURL cannot be written
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.portlet.impl.jsr168.PortletPreferencesImpl.setValue(PortletPreferencesImpl.java:217)
      10:18:58,879 ERROR [STDERR] at com.skillsoft.adp.web.portlet.LearningProgramsPortlet.processSubmitEditLearningProgramAction(LearningProgramsPortlet.java:225)
      10:18:58,879 ERROR [STDERR] at com.skillsoft.adp.web.portlet.LearningProgramsPortlet.processAction(LearningProgramsPortlet.java:135)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.portlet.container.PortletContainer.invokeAction(PortletContainer.java:494)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.portlet.container.PortletContainer.dispatch(PortletContainer.java:435)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.portlet.container.PortletContainerInvoker$1.dispatch(PortletContainerInvoker.java:143)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.portlet.invocation.PortletInvocation.dispatch(PortletInvocation.java:242)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:140)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org$jboss$portal$core$aspects$portlet$TransactionInterceptor$invokeNotSupported$aop(TransactionInterceptor.java:85)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_4827075286966232824.invokeNext(TransactionInterceptor$invokeNotSupported_4827075286966232824.java)
      10:18:58,879 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
      10:18:58,879 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:101)
      10:18:58,879 ERROR [STDERR] at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_4827075286966232824.invokeNext(TransactionInterceptor$invokeNotSupported_4827075286966232824.java)

      If you know how to solve this problem, please help me. Thanks.