1 Reply Latest reply on Dec 14, 2013 5:02 PM by dcdh1983

    org.gatein.portal:exo.portal.webui.portal loading issue under custom portlet

    dcdh1983

      Hello,

       

      I am developing a portlet under gatein an I need to retrieve the current user logged in the portal.

      I have inserted in my pom.xml this dependency

      <dependency>

            <groupId>org.gatein.portal</groupId>

            <artifactId>exo.portal.webui.portal</artifactId>

            <version>3.6.3.Final-redhat-4</version>

            <scope>provided</scope>

      </dependency>

      I am using this code to know if the user is logged or not.

       

      import javax.annotation.PostConstruct;

      import javax.ejb.Stateless;

       

      import org.exoplatform.portal.application.PortalRequestContext;

      import org.exoplatform.portal.webui.util.Util;

       

      @Stateless

      public class UserService {

       

        private PortalRequestContext context;

        @PostConstruct

        private void init() {

          context = Util.getPortalRequestContext();

        }

       

        public boolean isUserLoggedIn() {

          return (context.getRemoteUser() == null);

        }

      }

       

      However the deployment process failed :

       

      Caused by: java.lang.NoClassDefFoundError: Lorg/exoplatform/portal/application/PortalRequestContext;

          at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_25]

          at java.lang.Class.privateGetDeclaredFields(Class.java:2387) [rt.jar:1.7.0_25]

          at java.lang.Class.getDeclaredFields(Class.java:1796) [rt.jar:1.7.0_25]

          at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]

          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68) [jboss-as-server-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]

          ... 10 more

      Caused by: java.lang.ClassNotFoundException: org.exoplatform.portal.application.PortalRequestContext from [Module "deployment.portlets.ear.portlets-ejb-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.2.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.2.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.2.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.2.Final-redhat-1]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.2.Final-redhat-1]

          ... 15 more

       

      The jar file is present under /jboss-jpp-6.1/jboss-jpp-6.1/modules/system/layers/gatein/org/gatein/lib/main/exo.portal.webui.portal-3.6.3.Final-redhat-4.jar

      so it should be already loaded by JBoss.

       

      Am I missing somethings ?

      Thanks by advance.

      Damien

        • 1. Re: org.gatein.portal:exo.portal.webui.portal loading issue under custom portlet
          dcdh1983

          The solution is given from this thread:

          https://community.jboss.org/message/827774

           

          I have change my pom.xml generating my ejb with theses lines:

          <build>

            <plugins>

              <plugin>

                <artifactId>maven-ejb-plugin</artifactId>

                <version>2.3</version>

                <configuration>

                  <!-- Tell Maven we are using EJB 3.1 -->

                  <ejbVersion>3.1</ejbVersion>

                  <archive>

                    <manifestEntries>

                      <Dependencies>org.gatein.lib</Dependencies>

                    </manifestEntries>

                  </archive>

                </configuration>

              </plugin>

            </plugins>

          </build>

           

          The objective is to load jars module listed in this file (/jboss-jpp-6.1/jboss-jpp-6.1/modules/system/layers/gatein/org/gatein/lib/main/module.xml)

          as a dependency in the MANIFEST.MF file present on the META-INF directory.

           

          Theses jars are marked as provided dependencies in my portlet pom.xml and refer to gatein libs.

           

          Hope it will help.

          Regards,

           

          Damien