Forums de discussion

<user-attribute> give Null pointer

thumbnail
aligator fred, modifié il y a 15 années.

<user-attribute> give Null pointer

New Member Publications: 9 Date d'inscription: 26/08/08 Publications récentes
I added

  

<user-attribute>
    <description xml:lang="en">User NickName</description>
    <name>user.name.nickName</name>
  </user-attribute>



to portlet.xml alongside the other entries and restarted tomcat then null pointer ? any ideas

The spurt ...



java.lang.NullPointerException
	com.liferay.portal.struts.PortalRequestProcessor.getLastPath(PortalRequestProcessor.java:588)
	com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:146)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:288)
	com.liferay.portal.servlet.MainServlet.service(MainServlet.java:542)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:144)
	com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:136)
	com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:126)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	com.liferay.filters.strip.StripFilter.doFilter(StripFilter.java:95)
	com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:144)
	com.liferay.filters.compression.CompressionFilter.doFilter(CompressionFilter.java:116)
	com.liferay.filters.doubleclick.DoubleClickFilter.doFilter(DoubleClickFilter.java:138)
	com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.doFilter(LayoutCacheFilter.java:140)
	com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.doFilter(AutoLoginFilter.java:106)
	com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:136)

thumbnail
aligator fred, modifié il y a 15 années.

RE: <user-attribute> give Null pointer

New Member Publications: 9 Date d'inscription: 26/08/08 Publications récentes
This was specific to my local install as didnt fail on the production server

I was trying to retrieve the username , then found this

http://support.liferay.com/browse/LEP-3342http://support.liferay.com/browse/LEP-3342

I was only trying to get the "nickName" out as this was the closest thing to screen name, but screen name isnt available.

.. back to the blog post ...
taglibs are are not included in a deployed portlet by default, add them to liferay-plugin-package.properties, this file doesnt exist ?
adding all this just broke things.. import themes ? what have themes got to do with the logged in screenname

... we have an enterprise portal product , can do all manor of great stuff but cant print "welcome username" ?
What about sso , what about personalisation, connecting centr to Ldap as the source for many systems, username(screen name, cn) its the thing that connects everything and Liferay makes you jump through crazy hoops to retrieve it ? Is this product being used in real world (central ldap, connecting to many systems anywhere ?) without username i cant see how , we have been dealing with in house large scale projects and its the username that connects it all together.

Ok so this is insane, all this extra config to print "welcome screenname" .... emoticon .. is this what we tell liferay customers .. 1/2 days dev to do this lol

I must be wrong , please can someone in a short and simple way open my eyes please ... seems very rediculas to be 3 days in to just printing "welcome screenname" or being able to create a simple link and append username to it.

apologies in advance was just loving liferay till now seemed very promising and great place to get involved, but as an intergration tool, not getting past the basic needs of a portal at all. If something needs writing i can try and add that , perhaps this is my first give back emoticon
thumbnail
aligator fred, modifié il y a 15 années.

RE: <user-attribute> give Null pointer

New Member Publications: 9 Date d'inscription: 26/08/08 Publications récentes
wowzerrrrrrrrrrrrrs

After bringing together from different blogs and threads i finally found the complete code needed to print the screen name to screen



&lt;%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;

<liferay-theme:defineobjects />
<portlet:defineobjects />
&lt;% /* this is the fella i was searching and seaching for */ %&gt;&gt;
&lt;%= user.getScreenName() %&gt;


Anyone following in my footsteps and this doesnt work please refer to
http://www.liferay.com/web/rauge/blog/-/blogs/%5bhowto%5d-personalization---getting-current-user-attributes to check the taglib setup.

im gobsmacked it took so much rtfming and posting to get something so simple and fundamental to portals emoticon

if you think im negative, just tired and of course ... I wouldnt be posting if i didnt like the product emoticon