Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Read and store user info using PUMA

343 views
Skip to first unread message

karin.bj...@intentia.se

unread,
Jun 7, 2005, 1:03:24 PM6/7/05
to
Hi!
Does anyone have an example on how to read user Attributes using PUMA API (5.x) or the new PUMA SPI (5.1.0.1). I have a look aside database and would like to read and store some additional attributes. I have the db configuration sorted out for WMM but I have not found any good articles or examples.

My example I'm working on returns:
Nested Exception is javax.servlet.ServletException: com.ibm.wps.puma.UserManager
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)

Thanks
Karin

rajen...@yahoo.com

unread,
Jun 8, 2005, 12:52:14 AM6/8/05
to
Karin,

May be you can elaborate your question little bit. Are you trying to add additional attributes so that you can have additional attributes in Registration of user?

It seems that it is related to self registration or enrollment of users. If you are planning to add more attributes to Self registration, puma should be used. First of all you should add those additional attributes to puma proprty file.

Portal 5.1 information has lots of details related to Portal self care. Please look at it and post specific questions in this forum.

Cheers,

Rajender Sriramoju
IBM Certified Portal Solution Developer
IBM Certified Portal System Administrator

karin.bj...@intentia.se

unread,
Jun 8, 2005, 1:28:04 AM6/8/05
to
Hi Rajender!
Thank you for your reply.

I'm looking for a way to store global settings that should not be in the PortletData but in a database for the user so that it can be access across portlet applications, using the PUMA SPI or API (I'm on 5.1.0.1).

It is not for self registration. It will be used in a Portlet the already registered users are free to enter to have settings that will be valid trough out our solution.

I'm using Cloudscape locally now but we will support all WPS supported DBs.

I have prepared the WMMAttributes-xml files.
When I run the attributeLoader.bat (C:\Program Files\Portal51UTE\PortalServer\config\work\wmm\bin\) with the file C:\Progra~1Portal51UTE\PortalServer\wmm\wmmDBAttributes.xml

I get:
ERROR 42X05: Table 'WMMDBKEYS' does not exist.
at db2j.dl.b.newException(Unknown Source)
at db2j.b.bm.ki_(Unknown Source)
at db2j.b.bm.xo_(Unknown Source)
at db2j.b.r._jv(Unknown Source)
at db2j.b.h.xo_(Unknown Source)
at db2j.b.dt._jv(Unknown Source)
at db2j.b.dt.az_(Unknown Source)
at db2j.b.p.az_(Unknown Source)
at db2j.b.dj.az_(Unknown Source)
at db2j.br.c._lx(Unknown Source)
at db2j.br.c.prepare(Unknown Source)
at db2j.bq.f.prepareInternalStatement(Unknown Source)
at db2j.ai.p.<init>(Unknown Source)
at db2j.ax.e.<init>(Unknown Source)
at db2j.aw.b.<init>(Unknown Source)
at com.ibm.db2j.jdbc.EmbeddedDriver30.newLocalPreparedStatement(Unknown Source)
at db2j.ai.c._xr(Unknown Source)
at db2j.ai.c.prepareStatement(Unknown Source)
at com.ibm.ws.wmm.dbload.DBLoadKeyManager.initialize(DBLoadKeyManager.java:213)
at com.ibm.ws.wmm.dbload.DBLoadKeyManager.getWMMDBKeyForTable(DBLoadKeyManager.java:90)
at com.ibm.ws.wmm.dbload.WMMDBLoaderDao.createWMMDBAttribute(WMMDBLoaderDao.java:123)
at com.ibm.ws.wmm.dbload.DBLoadManager.createDBEntry(DBLoadManager.java:365)
at com.ibm.ws.wmm.dbload.DBLoadManager.createSingleAttributeEntry(DBLoadManager.java:614)
at com.ibm.ws.wmm.dbload.DBLoadManager.initialize(DBLoadManager.java:662)
at com.ibm.ws.wmm.dbload.AttributePreLoader.main(AttributePreLoader.java:64)
Hopefully I'll sort this out. I have done the adding of the DB database attributes before. It has just been a while.

