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

  • SEARCH
  • Home
  • 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 6018233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:14:43+00:00 2026-05-23T03:14:43+00:00

Hi guys with my question. A GWT project, as i have read Gin i

  • 0

Hi guys with my question. A GWT project, as i have read Gin i usable only on the client side than Guice is usable on the server side. Here is my question.

Let first post some example code.

Server side.

public class WebchargeServiceImpl extends RemoteServiceServlet implements WebchargeService
{
@Inject
private Injector injector;
@Inject
private ExecuteOperations executeOperations;

.....
executeOperations.do(); ....

Here is the injected class ExecuteOperations

@Singleton
public class ExecuteOperations
{
.........
}

Also i have servlet module class

public class SampleWebGuiceServletConfig extends GuiceServletContextListener
{
@Override
protected Injector getInjector()
{
  return Guice.createInjector(Stage.DEVELOPMENT, new SampleWebModule());
}

} // class

…..

public class SampleWebModule extends ServletModule
{

    @Override
    protected void configureServlets()
    {
       bind(WebchargeServiceImpl.class);  //is it correct to bind a class like that?
    } // class

web.xml

  <servlet>
        <servlet-name>.......WebchargeService</servlet-name>
        <servlet-class>.....WebchargeServiceImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>.........WebchargeService</servlet-name>
        <url-pattern>/Webcharge/WebchargeService</url-pattern>
    </servlet-mapping>
    <filter>
        <filter-name>guiceFilter</filter-name>
        <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
      </filter>
    <filter-mapping>
        <filter-name>guiceFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>......SampleWebGuiceServletConfig</listener-class>
    </listener>
</web-app>

I’m missing something because i get null every time, this code works ok in servlet/jsp env but here…
Advice place.

Thanks.

  • 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-23T03:14:44+00:00Added an answer on May 23, 2026 at 3:14 am

    You have to map your WebchargeServiceImpl servlet in your SampleWebModule, not in your web.xml; otherwise it’ll be constructed by your servlet container and not by Guice, so it won’t be “injected”.

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

Sidebar

Related Questions

Rather basic question here guys. Basically I have code like this: public SuperPanel() {
Hey guys i have a question here, How do i create a body that
Hello guys I have a question regardless a old code a client needed a
Hey guys quick question, I have an entry that I put in my database,
Hey guys quick question, I currently have an insert statement $query= INSERT into new_mail
Hey guys quick question. I have a div that gets assigned a number to
guys I have two question to ask, they're easy, but bothering me for a
Hey guys quick question, I have an add remove script that will add a
Hey guys really quick question, I have a simple test that I was doing
I'm kinda new here and I've got a programming/coding related question you guys maybe

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.