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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:18:51+00:00 2026-05-26T20:18:51+00:00

I have installed the latest JBoss AS 7 (7.0.2) and installed the eclipse tools

  • 0

I have installed the latest JBoss AS 7 (7.0.2) and installed the eclipse tools to connect it with WTP. I created a “Dynamic Web Project” (without maven). I try to get a “HelloWorld” running. There are just two classes.

@WebServlet("/HelloWorld")
public class HelloWorldServlet extends HttpServlet {
    @Inject
    HelloService helloService;

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter writer = resp.getWriter();
        writer.println("<html><head /><body>");
        writer.println("<h1>" + helloService.createHelloMessage("World") + "</h1>");
        writer.println("</body></html>");
        writer.close();
    }
}

public class HelloService {
    public String createHelloMessage(String name) {
        return "Hello " + name + "!";
    }
}

I start the server from eclipse and it starts without errors. But when calling my servlet from the browser (localhost:8080) my code throws an NPE.

10:28:29,646 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/hello].[hello.HelloWorldServlet]] (http--127.0.0.1-8080-1) Servlet.service() for servlet hello.HelloWorldServlet threw exception: java.lang.NullPointerException
    at hello.HelloWorldServlet.doGet(HelloWorldServlet.java:23) [classes:]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    [...]

Seems that the @Inject annotation does not work. How to track down the problem? What might be the cause?

  • 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-26T20:18:52+00:00Added an answer on May 26, 2026 at 8:18 pm

    A beans.xml file is required for bean discovery (and thereby for injection to work correctly) and in most cases just an empty beans.xml would do.

    Some quick links:
    Configuring a CDI Application
    Why is beans.xml required in CDI?

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

Sidebar

Related Questions

I have installed the latest ncurses library which my project is using. Now, I
I have installed the latest android sdk (android-sdk_r10-windows.zip), latest eclipse helios (eclipse-jee-helios-SR2-win32.zip) and latest
my eclipse is 3.6,i have installed the latest sdk,but when i install the ADT
i have installed the latest iphone sdk 3.0 beta 5, and trying to submit
I have installed the latest version of netbeans and its working.. I have opened
I have just installed that latest stable release of TortoiseSVN on Windows Server 2003
I have setup a git repository in a linux server, and installed the latest
I'm running Windows XP SP3 and I do have the latest .NET libraries installed,
I have installed CherryPy 3.1.0,. Here is what happens when I try to run
I have installed latest free version of zend studio and it got expired. I

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.