Missing lib -> Guice

293 views
Skip to first unread message

Leonardo Galani

unread,
Dec 20, 2011, 6:11:19 AM12/20/11
to testng...@googlegroups.com
Cedric,

I tried to run testng on command line with custom listener (for reportng) and i got a error that guice lib was missing.
The fact is reportng dont use guice :)

So i download guice lib and it all worked out.

Can you see if there is depedency on guice on testng and if you can ship the next version with it ?! :)

Thks.

Att
Leonardo Barba Galani
Tester!

Java, Selenium e Coca Cola

吴亭

unread,
Dec 20, 2011, 10:10:29 AM12/20/11
to testng...@googlegroups.com

Hi
what version of testng you are using now?  i remember this problem had been fixed by the authors.

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

Cédric Beust ♔

unread,
Dec 20, 2011, 10:32:23 AM12/20/11
to testng...@googlegroups.com
Hi Leonardo,

You must be using an older version of TestNG, TestNG no longer uses Guice.

-- 
Cédric




--

Leonardo Galani

unread,
Dec 20, 2011, 10:36:53 AM12/20/11
to testng...@googlegroups.com
Cedric,

Im using testng-6.3.1.

I dont use the testng that comes with selenium lib.



Att
Leonardo Barba Galani
Tester!

Java, Selenium e Coca Cola

Cédric Beust ♔

unread,
Dec 20, 2011, 10:46:13 AM12/20/11
to testng...@googlegroups.com
Can you show the stack trace? I just checked the TestNG and JCommander sources and I didn't find any reference to Guice.

-- 
Cédric

Leonardo Galani

unread,
Dec 20, 2011, 2:26:18 PM12/20/11
to testng...@googlegroups.com

Here is the piece of stack error that i sent to Dan of the "ReportNG"


Exception in thread "main" java.lang.NoClassDefFoundError: com/google/inject/Mod
ule
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
        at java.lang.Class.privateGetPublicMethods(Class.java:2562)
        at java.lang.Class.getMethods(Class.java:1427)
        at org.apache.velocity.util.introspection.ClassMap.getAccessibleMethods(
ClassMap.java:258)
        at org.apache.velocity.util.introspection.ClassMap.populateMethodCache(C
lassMap.java:151)
.
.
.
.
        at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:449)
        at org.uncommons.reportng.AbstractReporter.generateFile(AbstractReporter
.java:108)
        at org.uncommons.reportng.HTMLReporter.createOverview(HTMLReporter.java:
142)
        at org.uncommons.reportng.HTMLReporter.generateReport(HTMLReporter.java:
107)
        at org.testng.TestNG.generateReports(TestNG.java:1032)
        at org.testng.TestNG.run(TestNG.java:991)
        at org.testng.TestNG.privateMain(TestNG.java:1282)
        at org.testng.TestNG.main(TestNG.java:1246)
Caused by: java.lang.ClassNotFoundException: com.google.inject.Module
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        ... 35 more

Cédric Beust ♔

unread,
Dec 20, 2011, 2:38:25 PM12/20/11
to testng...@googlegroups.com
Looks like ReportNG calls Velocity, which then does some introspection but I can't tell which class it's trying to introspect...

-- 
Cédric

Kevin Simonson

unread,
Dec 21, 2011, 11:53:41 AM12/21/11
to testng...@googlegroups.com

I’ve got a TestNG test method <getRecord()> that has a data provider <getRecParms()> that I’m trying to get working with IntelliJ.  I set a couple of breakpoints in <getRecParms()>, one of them at the very end of the method where it does a <return result;>, and I verified that <result> actually has values, namely an array of thirty elements, each of which element is a three element array, the first element a <Boolean>, the second a <ProjectEnum>, and the third element a <String>.  IntelliJ gets that far, and I set a breakpoint at the very beginning of <getRecord()>, but when I click on the green arrow icon it never gets to that breakpoint.

 

If I click on the <Console> tab I get a window that says:

 

  ^ Test Results

[-]   ^ org.familysearch.cds.acceptance

    [-]   ^ CollectionEndpointTest

        [+]   ^ getRecord (false, CENSUS_1, “”)

              ^ getRecord (false, PROBATE_3, “”)

              ^ getRecord (false, VITALS_4, “”)

              ^ getRecord (false, CENSUS_1, “7j7”)

              ^ getRecord (false, PROBATE_3, “7j7”)

              ^ getRecord (false, VITALS_4, “7j7”)

              ^ getRecord (false, CENSUS_1, “-1”)

              etc.

 

