Liferay:Bean Locator尚未设置

时间:2016-02-18 10:42:37

标签: service liferay

我在数据库中有一个现有的表。我修改了service.xml,如下所示: - Service.xml: -

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="net.test"> 
    <author>pfeffeg</author>
    <namespace>dataaccess</namespace>
 <entity name="test" remote-service="true" local-service="true">
    <column name="PID" type="long"></column>
    <column name="PName" type="String"></column>
    <column name="IID" type="long" primary="true"></column>
    <column name="iName" type="String"></column>
    </entity>
</service-builder>

创建表查询: -

CREATE TABLE [dbo].[dataaccess_test](
 [PID] [bigint] NULL,
 [PName] [varchar](max) NULL,
 [IID] [bigint] NOT NULL,
 [iName] [varchar](max) NULL,
 CONSTRAINT [pk_IdetailidTest] PRIMARY KEY CLUSTERED 
(
 [IID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,             ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

我已经构建了服务构建器。显然所有类都已正确构建。但是当我尝试运行portlet时,我得到了一个Bean Locator异常。

BeanLocator has not been set
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set
    at com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate(PortletBeanLocatorUtil.java:40)

2 个答案:

答案 0 :(得分:0)

你在使用什么样的生活版本?

请发布整个service.xml文件。此错误通常源自service.xml文件中的错误。

答案 1 :(得分:0)

感谢aritzg,我现在能够无错误地执行portlet。解决方案 - service.xml中的列名属性应以大写字母开头。看起来很奇怪,但它对我有用。

service.xml中

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="net.test"> 
    <author>pfeffeg</author>
    <namespace>dataaccess</namespace>
 <entity name="test" remote-service="true" local-service="true">
    <column name="PID" type="long"></column>
    <column name="PName" type="String"></column>
    <column name="IID" type="long" primary="true"></column>
    <column name="IName" type="String"></column>
    </entity>
</service-builder>