Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Get informations about users in my developed portlet Amine RYANE March 12, 2012 8:19 AM
RE: Get informations about users in my developed portlet David H Nebinger March 12, 2012 11:56 AM
RE: Get informations about users in my developed portlet Hitoshi Ozawa March 12, 2012 2:53 PM
RE: Get informations about users in my developed portlet Amine RYANE March 12, 2012 3:20 PM
RE: Get informations about users in my developed portlet Joaquin Cabal March 12, 2012 5:40 PM
RE: Get informations about users in my developed portlet Amine RYANE March 13, 2012 2:36 AM
RE: Get informations about users in my developed portlet Hitoshi Ozawa March 18, 2012 3:45 AM
RE: Get informations about users in my developed portlet Amine RYANE March 18, 2012 4:44 AM
RE: Get informations about users in my developed portlet Amine RYANE March 18, 2012 4:46 AM
RE: Get informations about users in my developed portlet Wail Tkhissi March 13, 2012 2:46 AM
RE: Get informations about users in my developed portlet Siby Mathew March 13, 2012 4:01 AM
RE: Get informations about users in my developed portlet Amine RYANE March 13, 2012 4:28 AM
RE: Get informations about users in my developed portlet Jitendra Rajput March 13, 2012 4:33 AM
RE: Get informations about users in my developed portlet Amine RYANE March 13, 2012 4:53 AM
RE: Get informations about users in my developed portlet Joaquin Cabal March 13, 2012 5:09 AM
RE: Get informations about users in my developed portlet Jitendra Rajput March 13, 2012 5:19 AM
RE: Get informations about users in my developed portlet Wail Tkhissi March 13, 2012 6:01 AM
RE: Get informations about users in my developed portlet Amine RYANE March 13, 2012 6:13 AM
RE: Get informations about users in my developed portlet Manikandan S March 13, 2012 5:42 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 2:30 AM
RE: Get informations about users in my developed portlet Venkat Koppavolu March 14, 2012 3:30 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 3:44 AM
RE: Get informations about users in my developed portlet Siby Mathew March 13, 2012 6:15 AM
RE: Get informations about users in my developed portlet Wail Tkhissi March 13, 2012 6:32 AM
RE: Get informations about users in my developed portlet Siby Mathew March 13, 2012 6:47 AM
RE: Get informations about users in my developed portlet Amine RYANE March 13, 2012 7:03 AM
RE: Get informations about users in my developed portlet Sandeep Nair March 14, 2012 3:50 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 3:56 AM
RE: Get informations about users in my developed portlet Sandeep Nair March 14, 2012 3:58 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 4:12 AM
RE: Get informations about users in my developed portlet Sandeep Nair March 14, 2012 4:19 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 4:27 AM
RE: Get informations about users in my developed portlet Wail Tkhissi March 14, 2012 5:00 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 5:21 AM
RE: Get informations about users in my developed portlet Sandeep Nair March 14, 2012 5:55 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 6:55 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 7:31 AM
RE: Get informations about users in my developed portlet Amine RYANE March 14, 2012 1:26 PM
RE: Get informations about users in my developed portlet Amine RYANE March 17, 2012 3:24 AM
RE: Get informations about users in my developed portlet André Bunse March 17, 2012 4:53 AM
RE: Get informations about users in my developed portlet Amine RYANE March 17, 2012 5:06 AM
RE: Get informations about users in my developed portlet André Bunse March 17, 2012 5:27 AM
RE: Get informations about users in my developed portlet Amine RYANE March 17, 2012 5:29 AM
RE: Get informations about users in my developed portlet André Bunse March 17, 2012 6:08 AM
RE: Get informations about users in my developed portlet Amine RYANE March 17, 2012 6:25 AM
RE: Get informations about users in my developed portlet André Bunse March 17, 2012 6:38 AM
RE: Get informations about users in my developed portlet Amine RYANE March 17, 2012 6:42 AM
RE: Get informations about users in my developed portlet André Bunse March 17, 2012 11:04 AM
RE: Get informations about users in my developed portlet Amine RYANE March 17, 2012 3:00 PM
RE: Get informations about users in my developed portlet Hitoshi Ozawa March 18, 2012 4:54 AM
RE: Get informations about users in my developed portlet Amine RYANE March 18, 2012 5:05 AM
RE: Get informations about users in my developed portlet Amine RYANE March 18, 2012 5:10 AM
RE: Get informations about users in my developed portlet Hitoshi Ozawa March 18, 2012 5:36 AM
RE: Get informations about users in my developed portlet Amine RYANE March 18, 2012 5:33 AM
RE: Get informations about users in my developed portlet Hitoshi Ozawa March 18, 2012 6:01 AM
RE: Get informations about users in my developed portlet Amine RYANE March 18, 2012 6:05 AM
RE: Get informations about users in my developed portlet Hitoshi Ozawa March 18, 2012 2:58 PM
RE: Get informations about users in my developed portlet Amine RYANE March 18, 2012 3:15 PM
RE: Get informations about users in my developed portlet Hitoshi Ozawa March 18, 2012 7:32 PM
RE: Get informations about users in my developed portlet Wail Tkhissi March 19, 2012 7:41 AM
RE: Get informations about users in my developed portlet Amine RYANE March 19, 2012 12:59 PM
Amine RYANE
Get informations about users in my developed portlet
March 12, 2012 8:19 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi,
I use Liferay 6.1 and i developed an J2EE application with JSF, my problem is how can i get some informations about users in one of my jsp pages.

