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 7513207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:06:25+00:00 2026-05-30T00:06:25+00:00

i am using guice with java play framework. i have a simple command interface,

  • 0

i am using guice with java play framework.

i have a simple command interface, and a implementor created in java like this:

public interface ICommand {
public void test();
}

And the implementor

public class CommandImpl implements ICommand {
@Override
public void test() {
System.out.println("test");
}

And then the binding class for @Inject:

public class ICommandModule extends AbstractModule{
@Override
protected void configure() {
bind(ICommand.class).to(CommandImpl.class);
}
}

When i try the command like this:

@Inject
private static ICommand Command;
public static void index() {
Command.test();
render();
}

i get these errors:

From Web Browser:

Execution exception
NullPointerException occured : null

From the Console:

Execution exception (In /app/controllers/Application.java around line 27) NullPointerException occured : null
play.exceptions.JavaExecutionException  
  at play.mvc.ActionInvoker.invoke(ActionInvoker.java:231)  
  at Invocation.HTTP Request(Play!) 
Caused by: 
java.lang.NullPointerException  
  at controllers.Application.index(Application.java:27)     
  at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)  
  at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)  
  at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)  
  at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)  
  at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)  ... 1 more

Thanks for helping!

  • 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-30T00:06:26+00:00Added an answer on May 30, 2026 at 12:06 am

    You are using static. Inject works only on instance variable and constructors.
    You need to use requestStaticInjection in your module.

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

Sidebar

Related Questions

I have a problem using Gin. Here is a simple example. @GinModules(AppModule.class) public interface
I'm using Tomcat 6.0.33 with Java 6. I have this servlet ... public class
prerequisites: I'm using the latest version of the Play! framework , and the Java
This thread is a little related too: framework or not and Spring or Java
I have some Guice binding code using generics that compiles and functions fine from
I am merging two files using FFMPEG command in java. I want to show
How to delete a string of the XML node using java. I have two
I have just started using Google Guice with my Tomcat webapp, and have noticed
Im using swing in java to make a quiz for my coursework. I have
I am using java and the purpose of my demo application is simple: Update

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.