无法使用gatein public api创建用户页面

时间:2013-11-24 08:13:53

标签: gatein

当我使用gatein public api创建用户页面时,我遇到了org.gatein.api.EntityNotFoundException异常。以下是我创建用户页面的代码


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

}

以下是异常的堆栈跟踪


 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

此外,我在附上我的portal-configuration.xml以供参考


<?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>

你能帮我解释一下这个问题吗?

1 个答案:

答案 0 :(得分:3)

错误表明您的用户的信息中心不存在。由于在portal.war / WEB-INF / conf / portal / portal-configuration.xml文件中声明了监听器org.exoplatform.portal.config.UserPortalConfigListener,因此在创建用户时会自动创建仪表板。 所以我想在你的情况下,在创建用户时没有触发监听器。

如果以编程方式创建用户,则必须通过将createUser方法的第二个参数设置为true来确保启用广播选项(这将触发侦听器):orgService.getUserHandler()。createUser(user ,true);