(老问题)
我正在对Liferay进行一些测试。为此,我正在关注MVC教程,并陷入了服务的困境。
我为测试目的创建了一个简单的实体,“Miclase”:
public class Miclase {
int num1;
String string1;
}
很简单,呵呵。好吧,在此之后,我启动了服务构建器并使用Overview窗格创建了这样的文件:
<?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="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>
在“概述”窗格中显示所有内容都没有错误,所以我点击了“构建服务”按钮,它创建了很多源代码:
[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
但是...在上一次输出之后,我得到以下构建失败:
[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] 2 problems (2 errors)
我在这里做错了吗?
答案 0 :(得分:0)
我犯了同样的错误,我已经解决了6个小时!
解决方案很简单:
您需要转到Window - Preferences - Server - Runtime Environments
,选择您的环境,按edit
,然后选择JDK 1.7.0_79
,但不 1.8.x.
。不同版本存在问题。
我希望它可以节省很多时间。 :d