为什么liferay中的服务构建器会抛出解析器错误?

时间:2014-07-15 19:02:26

标签: liferay liferay-service-builder

我试图在LiferayIDE中使用ant构建服务,到目前为止没有运气,控制台一直显示错误,表示在Service Builder的多行中存在解析器错误。

错误如下:

 [echo] 18:50:41,514 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:497:16: unexpected token: String
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,623 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:506:16: unexpected token: void
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,623 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:522:16: unexpected token: String
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,623 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:531:16: unexpected token: void
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,623 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:546:16: unexpected token: int
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,623 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:555:16: unexpected token: void
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,733 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:571:16: unexpected token: String
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,733 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:580:16: unexpected token: void
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinitionInternal(InternalJavaParser.java:660)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.typeDefinition(InternalJavaParser.java:465)
 [echo]     at de.hunsicker.jalopy.language.antlr.InternalJavaParser.parse(InternalJavaParser.java:296)
 [echo]     at de.hunsicker.jalopy.language.JavaRecognizer.parse(JavaRecognizer.java:588)
 [echo]     at de.hunsicker.jalopy.Jalopy.parse(Jalopy.java:1212)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1044)
 [echo]     at de.hunsicker.jalopy.Jalopy.format(Jalopy.java:1017)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:449)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.writeFile(ServiceBuilder.java:365)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createModel(ServiceBuilder.java:2194)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:758)
 [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:228)
 [echo] 18:50:41,733 ERROR [main][java:355] PARSER_ERROR
 [echo] C:\lportal\plugins\portlets\caja-en-linea-portlet\ServiceBuilder.temp:590:12: unexpected token: boolean

这意味着我的 service.xml 出了问题,但我无法找出错误。

我的service.xml如下:

<?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="com.cide.cajaenlinea.econtinua">
    <author>Gerardo</author>
