Class loader issues trying to add gwt-jackson as encoder/decoder

228 views
Skip to first unread message

Lucas Machado

unread,
Apr 12, 2016, 11:14:33 AM4/12/16
to rest...@googlegroups.com
I am currently working on this issue https://github.com/resty-gwt/resty-gwt/issues/310 and i can use some help.

At this point i define a new property

<define-property name="restygwt.encodeDecode.useGwtJackson" values="true,false" />

And with a few changes on restygwt i was able to generate new EncodersDecoders based on GWT Jackson. :)

The modified source code is available here https://github.com/lucasam/resty-gwt

I am currently able to compile this new version and add it as dependency to a small gwt project that basically make 8 different async requests and print the results.
This small project works fine.
The source of this project can be found here https://github.com/lucasam/jaxson_example

The problem is
When i try to add a new test case identical to BasicTestGwt but with the useGwtJackson property equals to true I get the following message

[INFO] Running all GwtTestCases but AnnotationResolver
[INFO] logging for HtmlUnit thread
[INFO]    [WARN] Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'http://172.17.0.2:54217/org.fusesource.restygwt.BasicGwtJacksonTestGwt.JUnit/org.fusesource.restygwt.BasicGwtJacksonTestGwt.JUnit.nocache.js', but got 'application/x-javascript'.
[INFO] Rebinding com.google.gwt.core.client.impl.SchedulerImpl
[INFO]    Checking rule <replace-with class='com.github.nmorel.gwtjackson.client.JsonSerializationContext.DefaultBuilder'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder' specified in deferred binding rule
[INFO]    Checking rule <generate-with class='com.github.nmorel.gwtjackson.rebind.ObjectMapperGenerator'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.ObjectWriter' specified in deferred binding rule
[INFO] Rebinding com.google.gwt.junit.client.impl.JUnitHost
[INFO]    Checking rule <replace-with class='com.github.nmorel.gwtjackson.client.JsonSerializationContext.DefaultBuilder'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder' specified in deferred binding rule
[INFO]    Checking rule <generate-with class='com.github.nmorel.gwtjackson.rebind.ObjectMapperGenerator'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.ObjectWriter' specified in deferred binding rule
[INFO] Rebinding com.google.gwt.user.client.impl.WindowImpl
[INFO]    Checking rule <replace-with class='com.github.nmorel.gwtjackson.client.JsonSerializationContext.DefaultBuilder'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder' specified in deferred binding rule
[INFO]    Checking rule <generate-with class='com.github.nmorel.gwtjackson.rebind.ObjectMapperGenerator'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.ObjectWriter' specified in deferred binding rule
[INFO] Rebinding org.fusesource.restygwt.client.basic.ExampleService
[INFO]    Adding '2' new generated units
[INFO]       Resolving org.fusesource.restygwt.client.basic.ExampleDto_Gen_GwtJackEncDec_.GwtJackMapper
[INFO]          Found type 'org.fusesource.restygwt.client.basic.ExampleDto_Gen_GwtJackEncDec_.GwtJackMapper'
[INFO]             [ERROR] Unable to resolve class com/github/nmorel/gwtjackson/client/ObjectMapper
[INFO] Rebinding com.google.gwt.logging.client.LogConfiguration.LogConfigurationImplNull
[INFO]    Checking rule <replace-with class='com.github.nmorel.gwtjackson.client.JsonSerializationContext.DefaultBuilder'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder' specified in deferred binding rule
[INFO]    Checking rule <generate-with class='com.github.nmorel.gwtjackson.rebind.ObjectMapperGenerator'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.ObjectWriter' specified in deferred binding rule
[INFO] Rebinding org.fusesource.restygwt.client.basic.ExampleDto_Gen_GwtJackEncDec_.GwtJackMapper
[INFO]    Checking rule <replace-with class='com.github.nmorel.gwtjackson.client.JsonSerializationContext.DefaultBuilder'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder' specified in deferred binding rule
[INFO]    Checking rule <generate-with class='com.github.nmorel.gwtjackson.rebind.ObjectMapperGenerator'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.ObjectWriter' specified in deferred binding rule
[INFO] [ERROR] Deferred binding result type 'org.fusesource.restygwt.client.basic.ExampleDto_Gen_GwtJackEncDec_.GwtJackMapper' should not be abstract
[INFO] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 13.186 sec <<< FAILURE!

We can observe classloader issues on the beggining of the process
[INFO]    Checking rule <replace-with class='com.github.nmorel.gwtjackson.client.JsonSerializationContext.DefaultBuilder'/>
[INFO]       [WARN] Unknown type 'com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder' specified in deferred binding rule
And finally 
[INFO] Rebinding org.fusesource.restygwt.client.basic.ExampleService
[INFO]    Adding '2' new generated units
[INFO]       Resolving org.fusesource.restygwt.client.basic.ExampleDto_Gen_GwtJackEncDec_.GwtJackMapper
[INFO]          Found type 'org.fusesource.restygwt.client.basic.ExampleDto_Gen_GwtJackEncDec_.GwtJackMapper'
[INFO]             [ERROR] Unable to resolve class com/github/nmorel/gwtjackson/client/ObjectMapper
 
I already inspected the generated classes and it is fine. 
I already inspected the maven with -X and the gwt-jackson jars are in the classpath.

The same behavior is present in other bigger gwt project with a large set of dependencies. As so i am not inclined to believe that this is a GWTTestCase issue but a classloader issue with gwt-jackson.
GWT jackson has this open bug https://github.com/nmorel/gwt-jackson/issues/41 which I was inclined to blame, but i already re-compiled everything with openjdk7 and the problem persists.

I currently believe that there is some dependency that is preventing gwt-jackson from loading.
Does anyone have some clue about what is going on? 

--
Lucas Machado

christian

unread,
Apr 12, 2016, 2:16:42 PM4/12/16
to rest...@googlegroups.com
great news. I will have brief look tomorrow morning my time otherwise give me a day or two to find some more time for it. thanks for taking this one up - it feels like a big step forward for restygwt.

- christian


--
You received this message because you are subscribed to the Google Groups "RestyGWT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to restygwt+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

christian

unread,
Apr 13, 2016, 10:03:34 AM4/13/16
to christian, rest...@googlegroups.com
strange error indeed as all looks OK.

what about just using your https://github.com/lucasam/jaxson_example and add it as integration in restygwt/src/it/gwt-jackson

which would serve as start but still we need to find the problem as you say it  affects bigger projects.

christian

unread,
Apr 13, 2016, 10:08:26 AM4/13/16
to christian, rest...@googlegroups.com
the problem is that we declare jackson-xzy dependencies with restygwt/pom.xml as well and pick version 2.5.3 and gwt-jackson uses some (not all) but with version 2.7.2

I am sure once you cleaned up the dependency tree and maybe use the dependencies from gwt-jackson or so, things will work.

- christian


Lucas Machado

unread,
Apr 13, 2016, 10:14:04 AM4/13/16
to rest...@googlegroups.com, christian
well
about your suggestion. Let me work on it a little more. I am not ready to give up yet :)

I will add deps on the project jaxson_example util it breaks to try to find the source of the problem.
And will try to get help with gwt-jackson guys also.

If anyone has some clue please let me know

--
You received this message because you are subscribed to the Google Groups "RestyGWT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to restygwt+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Lucas Machado

christian

unread,
Apr 14, 2016, 5:43:27 AM4/14/16
to rest...@googlegroups.com, christian
submitted a small PR to your branch which fixes the dependencies :)
Reply all
Reply to author
Forward
0 new messages