Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3605816
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:10:15+00:00 2026-05-18T21:10:15+00:00

I’m trying Guice. I made a simple example which is very similar to the

  • 0

I’m trying Guice. I made a simple example which is very similar to the example in the Guice Getting Started manual.

But it didn’t work for some time and said:

Could not find a suitable constructor
in mypack.ServiceUser. Classes must
have either one (and only one)
constructor annotated with @Inject or
a zero-argument constructor that is
not private. at
mypack.ServiceUser.class(ServiceUser.java:14)
while locating mypack.ServiceUser

The problem was in imports. I attached both Google Guice and TestNG to the project. And I imported classes from org.testng.guice package. But annotation Inject was imported from the javax.inject package. After I changed that import to org.testng.guice.Inject my program began working.

But after that I played with imports a little more. And I changed all org.testng imports to com.google.inject. The program still worked. After that I went back to the @Inject annotation and changed its import to javax.inject.Inject (as it was in my very first broken version). And the program worked even after that.

I checked ones again: Guice from TestNG packages doesn’t work with javax.inject.Inject while Guice from google packages (com.google.inject) works normally with it.

Why is it so weird?

p.s. I use last versions of both Guice and TestNG (guice-3.0-rc1 and testng-5.14.5).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:10:16+00:00Added an answer on May 18, 2026 at 9:10 pm

    The short answer is: @Guice is still a work in progress and being designed on the mailing-list as we speak, so it’s still experimental.

    Also, you are using undocumented packages that are reserved for TestNG’s internal use (org.testng.guice).

    I pushed a new version just today, you can download it at http://testng.org/beta

    Note that this new version no longer has org.testng.guice, so make sure that whenever you need Guice symbols, you import them from com.google.inject.

    Please post on the testng-users mailing-list if you have any more questions/concerns.

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Seemingly simple, but I cannot find anything relevant on the web. What is the
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.