1 Reply Latest reply on Jun 12, 2007 11:16 AM by glarenzie

    UserModule.findUserByUserName problem

      I am doing the following in a portlet:
      UserModule um = (UserModule)new InitialContext().lookup("java:portal/UserModule");
      System.out.println("UM: " + um);
      User u = um.findUserByUserName("fred");

      and I get this output and error:

      UM: org.jboss.portal.identity.db.HibernateUserModuleImpl@965003
      2007-06-12 10:34:34,137 ERROR [org.jboss.portal.identity.db.HibernateUserModuleImpl] Cannot find user by name fred
      org.hibernate.HibernateException: Unable to locate current JTA transaction

      What is this error trying to tell me?

        • 1. Re: UserModule.findUserByUserName problem

          If anyone else needs to know I found the answer in the 2.4 wiki as follows:
          do this to the jboss-portlet.xml
          <portlet-app>
          ...

          <portlet-name>MyPortlet</portlet-name>

          <trans-attribute>Required</trans-attribute>


          ...

          <service-name>UserModule</service-name>
          <service-class>org.jboss.portal.core.modules.UserModule</service-class>
          <service-ref>:service=Module,type=User</service-ref>

          ...
          </portlet-app>
          Also in that example we ask the portal to propagate the portal transaction to our portlet in order to be able to modify data in the scope of the same request.