本文介绍了Liferay Service Builder失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对Liferay进行一些测试。为此,我正在关注MVC教程,并陷入了服务的困境。

I'm doing some tests on Liferay. For this, I'm following the MVC tutorial, and got stuck in the services stuff.

我为测试目的创建了一个简单的实体,Miclase:

I created a simple entity for testing purposes, "Miclase":

public class Miclase {
    int id;
    int num1;
    String string1;
}

非常简单,呵呵。好吧,在此之后,我启动了服务构建器并使用Overview窗格创建了这样的文件:

Pretty simple, huh. Well, after this, I started the service builder and created a file like this, with the Overview pane:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="asd">
    <author>hp</author>
    <namespace>Miservicio</namespace>

    <entity name="Miclase" local-service="true">
        <column name="id" type="int"></column>
        <column name="num1" type="int" primary="false"></column>
        <column name="string1" type="String"></column>


        <!-- PK fields -->

        <column name="miclaseId" type="long" primary="true"></column>

        <!-- Group instance -->

        <column name="groupId" type="long"></column>

        <!-- Audit fields -->

        <column name="companyId" type="long"></column>
        <column name="userId" type="long"></column>
        <column name="userName" type="String"></column>
        <column name="createDate" type="Date"></column>
        <column name="modifiedDate" type="Date"></column>
        <finder name="GroupId" return-type="Collection">
            <finder-column name="groupId"></finder-column>
        </finder>
    </entity>
</service-builder>

概览窗格中的所有内容都显示没有错误,因此我点击了构建服务按钮,它创建了很多源代码:

Everything showed up without errors in the "Overview" pane, so I clicked the "Build service" button, it created a lot of source code:

[Console output redirected to file:C:\Users\hp\workspace\.metadata\.plugins\com.liferay.ide.sdk.core\sdk.log]
Buildfile: C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\build.xml
[ivy:resolve] :: Apache Ivy 2.4.0 - 20141213170938 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = C:\Zerok\DevZone\liferay-plugins-sdk-6.2\ivy-settings.xml
    [touch] Creating C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\build.gradle
build-service:
    [mkdir] Created dir: C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service
    [mkdir] Created dir: C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\sql
      [jar] Building MANIFEST-only jar: C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\service-builder-classpath.jar
   [delete] Deleting: C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\service-builder-classpath.jar.manifest
   [delete] Deleting: C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\service-builder-classpath.jar
     [echo] Loading jar:file:/C:/Zerok/DevZone/liferay-portal-6.2-ce-ga5/tomcat-7.0.62/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
     [echo] Loading jar:file:/C:/Zerok/DevZone/liferay-portal-6.2-ce-ga5/tomcat-7.0.62/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
     [echo] Loading jar:file:/C:/Zerok/DevZone/liferay-portal-6.2-ce-ga5/tomcat-7.0.62/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties
     [echo] Building Miclase
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\persistence\MiclaseActionableDynamicQuery.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\persistence\MiclasePersistenceImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\persistence\MiclasePersistence.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\persistence\MiclaseUtil.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\model\impl\MiclaseModelImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\model\impl\MiclaseBaseImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\model\impl\MiclaseImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\model\MiclaseModel.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\model\Miclase.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\model\impl\MiclaseCacheModel.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\model\MiclaseClp.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\model\MiclaseWrapper.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\model\MiclaseSoap.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\impl\MiclaseLocalServiceImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\base\MiclaseLocalServiceBaseImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseLocalService.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseLocalServiceUtil.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseLocalServiceClp.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\base\MiclaseLocalServiceClpInvoker.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseLocalServiceWrapper.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\impl\MiclaseServiceImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\base\MiclaseServiceBaseImpl.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseService.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseServiceUtil.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseServiceClp.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\base\MiclaseServiceClpInvoker.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseServiceWrapper.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\src\asd\service\http\MiclaseServiceSoap.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\messaging\ClpMessageListener.java
     [echo] Writing C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\ClpSerializer.java
     [echo] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
    [mkdir] Created dir: C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service-classes
     [copy] Copied 5 empty directories to 5 empty directories under C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service-classes
    [javac] Compiling 19 source files to C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service-classes
    [javac] Annotation processing got disabled, since it requires a 1.6 compliant JVM

但......在上一次输出之后,我得到以下构建失败:

but... after the previous output, I get the following build fails:

    [javac] ----------
    [javac] 1. ERROR in C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\model\Miclase.java (at line 1)
    [javac]     /**
    [javac]     ^
    [javac] The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
    [javac] ----------
    [javac] ----------
    [javac] 2. ERROR in C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseLocalServiceClp.java (at line 336)
    [javac]     ClpSerializer.translateInput(orderByComparator)
    [javac]     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The type java.util.Comparator cannot be resolved. It is indirectly referenced from required .class files
    [javac] ----------
    [javac] 3. ERROR in C:\Zerok\DevZone\liferay-plugins-sdk-6.2\portlets\MiProyecto-portlet\docroot\WEB-INF\service\asd\service\MiclaseLocalServiceClp.java (at line 632)
    [javac]     new Object[] { ClpSerializer.translateInput(beanIdentifier) });
    [javac]                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
    [javac] ----------
    [javac] 3 problems (3 errors)

BUILD FAILED

我在这里做错了吗?

推荐答案

我不知道liferay上是否允许id列,或者是服务构建器上列的保留标识符之一。

I don't know if the "id" column is allowed on liferay or is one of the reserved identifiers for columns on service builder.

您可以尝试使用id_而不是此列的ID吗?

Could you try with id_ instead of id for this column?

希望这会有所帮助。

编辑:我已经看到你正在使用Java 8.请用Java 7测试并告诉我们。

I've seen you're using Java 8. Please test it with Java 7 and tell us.

这篇关于Liferay Service Builder失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 08:57