However when I search the forum for PUMA there are not that many useful hints and example on how to use the puma api (not to mention the SPI).

Well I need the following: Read user attributes. Store user attributes (our new ones that I have created in the DB)

Hope that information was helpful.
Thanks
Karin

karin.bj...@intentia.se

unread,
Jun 11, 2005, 7:20:08 AM6/11/05
to
Yes, I have now added the fields to the database. But I'm still looking for example how to use Puma API or even better SPI.

Thanks
Karin

vel...@us.ibm.com

unread,
Jun 15, 2005, 1:47:37 PM6/15/05
to

Here is the code snippet you can use:


User user = request.getUser();

com.ibm.portal.puma.User pumauser = (com.ibm.portal.puma.User) user;


for (Iterator e = pumauser.getGroups().iterator();e.hasNext();) {

com.ibm.portal.puma.Group gr = (com.ibm.portal.puma.Group) e.next();



System.out.println("Group name: "+ gr.getName());


}

Add wp.user.api.jar to your project buildpath

It only works for IBM Portlet API, not JSR-168

Hope it helps !

Cédrick

unread,
Jun 16, 2005, 10:53:49 AM6/16/05
to
And here is the code snippet you can use to get the User with the JSR
168:

User user =
(User)request.getAttribute("com.ibm.portal.puma.request-user");

Enjoy!

harisanka...@wipro.com

unread,
Jul 26, 2005, 1:14:50 AM7/26/05
to
Hi Karin,
I Have Puma SPI . But I dont know which jar file to be add in classpath to work PumaProfile,PumaLocator,PumaHome etc.

Initial I Used Puma API in 5.1 by using wp.user.api.jar . As Puma API deprecated I want to use PUMA SPI . Please send me the jar file to me .

Thanks in Advance.
If anyone having the jar file please send to me.
My mail id : harisanka...@wipro.com

karin.bj...@intentia.se

