[jboss-user] [JBoss Portal] - NullPointer: Setting portlet instance preferences via Instan
IronMan77
do-not-reply at jboss.com
Fri Feb 29 05:02:50 EST 2008
Hi using this development setup:
| * Version: jboss-portal-2.6.1.GA
| * Download Version
| * JBoss AS Version: 4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)]
| * Database: Mysql 5.0.51a-community-nt
| * JDBC Connector and Version: mysql-connector-java-5.0.5-bin.jar
| * OS Platform: Windows XP 32-Bit
|
| I have injected the InstanceContainer and set transaction support via jboss-portlet.xml:
|
|
| | <service>
| | <service-name>InstanceContainer</service-name>
| | <service-class>org.jboss.portal.core.model.instance.InstanceContainer</service-class>
| | <service-ref>:container=Instance</service-ref>
| | </service>
|
| and
|
| <trans-attribute>Required</trans-attribute>
Reading from the portlet instnaces does work, writing to the portlet preferences creates a nullpointer, using this example code:
| //Get the instance container
| InstanceContainer instanceContainer = (InstanceContainer) this.getPortletRequest().getPortletSession().getPortletContext().getAttribute("InstanceContainer");
| InstanceDefinition id = instanceContainer.getDefinition("startPortletInstance");
|
| // This does work!
| PropertyMap pmap = id.getProperties();
| String uuid = ((StringValue) pmap.get("uuid")).toString();
|
| List tmp = new ArrayList();
| if (pmap.containsKey("uuid")) {
| PropertyChange change = PropertyChange.newUpdate("uuid", new StringValue(documentId));
| tmp.add(change);
| }
| PropertyChange[] changes = (PropertyChange[]) tmp.toArray(new PropertyChange[tmp.size()]);
| //This doesn't work
| id.setProperties(changes);
|
I have debugged the setProperties() method for my portlet und the admin portlet and found the problematic section:
org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager
The following code line leads to the nullpointer:
context.entries.clear();
The problem seems to be, that the loaded (hibernate?) PersistentPortletState object is not set up correctly, most properties are empty. I have compared this to the admin-core portlet - there is the object loaded correctly.
Some questions:
1. Am i gettin the InstanceCotainer correctly:
InstanceContainer instanceContainer = (InstanceContainer) this.getPortletRequest().getPortletSession().getPortletContext().getAttribute("InstanceContainer");
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133124#4133124
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133124
More information about the jboss-user
mailing list