I've been working on this some more, but still having problems. As
suggested, I was going to post further in the jboss community forum,
but registering there requires company information of me that frankly
I'm not authorized to provide. And so, since this is still very much
related to Guice, I'm posting here.

I got the example from the linked page above checked out and set up in
my IDE, but here's my admission - I don't know maven whatsoever. (I
intend to learn it at some point, but am hoping it does not become a
pre-requisite to get guice injection working in jboss.) At the moment
I get the following error when I run 'mvn deploy':
"Error retrieving previous build number for artifact
'org.jboss.demos:jboss-demos:pom': repository metadata for: 'snapshot
org.jboss.demos:jboss-demos:2.0.0-SNAPSHOT' could not be retrieved
from repository: snapshots.jboss.org due to an error: Authorization
failed: Not authorized." ...which I decided not to pursue very far.
(If I have to bite the bullet here, let me know, but I'm hoping that's
not necessary quite yet.)

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.


On a complete side note, I tried also creating a service archive (SAR)
and got it deployed correctly, but ended up with the same error in the
end. In creating my SAR, I never could figure out how anything would
know how to access the Guice injector I created in my Guice Service...
Anyway, it's probably the completely wrong way to go about it, but I'm
trying what I can!

If anyone could fill in some (probably obvious) holes in my knowledge
here, I would much appreciate it! Thank you,
  -Mateo



On May 19, 1:33 pm, Ales Justin <[email protected]> wrote:
> I think it's best you push the issue to our MC user forum:
> *http://community.jboss.org/en/jbossmc
>
> > and attempted to follow its instructions, but without success. I admit
> > it's a little over my head and I need to gain a better understanding
> > of jboss and mbeans.
>
> What was the issue?
> It's all maven2 based, so hopefully it shouldn't be too much of a problem 
> using it inside any IDE.
>
> > At the moment I'm getting a java.lang.InstantiationException which I
> > assume is because JBoss is not yet trying to use Guice to instantiate
> > my service.
>
> Post the stack trace to our forum.
>
> > My initial guess is that I don't have the xml module bean stuff e.g.
> > <bean name="GuicePlugin"
> > class="org.jboss.guice.spi.GuiceKernelRegistryEntryPlugin"> in the
> > right place. But I've not been able to find anything that says where
> > to put it. Under jboss/server/default/deploy there are numerous bean
> > xml files, but it seems like the xml file to declare this module
> > should be part of my code - part of my .ear. I've currently placed it
> > at the base of my ear.
>
> It should actually be part of JBossAS bootstrap.
> * the jar should go into JBOSS_HOME/lib
> * the bean / plugin definition should go into any bootstrap.xml ref file
>
> (more info on the potential forum post)
>
> > I'll be happy to add more information, but I don't know what someone
> > would need in order to help me figure this out. As well as any tips to
> > figuring out this specific issue, I'd love any reading recommendations
> > about what fundamentals I should understand when building a jboss +
> > guice type project.
>
> The test cases are good way of finding out how things work.
>
> -Ales
>
> --
> 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 
> athttp://groups.google.com/group/google-guice?hl=en.

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