unread,
Jul 26, 2005, 10:47:20 AM7/26/05
to
Hi!
No I will not send you the jar. It is in the installation.
I don't remember the jar file. It might be in wp.pe.api.legacy.jar or wp.portletservices.api.legacy.jar.
The jar is in the shared-app folder so map that hole folder to your project and use your development tool to find the exact jar. (I'm not at the office)

In RAD and WSAD there is this great command ctrl+ shift + T and type in your class... if it is in your workbench referenced some how you'll see the name of the containing jar.

Louie...@entitybean.com

unread,
Jul 27, 2005, 11:35:07 AM7/27/05
to
ctrl+shift+t will show the containing puma api jars only if you have those jars included in your classpath.
So in this case, it won't work cause the jar is not ready since you are looking for it ;_)

Harisankar Gopalan

unread,
Jul 27, 2005, 11:54:01 PM7/27/05
to
Hi,
You are right frumble .
ctrl+shift+ T wont recognize jar file if it is not in classpath .

Now I found the jar file . It is wp.user.api.jar.

Thanks to you and karin .

Karin I need one more favour from you . You told you added customized attributes to wps database . How you added? can you give the steps to me ?

I haved added customized attributes through sql scripts .I think it is not recomended way .

Thanks,
hari

rbon...@us.ibm.com

unread,
Jul 28, 2005, 9:21:35 AM7/28/05
to
Make sure you have the 5.1.0.1 version of WPS. Version 5.1 does not have the PumaHome, PumaProfile, and PumaControl classes.

Harisankar Gopalan

unread,
Jul 31, 2005, 11:59:24 PM7/31/05
to
Hi Karin,
How you added customized attributes to wps database. If you send me the solution to me that would be great.

Thanks,
Hari

karin.bj...@intentia.se

unread,
Aug 1, 2005, 1:35:10 AM8/1/05
to
Hi!
The find trick will of course only work if you for example add the hole shared/app folder to your classpath. Then you'll find the file. Or for the future any other file...

Back to your question on the attributes. I guess there are instructions in the manual. These are however my notes for SQL server:
Setting upp SQL Server for WMM on WPS 5.1
================================================================

Path to .xml files is C:\Program Files\WebSphere\PortalServer\wmm
Path to .bat files is C:\Program Files\WebSphere\PortalServer\config\work\wmm\bin

1. Add your attributes in C:\Program Files\WebSphere\PortalServer\wmm\wmmAttributes.xml

2. Add your attribute description in C:\Program Files\WebSphere\PortalServer\wmm\wmmAttributesDescription.xml

3. Add your database attributes in C:\Program Files\WebSphere\PortalServer\wmm\wmmDBAttributes.xml.
This file is mapping your DB attributes with the WMM attributes.
Note: If you have set up LDAP authorization with a look-aside database you should instead edit wmmLAAttributes.xml!

4. Add your attribute description in C:\Program Files\WebSphere\PortalServer\wmm\wmmDBAttributesDescription.xml

5. Check the path to 'setupCmdLine' in the C:\Program Files\WebSphere\PortalServer\config\work\wmm\bin\setenv.bat (see TIP 1 below).

6. Run the attributeLoader.bat (C:\Program Files\WebSphere\PortalServer\config\work\wmm\bin\) with the file
C:\Progra~1\WebSphere\PortalServer\wmm\wmmDBAttributes.xml or wmmLAAttributes.xml (with full path) as parameter.

7. Check the attrloader.log for the result. NOTE that an error is signaled for every attribute already existing in the database.
Like this:
..Loading attribute: karin'sCompany-company
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert duplicate key row in object 'WMMLAATR' with unique index 'WMMI067'.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at com.ibm.ws.wmm.dbload.WMMDBLoaderDao.createWMMLAAttribute(WMMDBLoaderDao.java:263)
at com.ibm.ws.wmm.dbload.DBLoadManager.createLAEntry(DBLoadManager.java:411)
at com.ibm.ws.wmm.dbload.DBLoadManager.createSingleAttributeEntry(DBLoadManager.java:588)
at com.ibm.ws.wmm.dbload.DBLoadManager.initialize(DBLoadManager.java:634)
at com.ibm.ws.wmm.dbload.AttributePreLoader.main(AttributePreLoader.java:64)


and for a new added attribute like this:
..Loading attribute: karin'sCompany-expandList
attribute karin'sCompany-expandList is created with id=10132
memberType P is created for 10132
LookAside Attribute: karin'sCompany-expandList is loaded.

The result of your added attrbutes are found at the bottom of the log file, like this:
C:\Progra~1\WebSphere\PortalServer\wmm\wmmLAAttributes.xml file has been successfully loaded into database!


TIPS AND TRIXS
======================================================================
TIP 1: You can test the path in the setenv.bat that is used by attributeloader by running attributeLoader.bat without parameter.
If you get en error change the call to setupCmdLine to point to the right place. The path in my environment looks like this:
C:\Program Files\WebSphere\AppServer\bin\setupCmdLine

TIP 2: Boolean is not supported by WPS. Use Integer instead as datatype in wmmDBAttributes.xml / wmmLAAttributes.xml.

Good luck!

Harisankar Gopalan

unread,
Aug 26, 2005, 2:26:49 AM8/26/05
to
Hi rbongior ,

I am using PUMASPI to get user attributes.When I used,
List listAttributes = pumaprofle.getDefinedUserAttributeNames();
It is giving default attributes and not giving customized attributes which I created for project puprose.

When I used PUMA API I got cusomized attributes also,
like ,
user.getAttribute("aaa");

How to get the customized user attributes using pumaspi (pumaprofile) .

Thanks in Advance.
Regds,
Hari

fenizia...@it.ibm.com

unread,
Jan 12, 2006, 9:03:02 AM1/12/06
to
someone knows how to make a lookaside attribute a required attribute for registration?

Thanks in advance

amyy...@hsbc.com.hk

unread,
Jan 19, 2006, 10:25:52 PM1/19/06
to
Hi!

I have tried the step posted by Karin, but when attributeLoader.sh is running, exception is throw. (SQL Exception: Database wpsdb not found). And i'm using the default database cloudscape now in Linux environment.
Anyone have ideas on this problem, please help.

Shan

pshetty

unread,
Sep 27, 2006, 5:36:20 AM9/27/06
to

wrote:
> *Hi!
> ....Loading attribute: karin'sCompany-company
> ....Loading attribute: karin'sCompany-expandList

> attribute karin'sCompany-expandList is created with id=10132
> memberType P is created for 10132
> LookAside Attribute: karin'sCompany-expandList is loaded.
>
> The result of your added attrbutes are found at the bottom of the log
> file, like this:
> C:\Progra~1\WebSphere\PortalServer\wmm\wmmLAAttributes.xml file has
> been successfully loaded into database!
>
>
> TIPS AND TRIXS
> ======================================================================
> TIP 1: You can test the path in the setenv.bat that is used by
> attributeloader by running attributeLoader.bat without parameter.
> If you get en error change the call to setupCmdLine to point to the
> right place. The path in my environment looks like this:
> C:\Program Files\WebSphere\AppServer\bin\setupCmdLine
>
> TIP 2: Boolean is not supported by WPS. Use Integer instead as
> datatype in wmmDBAttributes.xml / wmmLAAttributes.xml.
>
> Good luck! *

--
pshetty
------------------------------------------------------------------------
Posted via http://www.webservertalk.com
------------------------------------------------------------------------
View this thread: http://www.webservertalk.com/message1092038.html

sharv...@eishome.com

unread,
Dec 19, 2006, 3:49:48 PM12/19/06
to
Following these directions, we still get errors. Not everything has been captured in these directions. There are some additonal steps left out (per IBM posting 'Adding attributes to LookAside database tables'

http://www-1.ibm.com/support/docview.wss?uid=swg21225316

Anyone has any ideas why we are still getting these errors?

..Loading attribute: slh-suspended

C:\Portal51UTE\PortalServer\wmm\wmmDBAttributes.xml file has been successfully loaded into database!

Amit Shekhar

unread,
Sep 4, 2007, 2:54:48 PM9/4/07
to
I am trying to retrieve password using userAttr.get("userPassword") but its giving null. is there any way to retrieve the password of loggedInUser?
i also am applying security on portlets by assigning some groups to the portlets. Is there any way to see all the groups assigned to portlets instead of user. Please help...

Jim Barnes

unread,
Dec 7, 2007, 7:16:35 AM12/7/07
to
have you defined the attributes to wmm?<br />
<br />
if so use the get attributes, and pass in a list of attribute names that match how they are defined in wmm.<br />
this will return a map of attributes.<br />
<br />
Jim<br />
<p />
IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0<br />
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0<br />
<br />
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

cheer...@163.com

unread,
Dec 10, 2007, 4:54:52 AM12/10/07
to
Hi Jim,<br />
<br />
I am confused about whether I should use PUMA to store some type of user infomation in WPS6.0. The requirement is that the stored attributes can be shared by all the portlets displayed for the user. I am using JSR168 API and PortletPreferences object can only be shared per portlet definition but not per user.<br />
<br />
Practically, Do I have to add a user attribute to database before I can use it in portlet? I noticed that there is a interface com.ibm.portal.um.PumaController#addAttributes(), but I failed to make things work with it. It didn't throw AttributeUndefinedException but just make nothing stored. <br />
<br />
In legacy IBM portlet API, org.apache.jetspeed.portlet.User#setAttribute() can set undefined attribute. Do you have any idea about something in PUMA SPI can do the same thing? It is just required that the attributes can be shared by a user's all portlets and don't involve modifications in portal server itself.<br />
<br />
Thanks in advance.<br />
<br />
Seeker

Jim Barnes

unread,
Dec 10, 2007, 7:03:28 AM12/10/07
to
Well the add attribute will only add the attribute if it is defined in wmm, You should have gotten a PumaAttributeException if they were not defined yet. Now I think the ldap is one of the best places to store information that will not update often. if you are going to make frequent updates to it you might want to put it into a lookaside db for wmm, instead of the ldap.<br />
<br />
But yes the attribute must be at least defined in wmm to exist in the ldap or db before you can try adding it to the user.<br />
<br />
Jim<br />
<br />
0 new messages