When i create a user page using gatein public api i got an org.gatein.api.EntityNotFoundException
exception. Here follows my code for creating user page
User user = PortalRequest.getInstance().getUser();
Portal portal = PortalRequest.getInstance().getPortal();
f(portal.getPage(new PageId(user, pageName))==null){
Page newpage = portal.createPage(new PageId(user, pageName));// Here i got the exception
}
Here follows the stack trace of exception
org.gatein.api.EntityNotFoundException: Site Site.Id[type=dashboard, name=supervisor] doesn't exist
at org.gatein.api.PortalImpl.createPage(PortalImpl.java:271) [exo.portal.component.api-3.6.0.Final.jar:3.6.0.Final]
at com.radiant.cisms.view.bean.DynamicDashBoardBean.createUserSpecificPage(DynamicDashBoardBean.java:146)
at com.radiant.cisms.view.bean.DynamicDashBoardBean.saveNewPortlets(DynamicDashBoardBean.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_45]
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
... 121 more
Also here i am attaching my portal-configuration.xml for reference
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<external-component-plugins>
<!-- The full qualified name of the UserPortalConfigService -->
<target-component>org.exoplatform.portal.config.UserPortalConfigService
</target-component>
<component-plugin>
<name>new.portal.config.user.listener</name>
<set-method>initListener</set-method>
<type>org.exoplatform.portal.config.NewPortalConfigListener</type>
<description>this listener init the portal configuration
</description>
<init-params>
<value-param>
<name>default.portal</name>
<description>The default portal for checking db is empty or not
</description>
<value>MPortal</value>
</value-param>
<value-param> <
<name>override</name>
<description>The flag parameter to decide if portal metadata is overriden on restarting server</description>
<value>true</value>
</value-param>
<object-param>
<name>portal.configuration</name>
<description>description</description>
<object type="org.exoplatform.portal.config.NewPortalConfig">
<field name="predefinedOwner">
<collection type="java.util.HashSet">
<value>
<string>classic</string>
</value>
<value>
<string>MPortal1</string>
</value>
<value>
<string>MPortalForgotPassword</string>
</value>
<value>
<string>MPortalWizard</string>
</value>
<value>
<string>MPortalEndUser</string>
</value>
</collection>
</field>
<field name="ownerType">
<string>portal</string>
</field>
<field name="templateLocation">
<string>war:/conf/gtec/</string>
</field>
<field name="importMode">
<string>overwrite</string>
</field>
</object>
</object-param>
</init-params>
</component-plugin>
</external-component-plugins>
</configuration>
Can you help me to give a reason about this issue?
The error says that the dashboard of your user does not exist. The dashboard is created automatically when the user is created, thanks to the listener org.exoplatform.portal.config.UserPortalConfigListener declared in the file portal.war/WEB-INF/conf/portal/portal-configuration.xml. So I guess in your case, the listener has not been triggred when the user has been created.
If you create your users programmatically, you have to be sure that the broadcast option is enabled (which will triggered the listeners), by setting the second argument of the createUser method to true : orgService.getUserHandler().createUser(user, true);