Thank you very much.
David H Nebinger
RE: Get informations about users in my developed portlet
March 12, 2012 11:56 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8425

Join Date: September 1, 2006

Recent Posts

I thought I answered this already today...

User user = PortalUtil.getUser(portletRequest);
Hitoshi Ozawa
RE: Get informations about users in my developed portlet
March 12, 2012 2:53 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

how can i get some informations about users


By "users", are you trying to get information about users beside the currently logged in user?
In that case, do you want information about all users or users satisfying some conditions?
Amine RYANE
RE: Get informations about users in my developed portlet
March 12, 2012 3:20 PM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thanks for your replay,
Im trying to get informations about logged user in liferay current session ( informations such as userId, userName...)

I tested : User user = PortalUtil.getUser(portletRequest);
But i got a java.lang.NullPointerException
Joaquin Cabal
RE: Get informations about users in my developed portlet
March 12, 2012 5:40 PM
Answer

Joaquin Cabal

Rank: Junior Member

Posts: 51

Join Date: September 7, 2009

Recent Posts

Hi Amine,

maybe you can try with this:

ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
User user = themeDisplay.getUser()

This code give you the logged liferay user
Amine RYANE
RE: Get informations about users in my developed portlet
March 13, 2012 2:36 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi Joaquin,

I tried what you gave me, but i still have java.lang.NullPointerException : The value of themeDisplay is null.

Thanks a lot.
Wail Tkhissi
RE: Get informations about users in my developed portlet
March 13, 2012 2:46 AM
Answer

Wail Tkhissi

Rank: New Member

Posts: 12

Join Date: March 12, 2012

Recent Posts

hi,
i have the same problem, and when i tried this piece of code i'm getting this error:


rg.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP:

Une erreur s'est produite à la ligne: 26 dans le fichier jsp: /view.jsp
portletRequest cannot be resolved
23:
24: <%
25:
26: ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
27: System.out.print(themeDisplay);
28: %>
29:


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.GeneratedMethodAccessor355.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy375.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)

Can someone please help us,

Thanks
Siby Mathew
RE: Get informations about users in my developed portlet
March 13, 2012 4:01 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi Jaoquin,
If you are using the code in your JSP.... you can directly use themeDisplay object.
Make sure you have defined these lines in your JSP :
<portlet:defineObjects />
<liferay-theme:defineObjects />


Thanks,
Siby
Amine RYANE
RE: Get informations about users in my developed portlet
March 13, 2012 4:28 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi,
I tried and i stil have null exception error.
Jitendra Rajput
RE: Get informations about users in my developed portlet
March 13, 2012 4:33 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 831

