Thursday, December 27, 2012

Re: Gwt 2.2, guice and gin...

It makes sense. I guess projects using maven are not seeing the problem because GIN itself is pulling in the Guice dependency which results in correct order.

This is very nice of you sharing it with the rest. Thanks!




On Thu, Dec 27, 2012 at 6:45 AM, Avanish Raju <yaraju@gmail.com> wrote:
Hi Goktug!

(+google-gin for posterity)

Thanks for the reply! I dug deeper into this today, and nailed it. It was indeed a Classpath issue. In specific, the ordering. Perhaps one of the GWT/RequestFactory, or other libraries were overriding the javax.inject imports that are provided by GIN.

Here's the order that finally worked:
            aopalliance.jar          gin-2.0.jar          guice-3.0.jar          guice-assistedinject-3.0.jar          javax.inject.jar

I made the change in Eclipse: Project> Build Path > Configure Build Path > Order and Export. Select all of the above, and choose "Top", and then tick all of the JARS. Any other way, I would continue to get the error. (The only thing I didn't try is juggling around the order of these specific JARS)

One more issue I ran into, and Thomas(tbroyer) has already answered on StackOverflow:

I ran into this NPE, which happens because I was injecting the RequestFactory, and not running "initialize" on it. Solved by writing a Provider in my GinModule:

   @Provides
   @Singleton
   MyAppRequestFactory provideMyAppRequestFactory(EventBus eventBus) {
      MyAppRequestFactory requestFactory = GWT.create(MyAppRequestFactory.class);
      requestFactory.initialize(eventBus);
      return requestFactory;
   }

After that, it runs fine. :) Thanks once again!

Cheers, 
Avanish


On Thu, Dec 27, 2012 at 2:23 AM, Goktug Gokdogan <goktug@google.com> wrote:
This may be related to depending on multiple versions of Guice.
As this is related to GIN, google-gin group is a better place to get support on this. There was even a recent question about it if you search there.

Good luck and don't forget to share with the rest what worked for you for future reference :)

On Sun, Dec 23, 2012 at 5:01 AM, Avanish Raju <yaraju@gmail.com> wrote:
GinjectorBindings

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
"Life is what you make of it"
Y. Avanish Raju,

BTech, Computer Science and Engineering & Biotechnology,
ICFAI University, Dehradun

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/S/MU d- s:- a- C+++ UL+++ P+ L+++>++++ E-->--- W++>+++ N- o? K- w+>w++ !O !M !V
PS++@ PE++ Y+@ PGP- t 5? X+ R tv b+++ DI+@ D+ G e>++ h* r-- y
------END GEEK CODE BLOCK------

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment