Good to know about the location of those files. Thank you.

Your last comments confused me a bit. You mentioned "authentication"
which at first I understood to mean my AuthenticationWebService stuff
I'm trying to do, but later you mentioned the JBoss auth mechanism. I
guess I don't quite understand why native JBoss authentication stuff
is relevant here. As far as my Authentication* classes go, it could as
well be called "DiaperChangeWebService" or anything else. It's just a
Web Service.

What I think I gathered though from what you said is that I've
correctly told the MicroContainer (MC) to use Guice for my dependency
injections, but I need to tell JBoss somehow to delegate my dependency
injection to the MC? Is that right?



On Jun 3, 3:23 am, Ales Justin <[email protected]> wrote:
> Ah, yes, you don't and shouldn't need to put you config binding file into AS' 
> bootstrap.
> But you do need to put the binaries into JBOSS_HOME/lib, as you did.
>
> Ear's META-INF should be fine.
>
> You need to understand what you're actually getting with this integration.
> You only get a way to tell MC' kernel how to lookup / inject your Guice bound 
> instances based on class or key.
>
>    public KernelRegistryEntry getEntry(Object name)
>    {
>       KernelRegistryEntry entry = null;
>       try
>       {
>          if (name instanceof Class<?>)
>          {
>             Class<?> clazz = (Class<?>)name;
>             entry = new AbstractKernelRegistryEntry(name, 
> injector.getInstance(clazz));
>          }
>          else if (name instanceof Key)
>          {
>             Key<?> key = (Key<?>)name;
>             entry = new AbstractKernelRegistryEntry(name, 
> injector.getInstance(key));
>          }
>       }
>       catch (Exception ignored)
>       {
>       }
>       return entry;
>    }
>
> So, unless JBoss' mechanism for setting up authentication is using MC type 
> based injection,
> your stuff won't be picked up -- which is probably the case here.
>
> Dunno how you actually force the JBoss auth mechanism to do that.
> Try one of our forums, or perhaps Carlo (in CC) would know more. :-)
>
> > So, onto where I'm at. Ales, you mentioned the "jar" should go into
> > JBOSS_HOME/lib. I'm guessing you mean either the jboss-guice-
> > int-2.0.4.GA.jar and/or the jboss-microcontainer.jar. I've tried
> > placing both of them there as well as in my ear (not in both places at
> > the same time, but both of them in each place in different attempts).
> > You then said the bean / plugin definition should go into any
> > bootstrap.xml ref file. That to me means one of the xml files under
> > JBOSS_HOME/server/<ServerName>/conf/bootstrap/.  While that doesn't
> > seem right to me (because it seems to me like everything should stay
> > in my ear), I did try putting my kernel-registry-beans.xml file there
> > (with the GuiceKernelRegistryEntryPlugin bean defined) and still no
> > go. Perhaps I don't understand what makes a "bootstrap.xml ref file"?
> > I also tried sticking it in my ear's META-INF directory.
>
> > My xml file looks like so:
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <depoyment>
> >    <bean name="GuicePlugin"
> > class="org.jboss.guice.spi.GuiceKernelRegistryEntryPlugin">
> >        <constructor>
> >            <parameter>
> >                <array elementClass="com.google.inject.Module">
> >                    <bean
> > class="com.~~~.authentication.web.impl.AuthenticationWebModule" />
> >                </array>
> >            </parameter>
> >        </constructor>
> >    </bean>
> > </depoyment>
>
> > and my error looks like this:
>
> > javax.ejb.EJBException: java.lang.RuntimeException:
> > java.lang.InstantiationException:
> > com.~~~.authentication.web.impl.AuthenticationWebServiceImpl
> >    at
> > org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:
> > 77)
> >        ...
> > Caused by: java.lang.RuntimeException:
> > java.lang.InstantiationException:
> > com.~~~.authentication.web.impl.AuthenticationWebServiceImpl
> >    at org.jboss.ejb3.EJBContainer.construct(EJBContainer.java:838)
> >        ...
> > Caused by: java.lang.InstantiationException:
> > com.~~~.authentication.web.impl.AuthenticationWebServiceImpl
> >    at java.lang.Class.newInstance0(Class.java:340)
> >        ...
>
> > So it seems to me that JBoss is still trying to instantiate my
> > AuthenticationWebServiceImpl instead of Guice.

-- 
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