Join Date: January 7, 2011

Recent Posts

could you please verify liferay-theme.tld placed inside web-inf/tld folder or not..

It would be great if you can provide stack trace or piece of code for more information.
Amine RYANE
RE: Get informations about users in my developed portlet
March 13, 2012 4:53 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi Jitendra,

The liferay-theme.tld exist after deploying my J2EE application in liferay/tomcat/webapps/test-portlet.


This is my jsp page:


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>


<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.model.User"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="javax.faces.context.*"%>
<%@page import="javax.portlet.RenderRequest"%>
<%@page import="javax.portlet.PortletRequest"%>
<%@page import="com.liferay.portal.util.PortalUtil"%>
<%@page import="java.util.Map"%>

<portlet:defineObjects />
<liferay-theme:defineObjects />


<%

themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
themeDisplay.getUser();
System.out.print(themeDisplay);
%>




This is the error that i get :

org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP:

Une erreur s'est produite à la ligne: 26 dans le fichier jsp: /view.jsp
portletRequest cannot be resolved
23:
24: <%
25:
26: themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
27: themeDisplay.getUser();
28: System.out.print(themeDisplay);
29: %>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy375.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.23.



Thanks a lot.
Joaquin Cabal
RE: Get informations about users in my developed portlet
March 13, 2012 5:09 AM
Answer

Joaquin Cabal

Rank: Junior Member

Posts: 51

Join Date: September 7, 2009

Recent Posts

Amine, here the problem is that the object "portletRequest" doesn't exists. You can try just "request" in the jsp page

If still have problems, can you try to put that code in the portlet class?, and then you can debug and view what is the problem
Jitendra Rajput
RE: Get informations about users in my developed portlet
March 13, 2012 5:19 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 831

Join Date: January 7, 2011

Recent Posts

its clearly says that "portletRequest" not exist.

Can you please try by renderRequest or actionRequest. ?
Manikandan S
RE: Get informations about users in my developed portlet
March 13, 2012 5:42 AM
Answer

Manikandan S

Rank: Expert

Posts: 492

Join Date: September 15, 2010

Recent Posts

Just give themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);

instead of themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
Wail Tkhissi
RE: Get informations about users in my developed portlet
March 13, 2012 6:01 AM
Answer

Wail Tkhissi

Rank: New Member

Posts: 12

Join Date: March 12, 2012

Recent Posts

Hi,

i'm facing the same problem, i'm developping a web application with jsf and i want to retrieve the user name in this application after i deploy it, when i try the codes that u gave in this thread i get a null pointer exception.

Thanks.
Amine RYANE
RE: Get informations about users in my developed portlet
March 13, 2012 6:13 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi,
I did what you demand ( i replaced portletRequest with request) and now i get an error on the next line:

org.apache.jasper.JasperException: An exception occurred processing JSP page /view.jsp at line 27

24: <%
25:
26: themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
27: themeDisplay.getUser();
28: System.out.print(themeDisplay);
29: %>
30:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy375.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
cause mère

java.lang.NullPointerException
org.apache.jsp.view_jsp._jspService(view_jsp.java:199)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy375.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.23.
Siby Mathew
RE: Get informations about users in my developed portlet
March 13, 2012 6:15 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi Amine,
themeDisplay is available as an implicit object when <liferay-theme:defineObjects /> is defined.
So please remove
1themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);


Thanks,
Siby
Wail Tkhissi
RE: Get informations about users in my developed portlet
March 13, 2012 6:32 AM
Answer

Wail Tkhissi

Rank: New Member

Posts: 12

Join Date: March 12, 2012

Recent Posts

Siby Mathew:
Hi Amine,
themeDisplay is available as an implicit object when <liferay-theme:defineObjects /> is defined.
So please remove
1themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);


Thanks,
Siby

Hi,
i'm using the same code as Amine,
i removed themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
i still get null pointer exception, and when a print themeDisplay in the console i get null.

any idea ?
Siby Mathew
RE: Get informations about users in my developed portlet
March 13, 2012 6:47 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