<namespace>ECcaja</namespace>
<entity name="MovimientosTesoreria" local-service="true" data-source="catalogosEvolution" remote-service="false" table="TTesoreriaMovimientos"
session-factory="EvolutionSessionFactory">
<column name="IdMovimiento" type="int" primary="true"></column>
<column name="IdTipoMovimiento" type="int"></column>
<column name="IdCatCuentaBancaria" type="int"></column>
<column name="IdUsuario" type="int"></column>
<column name="IdDivisaTipoCambio" type="int"></column>
<column name="IdPoliza" type="int"></column>
<column name="IdTipoIngreso" type="int"></column>
<column name="IdAFavorDePersona" type="int"></column>
<column name="IdAFavorDeTipo" type="int"></column>
<column name="FolioMovimiento" type="int"></column>
<column name="NumeroCheque" type="String"></column>
<column name="Concepto" type="String"></column>
<column name="FechaRegistro" type="Date"></column>
<column name="Debe" type="double"></column>
<column name="Haber" type="double"></column>
<column name="FechaExpedicion" type="Date"></column>
<column name="FechaDeposito" type="Date"></column>
<column name="Pagado" type="boolean"></column>
<column name="EjercicioAnt" type="boolean"></column>
<column name="FechaEntrega" type="Date"></column>
<column name="CFDSerie" type="String"></column>
<column name="CFDFolio" type="int"></column>
<column name="CFDMetodoPago" type="String"></column>
<column name="CFDFormaPago" type="String"></column>
<column name="IdDatosFacturacion" type="int"></column>
<column name="IdDatosFacturacionAFavorDe" type="int"></column>
<column name="IdTipoPago" type="int"></column>
<column name="NaturalezaMovimiento" type="String"></column>
<column name="Inhabilitado" type="boolean"></column>
<column name="Cantidad" type="int"></column>
<column name="FoliosRequerimiento" type="String"></column>
<column name="IdCaja" type="int"></column>
<column name="TipoFolio" type="int"></column>
<column name="IdInformacionBancaria" type="int"></column>
<finder return-type="Collection" name="MovimientosIdMovimiento">
<finder-column name="IdMovimiento"></finder-column>
</finder>
<finder return-type="Collection" name="MovimientosFolios">
<finder-column name="FolioMovimiento"></finder-column>
</finder>
<finder return-type="Collection" name="MovimientosAFavorDe">
<finder-column name="IdAFavorDePersona"></finder-column>
<finder-column name="IdAFavorDeTipo"></finder-column>
</finder>
</entity>
<entity name="Empleados" local-service="true" data-source="catalogosEvolution" remote-service="false" table="Empleado"
session-factory="EvolutionSessionFactory">
<column name="claveempleado" type="int"></column>
<column name="Id" type="int" primary="true"></column>
<column name="Nombre" type="String"></column>
<column name="Paterno" type="String"></column>
<column name="Materno" type="String"></column>
<column name="Nombres" type="String"></column>
<column name="Fecha Nacimiento" type="Date"></column>
<column name="Lugar Nacimiento" type="String"></column>
<column name="Sexo" type="int"></column>
<column name="Estado Civil" type="int"></column>
<column name="Calle" type="String"></column>
<column name="Colonia" type="String"></column>
<column name="Cp" type="String"></column>
<column name="Delegacion" type="String"></column>
<column name="Estado" type="String"></column>
<column name="Tel1" type="String"></column>
<column name="Email" type="String"></column>
<column name="CURP" type="String"></column>
<column name="RFC" type="String"></column>
<column name="Id_Adscripcion" type="int"></column>
<column name="EmailCia" type="String"></column>
<finder return-type="Collection" name="EmpleadoPClave">
<finder-column name="claveempleado"></finder-column>
</finder>
<finder return-type="Collection" name="EmpleadoPNombre">
<finder-column name="Nombre"></finder-column>
<finder-column name="Paterno"></finder-column>
<finder-column name="Materno"></finder-column>
<finder-column name="Nombres"></finder-column>
</finder>
<finder return-type="Collection" name="EmpleadoPEmail">
<finder-column name="Email"></finder-column>
<finder-column name="EmailCia"></finder-column>
</finder>
</entity>
<entity name="NumerosOrden" local-service="true" data-source="catalogosEvolution" remote-service="false" table="TNumsOrdenAFoliosMovimiento"
session-factory="EvolutionSessionFactory">
<column name="idOrden" type="int" primary="true"></column>
<column name="numOrden" type="int"></column>
<column name="FolioMovimiento" type="String"></column>
<column name="RFCCliente" type="String"></column>
<column name="NombreCliente" type="String"></column>
<column name="Calle" type="String"></column>
<column name="Colonia" type="String"></column>
<column name="Pais" type="String"></column>
<column name="CodigoPostal" type="String"></column>
<column name="Delegacion" type="String"></column>
<column name="Digest" type="String"></column>
<column name="Respuesta" type="String"></column>
<column name="Total" type="double"></column>
<column name="Afiliacion" type="String"></column>
<column name="Store" type="String"></column>
<column name="Terminal" type="String"></column>
<column name="NumReferencia" type="String"></column>
<column name="NumAutorizacion" type="String"></column>
<column name="Verificado" type="boolean"></column>
<finder return-type="Collection" name="CompraPNumDeOrden">
<finder-column name="numOrden"></finder-column>
<finder-column name="FolioMovimiento"></finder-column>
</finder>
<finder return-type="Collection" name="CompraPorRFCCliente">
<finder-column name="RFCCliente"></finder-column>
</finder>
</entity>
<entity name="Alumnos" local-service="true" data-source="catalogosEvolution" remote-service="false" table="Alumnos"
session-factory="EvolutionSessionFactory">
<column name="MatriculaId" type="int"></column>
<column name="Matricula" type="String" primary="true"></column>
<column name="ApellidoPaterno" type="String"></column>
<column name="ApellidoMaterno" type="String"></column>
<column name="Nombre" type="String"></column>
<column name="EdoCivil" type="String"></column>
<column name="RFC" type="String"></column>
<column name="CURP" type="String"></column>
<column name="Sexo" type="String"></column>
<column name="Pais" type="String"></column>
<column name="Entidad" type="String"></column>
<column name="Municipio" type="String"></column>
<column name="Calle" type="String"></column>
<column name="Colonia" type="String"></column>
<column name="CodigoPostal" type="String"></column>
<column name="Telefono" type="String"></column>
<column name="Email" type="String"></column>
<finder return-type="Collection" name="AlumnoPMatricula">
<finder-column name="Matricula"></finder-column>
</finder>
<finder return-type="Collection" name="AlumnoPRFC">
<finder-column name="RFC"></finder-column>
<finder-column name="CURP"></finder-column>
</finder>
</entity>
<entity name="Generales" local-service="true" data-source="catalogosEvolution" remote-service="false" table="CatGenerales"
session-factory="EvolutionSessionFactory">
<column name="IdGeneral" type="int" primary="true"></column>
<column name="RFC" type="String"></column>
<column name="GralDescripcion" type="String"></column>
<column name="Inhabilitado" type="boolean"></column>
<column name="IdUsuario" type="int"></column>
<column name="FechaUltimoCambio" type="Date"></column>
<finder return-type="Collection" name="GeneralPRFC">
<finder-column name="RFC"></finder-column>
</finder>
<finder name="GeneralPNombre" return-type="Collection">
<finder-column name="GralDescripcion"></finder-column>
</finder>
</entity>
</service-builder>

