FYI this issue has now been resolved. Might have been a couple of things, but most likely a configuration mix-up on TomCat - worked well after tomcat was restarted.
-----Original Message----- From: James Dixon [mailto:[EMAIL PROTECTED] Sent: Wednesday, 24 August 2005 1:05 PM To: [EMAIL PROTECTED]; [email protected] Subject: UserManager is null - what settings am I missing? Hi all (but in particular James Liao or anyone who has implemented the UserManager interface!) I am trying to change two user attributes when a user logs in my portletclass. I have followed the instructions for configuring the js:services pretty closely and am still getting UserManager returned as 'null'. I have tried to work out what the tricks might be on this one, but to no avail. Here's some of the things I have done, but which haven't seemed to make a jot of difference: 1: added jetspeed-portlet.xml to the portlet project. Code below: ------------------- <portlet-app id="custLoginPortlet" version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:js="http://portals.apache.org/jetspeed" xmlns:dc="http://www.purl.org/dc"> <dc:title>Custom Security Portlets</dc:title> <dc:title xml:lang="en">Custom Security Portlets</dc:title> <dc:creator>J2 Team</dc:creator> <portlet> <portlet-name>CustLoginPortlet</portlet-name> <dc:title>Custom Login Portlet</dc:title> <dc:creator>James Dixon</dc:creator> </portlet> <js:services> <js:service name='UserManager'/> </js:services> </portlet-app> --------------- 2) ensured that the portlet-app id in jetspeed-portlet.xml is the same as the portlet id in portlet.xml. 3) Try and access the user manager with the following code: ---------------------------- User user = null; UserManager userManager = (UserManager) getPortletContext().getAttribute("cps:UserManager"); if(userManager!=null) { writer.write("<Br>USerManager is not null :-)"); } else { writer.write("<Br>USerManager is null :-<"); } try { user = userManager.getUser(userName); } catch (Exception e) { // TODO: logging writer.write("<br>user not found: " + userName + ", " + e); } return user; --------------------------- 4) Aligned the displaynames in the web.xml and jetspeed-portlet.xml I also checked what the getPortletContext.getAttributenames were - cps:UserManager was not among them. Element 1 org.apache.catalina.jsp_classpath Element 2 javax.servlet.context.tempdir Element 3 org.apache.catalina.resources Element 4 org.apache.catalina.WELCOME_FILES Grateful for any help that anyone might have on this, as I have now hit a brick wall and am fresh out of ideas!! Previous userManager correespondence below. Cheers James ________________________________________________________________________ Message Index: [Date <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ index.html> ] [Author <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ authors.html> ] [Thread <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ threads.html> ] _____ From: Liao jian <[EMAIL PROTECTED]> Subject: Re: Problem get UserManager Date: Mon, 13 Jun 2005 11:32:57 GMT Raw <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ [EMAIL PROTECTED]> Message Prev <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ [EMAIL PROTECTED]> Next <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ [EMAIL PROTECTED]> Prev <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ [EMAIL PROTECTED]> by Thread Next <http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/200506.mbox/ [EMAIL PROTECTED]> by Thread _____ Hi, You must config a Jetspeed 2 Service in the extension config file jetspeed-portlet.xml like the following: <portlet-app id="security" version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:js="http://portals.apache.org/jetspeed" xmlns:dc="http://www.purl.org/dc"> <dc:title>Security Portlets</dc:title> <dc:title xml:lang="en">Security Portlets</dc:title> <dc:creator>J2 Team</dc:creator> <portlet> <portlet-name>LoginPortlet</portlet-name> <dc:title>Login Portlet</dc:title> <dc:creator>J2 Team</dc:creator> </portlet> <js:services> <js:service name='UserManager'/> <js:service name='RoleManager'/> <js:service name='GroupManager'/> <js:service name="Profiler" /> <js:service name="SSO" /> <js:service name='PortletRegistryComponent'/> </js:services> </portlet-app> You should take a look at the bundled security portlet application for a detail. - James Liao On 6/13/05, ÖÎ Íõ <[EMAIL PROTECTED]> wrote: > > i write a portlet like : > > public class MyPortlet extends GenericServletPortlet > { > ... > super.init(config); > userManager = (UserManager) > getPortletContext().getAttribute( > > CommonPortletServices.CPS_USER_MANAGER_COMPONENT); > ... > } > > the portlet deployed as war, but the userManager is > null, why? it's looks like no difference with the > UserBrowse portlet in java file and portlet.xml. Need > any other configure? > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