The only possibility I can think of is maybe the liferay-theme.tld is not getting included along with your project.
Or maybe just check if your page has some error line before <liferay-theme:defineObjects /> is executed.
Amine RYANE
RE: Get informations about users in my developed portlet
March 13, 2012 7:03 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

The liferay-theme.tld does not exist in my application, it's created after deploying it in liferay ( hot deploy ).
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 2:30 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Help please!!!
Venkat Koppavolu
RE: Get informations about users in my developed portlet
March 14, 2012 3:30 AM
Answer

Venkat Koppavolu

Rank: Junior Member

Posts: 85

Join Date: July 25, 2010

Recent Posts

Try below code in your view.jsp
----------------------------------------------

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.model.User"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>

<portlet:defineObjects />

<%
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
User loggedUser = themeDisplay.getUser();
%>

<h1> <%= loggedUser.getScreenName()%> </h1>
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 3:44 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thanks for replay,

I got this:

org.apache.jasper.JasperException: An exception occurred processing JSP page /register.jsp at line 11

8:
9: <%
10: ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
11: User loggedUser = themeDisplay.getUser();
12: %>
13:
14: <h1> <%= loggedUser.getScreenName()%> </h1>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy393.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
cause mère

java.lang.NullPointerException
org.apache.jsp.register_jsp._jspService(register_jsp.java:126)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy393.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
Sandeep Nair
RE: Get informations about users in my developed portlet
March 14, 2012 3:50 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1693

Join Date: November 5, 2008

Recent Posts

There is no need to retrieve themeDisplay again from any request. When you write <liferay-theme:defineObjects/> themeDisplay is added in page context so it should be available to you implicitly. Can you try the following code?

1<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
2<liferay-theme:defineObjects />
3
4<%
5System.out.print("Check user is signed in or not"+ themeDisplay.isSignedIn());
6%>
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 3:56 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

I tried what you proposed to me but i still get a null pointer exception:

My jsp page (that i insered in my JSF project):

<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<liferay-theme:defineObjects />

<%
System.out.print("Check user is signed in or not"+ themeDisplay.isSignedIn());
%>



The error that i got:

org.apache.jasper.JasperException: An exception occurred processing JSP page /register.jsp at line 5

2: <liferay-theme:defineObjects />
3:
4: <%
5: System.out.print("Check user is signed in or not"+ themeDisplay.isSignedIn());
6: %>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy393.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
cause mère

java.lang.NullPointerException
org.apache.jsp.register_jsp._jspService(register_jsp.java:122)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy393.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
Sandeep Nair
RE: Get informations about users in my developed portlet
March 14, 2012 3:58 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1693

Join Date: November 5, 2008

Recent Posts

Is it possible for you to attach your portlet.

Regards,
Sandeep
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 4:12 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thank you, here is my project in attachement
Attachments: MyProject.war (9,533.6k)
Sandeep Nair
RE: Get informations about users in my developed portlet
March 14, 2012 4:19 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1693

Join Date: November 5, 2008

Recent Posts

This looks like a web application and not portlet. I dont see portlet.xml or liferay-portlet.xml inside WEB-INF folder.
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 4:27 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

We are deploying it a hot deploy, you find in attachement the folder after deploy ( in webapps folder).
Thanks a lot.
Attachments: MyProject.rar (10,026.6k)
Wail Tkhissi
RE: Get informations about users in my developed portlet
March 14, 2012 5:00 AM
Answer

Wail Tkhissi

Rank: New Member

Posts: 12

Join Date: March 12, 2012

Recent Posts

Hi Amine,

did you find a solution ? i'm facing the same problem.
Any ideas ?


tkhs a lot
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 5:21 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi Wail,

I didn't find a solution yet.
Sandeep Nair
RE: Get informations about users in my developed portlet
March 14, 2012 5:55 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1693

Join Date: November 5, 2008

Recent Posts

Hi,

Can you try like this

1FacesContext context = FacesContext.getCurrentInstance();
2        PortletRequest portletRequest = (PortletRequest)context.getExternalContext().getRequest();      
3        ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
4        System.out.println("SignedIn: " + themeDisplay.isSignedIn());