This seems to be a declaration that all these tests have failed.  How can the tests fail without IntelliJ ever getting to my breakpoint at the beginning of <testRecord()>?  Any information you can give me on this would be appreciated.

 

Kevin S

 

    @Test(dataProvider = "getRecParms", groups = { "middle-phase" })

    public void getRecord (     Boolean shouldWork

                          , ProjectEnum projEnum

                          ,      String rcId) throws CdsWsClientException {

 

        Collection cl = cdsManager.getCollection( null, projEnum.getCollectionId());

        String clId   = "" + cl.getDbId();

        try {

            CdsRecord cRc = cdsManager.getRecord( null, clId, rcId);

            Assert.assertTrue( shouldWork, "Expected an exception because record id is invalid; instead it worked!");

            String problem = misMatch( cRc, new FsiRecordDirector( rcId, false).getRecord());

            Assert.assertTrue

                ( problem == null

                , "Record returned via the endpoint had a " + problem + " field that didn't match expected record!");

        } catch (CdsWsClientException excptn) {

            Assert.assertFalse

              ( shouldWork

              ,   "Expected a valid record; instead \"/cds/collection/" + clId + "/record/" + rcId

                + "\" resulted in a <CdsMsgException> being thrown!");

        }

    }

 



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


Cédric Beust ♔

unread,
Dec 21, 2011, 12:10:16 PM12/21/11
to testng...@googlegroups.com
Hi Kevin,

Can you send me a small test class that I can build on my end to reproduce the problem? Also, I suggest making this happen on the command line first, just to make sure it's not an IDEA problem.

Thanks.

-- 
Cédric




Kevin Simonson

unread,
Dec 21, 2011, 12:45:58 PM12/21/11
to testng...@googlegroups.com

Never mind!  It turned out I just needed to run Maven on arguments “clean verify”.

 

Kevin S

Jostar

unread,
May 21, 2012, 5:33:24 AM5/21/12
to testng...@googlegroups.com

I'm using reportng-1.1.3 + velocity-dep-1.4 and testng-6.5.1 and i'm getting
the error below when i try to run a working TestNG-Suite with the
org.uncommons.reportng.HTMLReporter

