Migration from RCP to Rest - problem with Guava(?)

已查看 58 次
跳至第一个未读帖子

Tomek Kańka

未读,
2014年10月25日 04:34:532014/10/25
收件人 gwt-pl...@googlegroups.com
I'm trying to migrate from rcp to Rest.
I upgraded GWTP to 1.3.1, cleaned all incompatibilities, created first service, but when I added RestDispatch to my Presenter

java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService; at com.google.common.cache.LocalCache.<clinit>(LocalCache.java:160) at com.google.common.cache.LocalCache$LocalLoadingCache.<init>(LocalCache.java:4814) at com.google.common.cache.CacheBuilder.build(CacheBuilder.java:789)
[...]

This is Maven project, so I'm pretty sure that I've got only one Guava jar on my classpath.


Richard Wallis

未读,
2014年10月25日 04:56:182014/10/25
收件人 gwt-pl...@googlegroups.com
what version of Guava are you using?  gwtp uses 17.0

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

Tomek Kańka

未读,
2014年10月25日 07:05:242014/10/25
收件人 gwt-pl...@googlegroups.com


W dniu sobota, 25 października 2014 10:56:18 UTC+2 użytkownik Richard Wallis napisał:
what version of Guava are you using?  gwtp uses 17.0



I'm not usung Guava at all:).
Guava appears only in dependencies from gwtp and it is in fact 17.0.
 

Christian Goudreau

未读,
2014年10月25日 09:51:102014/10/25
收件人 gwt-pl...@googlegroups.com
Where is this method called? sameThreadExecutor
--
Christian Goudreau | CEO - Président
M: 1.877.635.1585 | S: christian.goudreau

Tomek Kańka

未读,
2014年10月31日 07:27:062014/10/31
收件人 gwt-pl...@googlegroups.com


W dniu sobota, 25 października 2014 15:51:10 UTC+2 użytkownik Christian Goudreau napisał:
[...]

Sorry guys, I've got 2 guava jars! The other one was from deep buried dependency in other project.

But now I've got real problem:

I've got two separate gwt modules app and app2
In app there is ApplicationPresenter, and in app2 is Application2Presenter

When maven compiles App it can't find Application2Presenter, but it doesn't need it!
How to separate this modules?


[INFO] Compiling module pl.test.gwt.App
[INFO]    Computing all possible rebind results for 'com.gwtplatform.mvp.client.DesktopGinjector'
[INFO]       Rebinding com.gwtplatform.mvp.client.DesktopGinjector
[INFO]          Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
[INFO]             [ERROR] Error injecting pl.test.gwt.app2.Application2Presenter$MyView: Unable to create or inherit binding: No @Inject or default constructor
 found for pl.test.gwt.app2.Application2Presenter$MyView
[INFO]   Path to required node:
[INFO]
[INFO] com.google.gwt.inject.client.AsyncProvider<pl.test.gwt.app2.Application2Presenter> [com.gwtplatform.mvp.client.ClientGinjector#getpltestgwtapp2Applicatio
n2Presenter()]
[INFO]  -> pl.test.gwt.app2.Application2Presenter [Implicit injection of com.google.gwt.inject.client.AsyncProvider<pl.test.gwt.app2.Application2Presenter>]
[INFO]  -> pl.test.gwt.app2.Application2Presenter$MyView [@Inject constructor of pl.test.gwt.app2.Application2Presenter]
[INFO]
[INFO]    [ERROR] Errors in 'gen/com/gwtplatform/mvp/client/DesktopGinjectorProvider.java'
[INFO]       [ERROR] Line 8: Failed to resolve 'com.gwtplatform.mvp.client.DesktopGinjector' via deferred binding
[INFO]    Computing all possible rebind results for 'com.gwtplatform.mvp.client.TabletGinjector'
[INFO]       Rebinding com.gwtplatform.mvp.client.TabletGinjector
[INFO]          Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
[INFO]             [ERROR] Error injecting pl.test.gwt.app2.Application2Presenter$MyView: Unable to create or inherit binding: No @Inject or default constructor
 found for pl.test.gwt.app2.Application2Presenter$MyView