Regards,
Sandeep
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 6:55 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi Sandeep,
I used the new code but i got a new error :

org.apache.jasper.JasperException: An exception occurred processing JSP page /register.jsp at line 29

26: <%
27:
28: FacesContext context = FacesContext.getCurrentInstance();
29: PortletRequest portletRequest = (PortletRequest)context.getExternalContext().getRequest();
30: ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
31: System.out.println("SignedIn: " + themeDisplay.isSignedIn());
32:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy390.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
cause mère

java.lang.ClassCastException: com.sun.faces.context.MyHttpServletRequestWrapper cannot be cast to javax.portlet.PortletRequest
org.apache.jsp.register_jsp._jspService(register_jsp.java:105)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
$Proxy390.doFilter(Unknown Source)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:69)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 7:31 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Amine RYANE:
Hi Sandeep,

26: <%
27:
28: FacesContext context = FacesContext.getCurrentInstance();
29: PortletRequest portletRequest = (PortletRequest)context.getExternalContext().getRequest();
30: ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
31: System.out.println("SignedIn: " + themeDisplay.isSignedIn());
32: %>

I replaced the line :
PortletRequest portletRequest = (PortletRequest)context.getExternalContext().getRequest();
with the line:
HttpServletRequestWrapper portletRequest = (HttpServletRequestWrapper)context.getExternalContext().getRequest();
And i got again a null pointer exception.
Amine RYANE
RE: Get informations about users in my developed portlet
March 14, 2012 1:26 PM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Heeeelp pleasee!!!
Amine RYANE
RE: Get informations about users in my developed portlet
March 17, 2012 3:24 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

I realy need help...
André Bunse
RE: Get informations about users in my developed portlet
March 17, 2012 4:53 AM
Answer

André Bunse

Rank: Junior Member

Posts: 85

Join Date: March 15, 2012

Recent Posts

Hello Amine,

in which way you have create the JSF Portlet? Are you using the Plugin SDK with Eclipse?

I have create a project with it and my WAR-File has much more information than yours.

/WEB-INF/
classes/
lib/
src/
tld/

faces-config.xml
liferay-display.xml
liferay-hook.xml
liferay-plugin-package.properties
liferay-portlet.xml
portlet.xml
web.xml


I can deploy it without any problems and drop it as portlet.

I'm using Liferay 6.1.0 CE, Eclipse 3.7 and the Plugin-SDK


Keep on coding
André
Amine RYANE
RE: Get informations about users in my developed portlet
March 17, 2012 5:06 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thank you so much André for your replay,
I correct : I developed a JSF application in eclipse and when i saved it as .war file and do the hot deploy i can work with it in liferay without any problem. But when i tried to add the code that describe users ( userName...) in one of my js pages i got the null pointer exception!

After the deploy i can find in the webapps/MyProject all of those files (you can find it in the attachement file that i send before):

/WEB-INF/
classes/
lib/
src/
tld/

faces-config.xml
liferay-display.xml
liferay-hook.xml
liferay-plugin-package.properties
liferay-portlet.xml
portlet.xml
web.xml

Any Idea André??
André Bunse
RE: Get informations about users in my developed portlet
March 17, 2012 5:27 AM
Answer

André Bunse

Rank: Junior Member

Posts: 85

Join Date: March 15, 2012

Recent Posts

Amine RYANE:
Any Idea André??


OK. I was confused cause the downloaded WAR has only

\WEB-INF\

faces-config.xml
web.xml

Idea? No sorry, but i insert now your JSP-Files to my MyProject.

First i want to reproduce your error, than we can look further.


Stay tuned emoticon
André
Amine RYANE
RE: Get informations about users in my developed portlet
March 17, 2012 5:29 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thanks a lot André.
André Bunse
RE: Get informations about users in my developed portlet
March 17, 2012 6:08 AM
Answer

André Bunse

Rank: Junior Member

Posts: 85

Join Date: March 15, 2012

Recent Posts

No problem, it's my way to learn JSF Portlet ;)

First i have create a "view.jsp" in docroot/
then insert "/view.jsp" in the XML-Tag <init-param><value> in portal.xml

