Radu Chilom
Radu Chilom

Reputation: 1

Error: The type byte[] cannot be used here. (In Proxy Class of Request Factory)

I have a maven + spring + gwt(2.4.0) project. When I am running mvn gwt:run i get the following error :

[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)

My CDocumpentProxy.java looks like :

@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

If i build the project with STS 2.9.2 the project builds up. So i think the problem is bad configuration to maven-compiler-plugin.

In my .pom file i have configure maven-compiler-plugin like :

<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>

Can't i use byte[] as a return type for a method in a request factory proxy ? I just can't understand the error..

Upvotes: 0

Views: 864

Answers (1)

Thomas Broyer
Thomas Broyer

Reputation: 64541

You cannot use arrays in Request Factory: https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory#transportable

That being said, for a byte[] equivalent, I'd rather use a String than a List<Byte>, and GWT emulates String#getBytes for the UTF-8 and ISO-8859-1 charsets.

Upvotes: 1

Related Questions