0

当我使用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>

你能帮我说明这个问题的原因吗?

4

1 回答 1

3

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

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

于 2013-11-27T09:08:18.577 回答