Tomcat console now tells me:
"INFO: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context.
The duplicate definition has been ignored."


I found a info over search engine and change it to:
"com.liferay.util.bridges.jsf.sun.LiferayConfigureListener"

My portlet only says "MyProject is temporarily unavailable." and tomcat console says:
"ERROR [render_portlet_jsp:154] javax.faces.FacesException: The FacesServlet cannot have a url-pattern of /*.
Please define a different url-pattern."
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:330)


I'm search now how to solve this.


Keep on coding
André
Amine RYANE
RE: Get informations about users in my developed portlet
March 17, 2012 6:25 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi André,
Try to put directely MyProject.war file into deploy folder of liferay.
André Bunse
RE: Get informations about users in my developed portlet
March 17, 2012 6:38 AM
Answer

André Bunse

Rank: Junior Member

Posts: 85

Join Date: March 15, 2012

Recent Posts

Sorry Amine, i want to reproduce the problem step by step to learn how JSF Portlets work.
Only reproduce the problem doesn't help cause right now i'm only a Liferay newbie. ;)

Last thing i learn is that the JSF way is a little bit longer ;)

ok, i correct my portlet.xml to

<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/xhtml/portletViewMode.xhtml</value>
</init-param>

and now i see "Hello MyProject!" *scream Hurra*

i try now to edit "faces-config.xml" to setup my "view.jsp"


Stay tuned
André
Amine RYANE
RE: Get informations about users in my developed portlet
March 17, 2012 6:42 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thanks André ;)
André Bunse
RE: Get informations about users in my developed portlet
March 17, 2012 11:04 AM
Answer

André Bunse

Rank: Junior Member

Posts: 85

Join Date: March 15, 2012

Recent Posts

It's a hard nut to crack ;)

i find no way to call the initial JSP-File

defining <init-param> in "portlet.xml" always ends in

