org.gatein.portal:exo.portal.webui.portal loading issue under custom portlet
dcdh1983 Dec 14, 2013 4:37 PMHello,
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