[INFO]   Path to required node:
[INFO]
[INFO] com.google.gwt.inject.client.AsyncProvider<pl.test.gwt.app2.Application2Presenter> [com.gwtplatform.mvp.client.ClientGinjector#getpltestgwtapp2Applicatio
n2Presenter()]
[INFO]  -> pl.test.gwt.app2.Application2Presenter [Implicit injection of com.google.gwt.inject.client.AsyncProvider<pl.test.gwt.app2.Application2Presenter>]
[INFO]  -> pl.test.gwt.app2.Application2Presenter$MyView [@Inject constructor of pl.test.gwt.app2.Application2Presenter]
[INFO]
[INFO]    [ERROR] Errors in 'gen/com/gwtplatform/mvp/client/TabletGinjectorProvider.java'
[INFO]       [ERROR] Line 8: Failed to resolve 'com.gwtplatform.mvp.client.TabletGinjector' via deferred binding
[INFO]    Computing all possible rebind results for 'com.gwtplatform.mvp.client.MobileGinjector'
[INFO]       Rebinding com.gwtplatform.mvp.client.MobileGinjector
[INFO]          Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
[INFO]             [ERROR] Error injecting pl.test.gwt.app2.Application2Presenter$MyView: Unable to create or inherit binding: No @Inject or default constructor
 found for pl.test.gwt.app2.Application2Presenter$MyView
[INFO]   Path to required node:
[INFO]
[INFO] com.google.gwt.inject.client.AsyncProvider<pl.test.gwt.app2.Application2Presenter> [com.gwtplatform.mvp.client.ClientGinjector#getpltestgwtapp2Applicatio
n2Presenter()]


Richard Wallis

未读,
2014年10月31日 07:46:252014/10/31
收件人 gwt-pl...@googlegroups.com
Hopefully Christian will tell me I'm wrong about this but I think this is actually a bug with gwtp where some of the generators will try to instantiate Presenters even if they're not bound by the programmer.

eg: if you have an unbound presenter with a proxy place the presenter will get instantiated in generated code which means it needs to be bound even if it's not being used in the actual code.

Means you can't just comment out a gin module / binding to remove a presenter from your code.

---

So you'll need to bind the presenter even if you're not using it.  Or move it to a different gwt source folder that the first gwt.xml module can't see.



Tomek Kańka

未读,
2014年10月31日 09:27:352014/10/31
收件人 gwt-pl...@googlegroups.com


W dniu piątek, 31 października 2014 12:46:25 UTC+1 użytkownik Richard Wallis napisał:
Hopefully Christian will tell me I'm wrong about this but I think this is actually a bug with gwtp where some of the generators will try to instantiate Presenters even if they're not bound by the programmer.

eg: if you have an unbound presenter with a proxy place the presenter will get instantiated in generated code which means it needs to be bound even if it's not being used in the actual code.

Means you can't just comment out a gin module / binding to remove a presenter from your code.



Isn't possible to fall back to old-style Ginjectors?

And if I have to put all presenters in one big module, does it make application more heavy to load?


 

Richard Wallis

未读,
2014年10月31日 09:38:402014/10/31
收件人 gwt-pl...@googlegroups.com
assuming you have multiple gwt.xml modules the best way I think is to give them separate source folders.

eg in your app.gwt.xml::

<source path="/a_path_not_common_to_both_modules" />

Then put the presenter that you don't want to included in your compile into a path that isn't a source for your module.


--

Maxime Mériouma-Caron

未读,
2014年11月1日 20:37:112014/11/1
收件人 gwt-pl...@googlegroups.com
Richard is right. It is by design for the GinjectorGenerator. It gathers all the Presenters/Proxies. Why are you putting 2 different apps under the same source tree? The usual way is to separate each of your module in a separate path like Richard suggest. There are probably a lot of classes that are used by both of your modules, just create a "Common" module that will include all the common code.

Tomek Kańka

未读,
2014年11月3日 09:20:242014/11/3
收件人 gwt-pl...@googlegroups.com


W dniu niedziela, 2 listopada 2014 01:37:11 UTC+1 użytkownik Maxime Mériouma-Caron napisał:
Richard is right. It is by design for the GinjectorGenerator. It gathers all the Presenters/Proxies.

OK

 
Why are you putting 2 different apps under the same source tree?

Because I've migrated from 1 module to separates.
 
The usual way is to separate each of your module in a separate path like Richard suggest. There are probably a lot of classes that are used by both of your modules, just create a "Common" module that will include all the common code.


That's the way I followed. Client, admin and common packages.
 


Thanks to all for help.
 
回复全部
回复作者
转发
0 个新帖子