错误:此处不能使用类型byte []。 (在请求工厂的代理类中)

时间:2012-07-27 11:10:45

标签: spring gwt maven requestfactory

我有一个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 []用作请求工厂代理中方法的返回类型吗?我只是无法理解错误..

1 个答案:

答案 0 :(得分:1)

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

话虽如此,对于byte[]等价物,我宁愿使用String而不是List<Byte>,GWT会为{1}}模拟UTF-8和ISO -8859-1 charsets。