Wednesday, January 21, 2009

Consuming uPortal User Attributes as JSR-168 User Attributes

You need to add to your portlet.xml something like


User Family Name
user.name.family


where the attribute is the Key mapped within your PersonDirectory.xml or personDirs.xml (see manual chapter on user attributes).

Then from within your Portlet code you can access the values like this


Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO);
String surname = (String)userInfo.get("user.name.family");

Using Two Databases with Hibernate

Found this little bit of code on the internet

Properties databaseAProperties = // get properties however you like
Properties databaseBProperties = // get properties however you like

SessionFactory databaseA
= new Configuration().configure("databaseA.cfg.xml")
.setProperties(databaseAProperties)
.buildSessionFactory();
SessionFactory databaseB
= new Configuration().configure("databaseB.cfg.xml")
.setProperties(databaseBProperties)
.buildSessionFactory();

Tuesday, January 20, 2009

Problems with Uportal giving a PermGen space error while using a hibernate portlet.

Apparently

PermGen space is controlled by a different java option:

So I wound recommend using

CATALINA_OPTS "-Xms1024m -Xmx2048m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

as options for your tomcat server.