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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:08:16+00:00 2026-06-13T11:08:16+00:00

My small project uses a database table that contains data about employees(name, phone, email).

  • 0

My small project uses a database table that contains data about employees(name, phone, email). It provides front-end managment(insert news employee, edit current, remove existing) of the list of employees via a web browser.

Whenever I run my project(to display the list of all employees) on the Tomcat server from Eclipse I get the following error:

java.lang.NullPointerException
com.myproject.crud.EmployeesListServlet.doGet(EmployeesListServlet.java:24)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

Line 24: request.setAttribute("employeess", employeesRepo.listEmployeess());

EmployeesListServlet

package com.myproject.crud;

import java.io.IOException;

import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings("serial")
@WebServlet("/employees/")
public class EmployeesListServlet extends HttpServlet {

    @Inject @JDBC
    private EmployeesRepository employeesRepo;

    public EmployeesListServlet() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setAttribute("employeess", employeesRepo.listEmployeess());
        getServletContext().getRequestDispatcher("/WEB-INF/pages/employees-listing.jsp").forward(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    }

}
  • 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-06-13T11:08:17+00:00Added an answer on June 13, 2026 at 11:08 am

    Your previous question confirms that you were trying to follow this tutorial. It is however targeted on Caucho Resin, a full fledged Java EE application server which supports all the Java EE fanciness out the box without the need to add some more JARs.

    You, however, are using Tomcat. Tomcat is a barebones JSP/Servlet container which doesn’t support all the other Java EE fanciness out the box. It supports only JSP and Servlets. The @Inject, which is part of the CDI, wouldn’t have been importable in your Java servlet code in first place. That you got it to compile can only mean that you downloaded some JAR containing javax.inject.Inject and dropped it in runtime classpath.

    This isn’t the way how to install CDI in Tomcat. You’d need to do a bit more work. See also among others Weld (the CDI reference implementation) documentation on Tomcat.


    I would however recommend to stop reading that tutorial, it isn’t exactly a very nice introdcuction to Java EE (the @JDBC annotation is at its own also somewhat a “wtf?”) and look for another tutorial, or better, a real book. If you want seriously learn Java EE, then I’d also recommend to replace Tomcat by a real Java EE application server, such as TomEE, Glassfish, JBoss AS, etc. They all ship with CDI out the box (and JPA and EJB which are way much better than JDBC).

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

Sidebar

Related Questions

I have a small RIA that I built as a learning/make-my-life-easier project that uses
i'm trying to make a small project that uses multiple forms (dialogs) for different
I have a project on that uses core data and I had migration implemented
I have a small project that uses libglade and use the following to load
I've got a Java project, which uses a small SQLite database. Now I want
I'm currently working on a small client/server project that uses CORBA and I am
I have a small racing project that uses a MySQL backend. I am trying
I'm working on a small PyGtk project that uses a GtkListStore to contain the
I get a small project to do on scoring system. I found out that
I have a small project that I was using node-dirty for, but it's not

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.