Errors trying to compile project

29 views
Skip to first unread message

Roberto Leibman

unread,
May 15, 2012, 4:14:15 PM5/15/12
to Scala+GWT
Hi!
First of all, thank you for the project, it is super cool!

I'm using ant to try to compile my own project, loosely based on your
scalawt-sample, when I do so, I get a bunch of errors, along these
lines:

<CLIP>

[java] Computing all possible rebind results for
'com.dienique.gourmet_web.client.GourmetWebService'
[java] Rebinding
com.dienique.gourmet_web.client.GourmetWebService
[java] Invoking generator
com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator
[java] Generating client proxy for remote service
interface 'com.dienique.gourmet_web.client.GourmetWebService'
[java] Using a shard size of 0 for
TypeSerializerCreator createMethodMap
[java] Adding '51' new generated units
[java] Added 51 units to persistent cache.
[java] Validating units:
[java] Errors in 'generated://
C821C48314CBD04FF64FAD48EF0594CB/com/dienique/gourmet_web/client/
GourmetWebService_TypeSerializer
.java'
[java] Line 136: Referencing class
'scala.math.Numeric_BigDecimalAsIfIntegral$_FieldSerializer': unable
to resolve class
[java] Line 136: Referencing class
'scala.math.Numeric_BigDecimalAsIfIntegral$_FieldSerializer': unable
to resolve class
[java] Line 141: Referencing class
'scala.math.Numeric_BigDecimalIsFractional$_FieldSerializer': unable
to resolve class

And so on, with a bunch of these things afterwards.
<CLIP>

Any clues?


Thanks a lot,

Roberto Leibman

Nate Bauernfeind

unread,
May 15, 2012, 4:20:55 PM5/15/12
to scal...@googlegroups.com
Do you have a small example that you can share that exhibits this issue?

Roberto Leibman

unread,
May 16, 2012, 3:00:36 PM5/16/12
to Scala+GWT
Thanks for looking into it...

I've been trying to create a minimum sample but have been unable.
However, the following does break (albeit in a bit different way)

trait GourmetWebServiceAsync {
def recipes(callback: AsyncCallback[Set[Recipe]]): Unit
}

@RemoteServiceRelativePath("gourmetWebService")
trait GourmetWebService extends RemoteService {
def recipes: Set[Recipe]
}

class GourmetWebServiceImpl extends RemoteServiceServlet with
GourmetWebService {
def recipes: Set[Recipe] = {
var retVal = Set[Recipe]()
DatabaseManager.recipes.foreach(copyMe => retVal += copyMe)
retVal
}

implicit def RecipeDB2Recipe(convertMe : RecipeDB):Recipe = {
null //TODO write this
}
}

object DatabaseManager {
def recipes: java.util.List[Recipe] = {
val query = session.createQuery("from Recipe recipe
order by recipe.title")
query.list.asInstanceOf[java.util.List[Recipe]]
}
}

I should say that I'm mostly new to scala so the above may not make
any sense, criticism is welcome!

The errors I get from this in the gwtc part of the compile and are:
[java] Added 14 units to persistent cache.
[java] Validating units:
[java] Errors in 'generated://
081DBC1073A596F3AA20B1A900F18CC2/com/dienique/gourmet_web/client/
GourmetWebService_TypeSerializer.java'
[java] Line 51: Referencing class
'scala.collection.immutable.HashSet_EmptyHashSet$_FieldSerializer':
unable to resolve class
[java] Line 51: Referencing class
'scala.collection.immutable.HashSet_EmptyHashSet$_FieldSerializer':
unable to resolve class
[java] Line 61: Referencing class
'scala.collection.immutable.ListSet_EmptyListSet$_FieldSerializer':
unable to resolve class
[java] Line 61: Referencing class
'scala.collection.immutable.ListSet_EmptyListSet$_FieldSerializer':
unable to resolve class
[java] Line 66: Referencing class
'scala.collection.immutable.Set_EmptySet$_FieldSerializer': unable to
resolve class
[java] Line 66: Referencing class
'scala.collection.immutable.Set_EmptySet$_FieldSerializer': unable to
resolve class

Nate Bauernfeind

unread,
May 16, 2012, 3:14:28 PM5/16/12
to scal...@googlegroups.com
Ok, this is (likely) exactly what I thought it was.

Currently the entire scala collections library is not serializable/deserializable for consumption via GWT RPC.

To get around this you will need to use the java collection library. Be careful using the implicit JavaConversions package as those create wrapper objects around the original types (scala or java) that are also not serializable.

You can serialize/deserialize case classes if they're marked serializable and all parameters are var. 

This thread is most likely to be of use:

Roberto Leibman

unread,
May 16, 2012, 4:48:27 PM5/16/12
to Scala+GWT
On May 16, 12:14 pm, Nate Bauernfeind <nate.bauernfe...@gmail.com>
wrote:
> Ok, this is (likely) exactly what I thought it was.
>
> Currently the entire scala collections library is not
> serializable/deserializable for consumption via GWT RPC.

Ok, so I switched it to use an Array of Recipe instead of a set, and
that got rid of that problem... however, my original problem still
remains

Now I get a different error:

...
[java] com.google.gwt.dev.jjs.InternalCompilerException:
Unexpected error during visit.
[java] at
com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:
109)
...
[java] Caused by: java.lang.NoSuchFieldError:
com.dienique.gourmet_web.shared.Recipe.cuisine:Ljava/lang/String;
[java] at
com.google.gwt.dev.jjs.impl.UnifyAst.translate(UnifyAst.java:1060)
...
[java] [ERROR] at Recipe_FieldSerializer.java(16): null
cuisine
[java] com.google.gwt.dev.jjs.ast.js.JsniFieldRef
[java] [ERROR] at Recipe_FieldSerializer.java(14): /*-{
[java]
instance.@com.dienique.gourmet_web.shared.Recipe::cuisine = value;
[java] }-*/;
[java] com.google.gwt.dev.jjs.ast.js.JsniMethodBody
[java] [ERROR] at Recipe_FieldSerializer.java(14): private
static native void setCuisine(Recipe instance, String value);
[java]
[java] com.google.gwt.dev.jjs.ast.JMethod

My Recipe class looks like this:


class Recipe extends com.google.gwt.user.client.rpc.IsSerializable {
var id= 0
var title= ""
var instructions= ""
var modifications= ""
var cuisine= ""
}
Reply all
Reply to author
Forward
0 new messages