1javax.faces.FacesException: The FacesServlet cannot have a url-pattern of /*

defining <welcome-file-list> in "web.xml" doesn't work, the JSP-File doesn't run

has you manually install the PortletFaces Bridge?

sorry Amine, i have no idea how to fix the problem right now
maybe i install your MyProject and take a look, but not today ;)


Keep on coding
André
Amine RYANE
RE: Get informations about users in my developed portlet
March 17, 2012 3:00 PM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thank you very much André, keep me informed! ;)
Hitoshi Ozawa
RE: Get informations about users in my developed portlet
March 18, 2012 3:45 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

I tried what you gave me, but i still have java.lang.NullPointerException : The value of themeDisplay is null.


Are you logged on to Liferay. That is, is person name appearing in the upper right hand corner?
Amine RYANE
RE: Get informations about users in my developed portlet
March 18, 2012 4:44 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi Hitoshi,
I'm logged on to Liferay, you'll find in attchement a picture that can show it.
Attachment

Attachments: CapScreen.png (210.4k)
Amine RYANE
RE: Get informations about users in my developed portlet
March 18, 2012 4:46 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

This is the jsp code that i try now:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>


<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.model.User"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="javax.faces.context.*"%>
<%@page import="javax.portlet.RenderRequest"%>
<%@page import="javax.portlet.PortletRequest"%>
<%@page import="com.liferay.portal.util.PortalUtil"%>

<%@page import="javax.servlet.http.HttpServletRequestWrapper"%>
<%@page import="javax.servlet.http.HttpServletRequest"%>
<%@page import="java.util.Map"%>


<%@ page import="com.liferay.portal.CookieNotSupportedException" %>
<%@ page import="com.liferay.portal.NoSuchUserException" %>
<%@ page import="com.liferay.portal.PasswordExpiredException" %>
<%@ page import="com.liferay.portal.UserEmailAddressException" %>
<%@ page import="com.liferay.portal.UserLockoutException" %>
<%@ page import="com.liferay.portal.UserPasswordException" %>
<%@ page import="com.liferay.portal.UserScreenNameException" %>
<%@ page import="com.liferay.portal.kernel.language.LanguageUtil" %>
<%@ page import="com.liferay.portal.kernel.util.Constants" %>
<%@ page import="com.liferay.portal.kernel.util.GetterUtil" %>
<%@ page import="com.liferay.portal.kernel.util.HtmlUtil" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@ page import="com.liferay.portal.kernel.util.PortalClassInvoker" %>
<%@ page import="com.liferay.portal.kernel.util.PropsUtil" %>
<%@ page import="com.liferay.portal.security.auth.AuthException" %>

<%@ page import="javax.portlet.WindowState" %>

<portlet:defineObjects />





<%

FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest portletRequest = (HttpServletRequest) context.getCurrentInstance().getExternalContext().getRequest();
ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
Long userd = PortalUtil.getUserId(portletRequest);
System.out.println(themeDisplay);
System.out.println(userd);
System.out.println("SignedIn: " + themeDisplay);



%>
Hitoshi Ozawa
RE: Get informations about users in my developed portlet
March 18, 2012 4:54 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

Try the following:

String userStringId = request.getRemoteUser();

User user = null;
try{
user = UserLocalServiceUtil.getUser(Long.parseLong(userStringId););
} catch (Exception e){
}
Amine RYANE
RE: Get informations about users in my developed portlet
March 18, 2012 5:05 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thanks for replay,
I got userStringId cannot be resolved to a variable!
Amine RYANE
RE: Get informations about users in my developed portlet
March 18, 2012 5:10 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Sorry i solve the problem of "userStringId cannot be resolved to a variable", but now how can i print in the console the id or the userName of the current user.
Thanks a lot.
Hitoshi Ozawa
RE: Get informations about users in my developed portlet
March 18, 2012 5:36 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

Attach your complete war file. You know that you'll get null if you have your portlet in the home page which is shown before user logs in to the portal. Especially since you don't have any logic to check if an user is logged in.

You console output also is showing some error messages. How about looking into those errors.
Amine RYANE
RE: Get informations about users in my developed portlet
March 18, 2012 5:33 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

In the .war file you'll find our "small" application test, and in the .rar file you'll find the same application after a hot deploy.
Thanks for your replay.
Attachments: MyProject.rar (10,027.1k), MyProject.war (9,534.1k)
Hitoshi Ozawa
RE: Get informations about users in my developed portlet
March 18, 2012 6:01 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

Sorry but I'm having trouble downloading your attached files. My download is being terminated after around 9MB. Maybe my network line is busy. Will try tomorrow again.
Amine RYANE
RE: Get informations about users in my developed portlet
March 18, 2012 6:05 AM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Please try tomorrow to help me, thanks a lot.
Hitoshi Ozawa
RE: Get informations about users in my developed portlet
March 18, 2012 2:58 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

You're just wasting everybody's time. I'm getting error in index.jsp because your war package is missing /faces/menu.jsp
Amine RYANE
RE: Get informations about users in my developed portlet
March 18, 2012 3:15 PM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Hi, if there is an error why it works for me?
Thank you very much Ozawa.
Hitoshi Ozawa
RE: Get informations about users in my developed portlet
March 18, 2012 7:32 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

I'm just going to attach a sample JSF portlet which display current user name. You can just copy the war file to the the deploy directory.

I'm really don't know what you're doing including all those jar's in the WEB-INF/lib which is most of which is already loaded by Liferay container.
Attachments: JSFSample.war (3,696.9k)
Wail Tkhissi
RE: Get informations about users in my developed portlet
March 19, 2012 7:41 AM
Answer

Wail Tkhissi

Rank: New Member

Posts: 12

Join Date: March 12, 2012

Recent Posts

Hi Ozawa,

i tested your war file and i'm getting the user that is logged in, but when i add my UserBean to the javaressources/src folder and call it in a jsp page, i'm getting service temporarly unavailable.



thks a lot
Amine RYANE
RE: Get informations about users in my developed portlet
March 19, 2012 12:59 PM
Answer

Amine RYANE

Rank: Junior Member

Posts: 36

Join Date: March 12, 2012

Recent Posts

Thanks Ozawa emoticon