I posted the assumption about the Velocity-lib beeing the problem to the
reportng-forum
(https://github.com/dwdyer/reportng/issues/28#issuecomment-5742890) and got
following answer from Dan Dyer:
"... This problem appears to have materialised with newer versions of
TestNG. I'm certain that neither ReportNG nor Velocity depend on Guice.
Version 1.4 of Velocity is years old, Guice didn't even exist when it was
released. My suspicion is that something in TestNG or one of it's
dependencies depends on Guice and Velocity inadvertently triggers that code.
..."

Could it be that you reintroduced the dependency to Guice with newer
versions of TestNG?

Thx in advance for any help!

--- stacktrace

java.lang.NoClassDefFoundError: com/google/inject/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.privateGetPublicMethods(Class.java:2547)
at java.lang.Class.getMethods(Class.java:1410)
at
org.apache.velocity.util.introspection.ClassMap.getAccessibleMethods(ClassMap.java:258)
at
org.apache.velocity.util.introspection.ClassMap.populateMethodCache(ClassMap.java:151)
at org.apache.velocity.util.introspection.ClassMap.(ClassMap.java:64)
at
org.apache.velocity.util.introspection.IntrospectorBase.createClassMap(IntrospectorBase.java:126)
at
org.apache.velocity.util.introspection.IntrospectorBase.getMethod(IntrospectorBase.java:112)
at
org.apache.velocity.util.introspection.Introspector.getMethod(Introspector.java:100)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.discover(PropertyExecutor.java:65)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.(PropertyExecutor.java:39)
at
org.apache.velocity.util.introspection.UberspectImpl.getPropertyGet(UberspectImpl.java:156)
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:125)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at
org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:327)
at
org.apache.velocity.runtime.parser.node.ASTAddNode.value(ASTAddNode.java:66)
at
org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:51)
at
org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:95)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:449)
at
org.uncommons.reportng.AbstractReporter.generateFile(AbstractReporter.java:108)
at org.uncommons.reportng.HTMLReporter.createOverview(HTMLReporter.java:142)
at org.uncommons.reportng.HTMLReporter.generateReport(HTMLReporter.java:107)
at org.testng.TestNG.generateReports(TestNG.java:1064)
at org.testng.TestNG.run(TestNG.java:1023)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:107)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:199)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:170)
Caused by: java.lang.ClassNotFoundException: com.google.inject.Module
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 36 more
>> *Leonardo Barba Galani
>> Tester!**
>> **Java, Selenium e Coca Cola* <http://www.leonardobg.com.br>
>>
>> ---- Original Message ----
>> *From*: Cédric Beust ♔ <ced...@beust.com>
>> *To*: testng...@googlegroups.com
>> *Sent*: Ter, Dez 20, 2011, 13:46 PM
>> *Subject*: Re: Re: [testng-users] Missing lib -> Guice
>>
>> Can you show the stack trace? I just checked the TestNG and JCommander
>> sources and I didn't find any reference to Guice.
>>
>> --
>> Cédric
>>
>>
>>
>>
>> On Tue, Dec 20, 2011 at 7:36 AM, Leonardo Galani
>> <l...@leonardobg.com.br>wrote:
>>
>>> Cedric,
>>>
>>> Im using testng-6.3.1.
>>>
>>> I dont use the testng that comes with selenium lib.
>>>
>>>
>>>
>>> Att
>>> *Leonardo Barba Galani
>>> Tester!**
>>> **Java, Selenium e Coca Cola* <http://www.leonardobg.com.br>
>>>
>>> ---- Original Message ----
>>> *From*: Cédric Beust ♔ <ced...@beust.com>
>>> *To*: testng...@googlegroups.com
>>> *Sent*: Ter, Dez 20, 2011, 13:32 PM
>>> *Subject*: Re: [testng-users] Missing lib -> Guice
>>>
>>> Hi Leonardo,
>>>
>>> You must be using an older version of TestNG, TestNG no longer uses
>>> Guice.
>>>
>>> --
>>> Cédric
>>>
>>>
>>>
>>>
>>> On Tue, Dec 20, 2011 at 3:11 AM, Leonardo Galani
>>> <l...@leonardobg.com.br>wrote:
>>>
>>>> Cedric,
>>>>
>>>> I tried to run testng on command line with custom listener (for
>>>> reportng) and i got a error that guice lib was missing.
>>>> The fact is reportng dont use guice :)
>>>>
>>>> So i download guice lib and it all worked out.
>>>>
>>>> Can you see if there is depedency on guice on testng and if you can
>>>> ship
>>>> the next version with it ?! :)
>>>>
>>>> Thks.
>>>>
>>>> Att
>>>> *Leonardo Barba Galani
>>>> Tester!**
>>>> **Java, Selenium e Coca Cola* <http://www.leonardobg.com.br>
View this message in context: http://old.nabble.com/Missing-lib--%3E-Guice-tp33009087p33881586.html
Sent from the testng-users mailing list archive at Nabble.com.

jeevan

unread,
May 21, 2012, 9:39:20 AM5/21/12
to testng...@googlegroups.com
I got the same error.... just download the Velocity jar file from Apache and add the same... it will work.

Thanks,
Jeevan

Cédric Beust ♔

unread,
May 21, 2012, 11:19:38 AM5/21/12
to testng...@googlegroups.com
There is a dependency on Guice that should only be triggered if you use TestNG's @Guice annotation.

-- 
Cédric

Jostar

unread,
May 22, 2012, 4:09:02 AM5/22/12
to testng...@googlegroups.com

I agree! But i definitely don't have any @Guice annotation! I just got the
same error when runing my "dummiest" test class... ;)
View this message in context: http://old.nabble.com/Missing-lib--%3E-Guice-tp33009087p33887568.html

Jostar

unread,
May 22, 2012, 4:27:11 AM5/22/12
to testng...@googlegroups.com

reportng-1.1.3-jar has an explicite dependency (MANIFEST.MF) to
velocity-dep-1.4.jar, so no easy way o replace that one by a newer version.

i tried anyway to add the newest velocity-jar (velocity-1.7-dep.jar) to my
classpath which as expected didn't change anything (steill get the error
posted previously)



jeevan-8 wrote:
>
> I got the same error.... just download the Velocity jar file from Apache
> and add the same... it will work.
>
> Thanks,
> Jeevan
>
>

--
View this message in context: http://old.nabble.com/Missing-lib--%3E-Guice-tp33009087p33887645.html
Reply all
Reply to author
Forward
0 new messages