On 11 May 2011 22:51, gary <[email protected]> wrote:

> Hi sam
>
> i started using guice 3 but had problems because it wouldn't working
> under eclipse ;-) in a bundle (can't remember the error, I was just at
> the stage of trying guice for the first time and rolled back to see if
> it was .0 release problem)
>
> I guess I should try guice 3 if there has been a newer release or at
> least see what the problem was
>

FYI, I've been using Guice 3.0 in Eclipse and various other OSGi runtimes,
since it's already a bundle, so if you can recreate the issue you had with
3.0 post the details and I'll compare it with my current setup (for example:
is Guice in your target platform, imported as an exploded bundle, or
imported as a source project?)


> regards
> gary
>
> On May 11, 9:23 pm, Sam Berlin <[email protected]> wrote:
> > Are you able to try it with Guice 3?  It has some better error messaging
> for
> > assisted inject.
> >  sam
> >
> >
> >
> >
> >
> >
> >
> > On Wed, May 11, 2011 at 4:10 PM, gary <[email protected]>
> wrote:
> > > I am trying to use assisted inject in guice v2 under eclipse inside a
> > > bundle in helios (eclipse 3.6)
> > > however I am getting a problem with IllegaAccessErrors:
> >
> > > Caused by: java.lang.IllegalAccessError: tried to access class
> > > com.google.inject.assistedinject.FactoryProvider2 from class
> > > $com.google.inject.assistedinject.FactoryProvider2$$FastClassByGuice$
> > > $9dcdf6d7
> > >        at $com.google.inject.assistedinject.FactoryProvider2$
> > > $FastClassByGuice$$9dcdf6d7.invoke(<generated>)
> > >        at
> > >
> com.google.inject.internal.cglib.reflect.FastMethod.invoke(FastMethod.java:
> > > 53)
> > >        at com.google.inject.SingleMethodInjector
> > > $1.invoke(SingleMethodInjector.java:59)
> > >        at
> > >
> com.google.inject.SingleMethodInjector.inject(SingleMethodInjector.java:
> > > 91)
> > >        at
> >
> > >
> com.google.inject.MembersInjectorImpl.injectMembers(MembersInjectorImpl.jav
> a:
> > > 99)
> > >        at com.google.inject.MembersInjectorImpl
> > > $1.call(MembersInjectorImpl.java:76)
> > >        at com.google.inject.MembersInjectorImpl
> > > $1.call(MembersInjectorImpl.java:74)
> > >        at
> com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:
> > > 804)
> > >        at
> >
> > >
> com.google.inject.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.j
> ava:
> > > 74)
> > >        at com.google.inject.Initializer
> > > $InjectableReference.get(Initializer.java:145)
> > >        at com.google.inject.Initializer.injectAll(Initializer.java:92)
> > >        at
> > >
> com.google.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:
> > > 171)
> > >        at
> com.google.inject.InjectorBuilder.build(InjectorBuilder.java:113)
> > >        at com.google.inject.Guice.createInjector(Guice.java:92)
> > >        at com.google.inject.Guice.createInjector(Guice.java:69)
> > >        at com.google.inject.Guice.createInjector(Guice.java:59)
> > >        at
> >
> > >
> org.dyndns.hephzibah.piltdown.base.services.GuiceSingleton.<init>(GuiceSing
> leton.java:
> > > 14)
> > >        at
> >
> > >
> org.dyndns.hephzibah.piltdown.plugin.PiltdownPlugin.start(PiltdownPlugin.ja
> va:
> > > 48)
> >
> > > here are the classes
> >
> > > in module configure (called from the bundle start method
> >
> > >
> bind(RootlessPiltdownCommandFactory.class).toProvider(FactoryProvider.newFa
> ctory(RootlessPiltdownCommandFactory.class,
> > > RootlessPiltdownCommand.class));
> >
> > > file RootlessPiltdownCommandFactory.java:
> >
> > > package org.dyndns.hephzibah.piltdown.commands;
> >
> > > import java.io.File;
> >
> > > public interface RootlessPiltdownCommandFactory {
> > >        public RootlessPiltdownCommand create(String command, String
> > > uiName);
> > >        public RootlessPiltdownCommand create(String command, String
> > > uiName,File workingDir);
> >
> > > }
> >
> > > in RootlessPiltdownCommand.java:
> >
> > > package org.dyndns.hephzibah.piltdown.commands;
> >
> > > import java.io.File;
> >
> > > public class RootlessPiltdownCommand extends AbstractShellCommand {
> >
> > >        @Inject
> > >        public RootlessPiltdownCommand(CoreCommandServices services,
> > > @Assisted  String command,  @Assisted  String uiName) {
> > >                this(services, command, uiName, (File) null);
> > >        }
> >
> > >        @Inject
> > >        public RootlessPiltdownCommand(CoreCommandServices services,
> > > @Assisted  String command,  @Assisted  String uiName,  @Assisted File
> > > workingDir) {
> > >                super(services, uiName, null, workingDir, false);
> >
> > >                Assert.isNotNull(command);
> > >                this.command = command;
> > >        }
> >
> > >        // operations
> > > ...
> > > }
> >
> > > can anyone help me I am most confused as to the problem as manually
> > > creating a factory and binding it seems to work ;-)...
> >
> > > regards
> > > gary
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to