0 Replies Latest reply on Dec 12, 2005 7:29 PM by venkat_c

    getPortletContext not working in 2.2 version - cannot find f

    venkat_c

      Hi all,

      I am trying to deploy portal-2.2 on server 4.0.3sp1. I am using mySQLI am getting the following error.

      java.lang.IllegalArgumentException: Unable to find operation findUserByUserName(java.lang.String)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:212)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy114.findUserByUserName(Unknown Source)
      at org.jboss.portal.core.portlet.user.UserPortlet.userRegister(UserPortlet.java:512)

      where the line is : User user = userModule.findUserByUserName(uname);

      I noticed that in the UserPortlet class of 2.2, the userModule is got through getPortletContext rather than InitialContext as in 2.0.1 version of portal implementation. I am attaching both the code below

      2.2 version
      -------------
      public void init()
      throws PortletException
      {
      super.init();

      userModule = (UserModule)getPortletContext().getAttribute("UserModule");
      roleModule = (RoleModule)getPortletContext().getAttribute("RoleModule");
      mailModule = (MailModule)getPortletContext().getAttribute("MailModule");
      portletHelper = new PortletHelper(this);
      ............

      }

      2.0.1 (Working on server 4.0.2)
      ----------------------------------
      public void init()
      throws PortletException
      {
      super.init();
      try
      {
      userModule = (UserModule)new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME);
      roleModule = (RoleModule)new InitialContext().lookup(ModuleConstants.ROLEMODULE_JNDINAME);
      mailModule = (MailModule)new InitialContext().lookup(ModuleConstants.MAILMODULE_JNDINAME);
      }
      catch (NamingException e)
      {
      throw new PortletException(e);
      }

      portletHelper = new PortletHelper(this);
      }


      So why is getPortletContext not working ?? Any help is appreciated.