在尝试再次构建服务之后,我发现问题必须在我的实体&#34; Empleados&#34;中,因为如果我包含它,服务构建器会抛出错误,所有其他实体似乎都没问题。但我仍然无法找到我写这个实体的方式可能出现的错误。 Folowing是实体Empleados:

<entity name="Empleados" local-service="true" data-source="catalogosEvolution" remote-service="false" table="Empleado" session-factory="EvolutionSessionFactory">
2    <column name="claveempleado" type="int"></column>
3    <column name="Id" type="int" primary="true"></column>
4    <column name="Nombre" type="String"></column>
5    <column name="Paterno" type="String"></column>
6    <column name="Materno" type="String"></column>
7    <column name="Nombres" type="String"></column>
8    <column name="Fecha Nacimiento" type="Date"></column>
9    <column name="Lugar Nacimiento" type="String"></column>
10    <column name="Sexo" type="int"></column>
11    <column name="Estado Civil" type="int"></column>
12    <column name="Calle" type="String"></column>
13    <column name="Colonia" type="String"></column>
14    <column name="Cp" type="String"></column>
15    <column name="Delegacion" type="String"></column>
16    <column name="Estado" type="String"></column>
17    <column name="Tel1" type="String"></column>
18    <column name="Email" type="String"></column> 
19    <column name="CURP" type="String"></column>
20    <column name="RFC" type="String"></column>
21    <column name="Id_Adscripcion" type="int"></column>
22    <column name="EmailCia" type="String"></column>
23    <finder return-type="Collection" name="EmpleadoPClave">
24    <finder-column name="claveempleado"></finder-column>
25    </finder>
26    <finder return-type="Collection" name="EmpleadoPNombre">
27    <finder-column name="Nombre"></finder-column>
28    <finder-column name="Paterno"></finder-column>
29    <finder-column name="Materno"></finder-column>
30    <finder-column name="Nombres"></finder-column>
31    </finder>
32    <finder return-type="Collection" name="EmpleadoPEmail">
33    <finder-column name="Email"></finder-column>
34    <finder-column name="EmailCia"></finder-column>
35    </finder>
36    </entity>

但我仍然无法弄清楚最后一个实体的错误。它可能是某些列名称中的空格吗?如果是这样,那就会出现问题,因为这个列名在数据库中定义了空格。我也忘了提及这一点,以及实体&#34; Para Identificacion&#34;是一种观点,而不是一张桌子。

1 个答案:

答案 0 :(得分:3)

ServiceBuilder使用name属性为每个实体模型生成方法名称等内容。例如,Fecha Nacimiento会在每个生成的getFecha Nacimiento类中生成Empleados

不幸的是,这是造成解析错误的原因,因为getFecha Nacimiento由于空格而不是有效的方法名称。