0

我有一个 maven + spring + gwt(2.4.0) 项目。当我运行 mvn gwt:run 时,出现以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project star: Compilation failure: Compilation failure:
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\customer\CDocumentProxy.java:[19,8] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\customer\CDocumentProxy.java:[21,25] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\dealer\DealerTargetAgreementProxy.java:[35,36] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\dealer\DealerTargetAgreementProxy.java:[40,15] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\services\dealer\TreeNodeTargetAgreementRequest.java:[29,33] error: Could not find domain method similar to java.util.List<com.base.star.server.dto.dealer.FileTextDTO> getTreeNodeTargetAgreementsList(java.lang.Long)

我的 CDocumpentProxy.java 看起来像:

@ProxyFor(value = com.base.star.server.domain.CDocument.class, locator=
com.base.star.server.locators.customer.CDocumentLocator.class)
public interface CDocumentProxy extends EntityProxy {

byte[] getDocument(); //line 19

void setDocument(byte[] document); //line 21

如果我使用 STS 2.9.2 构建项目,则项目构建。所以我认为问题是对 maven-compiler-plugin 的错误配置。

在我的 .pom 文件中,我配置了 maven-compiler-plugin,如下所示:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.5.1</version>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
    <encoding>UTF-8</encoding>
  </configuration>
 </plugin>

我不能使用 byte[] 作为请求工厂代理中方法的返回类型吗?我只是无法理解错误..

4

1 回答 1

1

您不能在请求工厂中使用数组:https ://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory#transportable

话虽如此,对于byte[]等价物,我宁愿使用 a 而String不是 a List<Byte>,并且 GWT 模拟String#getBytesUTF-8 和 ISO-8859-1 字符集。

于 2012-07-27T11:31:41.850 回答