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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:12:58+00:00 2026-06-04T23:12:58+00:00

I am making a web application using JBOSS and Seam but I am trying

  • 0

I am making a web application using JBOSS and Seam but I am trying to use entityManager in one of my classes but it is null. I have it connected to an outside database and printed out the entityManager in the class and it just said null. when i try to open the webpage that uses the class I get a null pointer exception and the webpage says could not instantiate Seam component. I’ve spent hours on the internet trying to figure out what’s wrong but i have been unsuccessful. Any help would be appreciated. Here is the code for the class:

package edu.uwrf.iss.flowershop.session;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.jboss.aop.util.logging.SystemOutLoggerPlugin;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

import edu.uwrf.iss.flowershop.entity.FlowerStoreEmployee;



@Stateful  
@Scope(ScopeType.SESSION)
@Name("employeePort")
public class EmployeeBean implements EmployeePortal {

//These are the variables to store the employee information
String empID;
String first;
String last;
String ssn;
String phone;
String pay;
String vehicle;
String house;
String street;
String city;
String state;
String zip;

@In (create=true)
private EntityManager entityManager;
//this is the employee list
List<FlowerStoreEmployee> employeeList;

//Constructor
public EmployeeBean(){
    employeeList = new ArrayList<FlowerStoreEmployee>();
    loadEmployeeList();
}

@SuppressWarnings("unchecked")
public void loadEmployeeList(){
    employeeList = new ArrayList<FlowerStoreEmployee>();
    entityManager.isOpen();
    Query query = entityManager.createQuery("SELECT e FROM FlowerStoreVehicle e");

    employeeList.addAll((List<FlowerStoreEmployee>)query.getResultList());
}

//Getters and Setters

public List<FlowerStoreEmployee> getEmployeeList() {
    return employeeList;
}

public void setEmployeeList(List<FlowerStoreEmployee> employeeList) {
    this.employeeList = employeeList;
}

//used by the add button on the addEmp.xhtml page
public String addEmployee(){
    int id = Integer.parseInt(empID);
    int soc = Integer.parseInt(ssn);
    int paid =Integer.parseInt(pay);
    int vehID = Integer.parseInt(vehicle);
    int houseID = Integer.parseInt(house);
    Integer zCode = Integer.parseInt(zip);
    FlowerStoreEmployee n = new FlowerStoreEmployee();
    n.setNameFirst(first);
    n.setNameLast(last);
    n.setPay(pay);
    n.setPhone(phone);
    n.setSsn(ssn);
    employeeList.add(n);
    entityManager.persist(n);
    return "/employee.xhtml";
}

//used by the remove button on the remEmp.xhtml page
public String remEmployee(){
        int searchID = Integer.parseInt(empID);
        int emp = 0;
        int i = 0;
        FlowerStoreEmployee e;
        while (emp!= searchID && i<employeeList.size()){
            e = employeeList.get(i);
            emp = e.getEmployeeId();
        }
        employeeList.remove(i);
        return "/employee.xhtml";
}

//clears the variables used to temporarily store the information entered on the forms
public void clearTemps(){
    this.empID = null;
    this.first = null;
    this.last = null;
    this.ssn = null;
    this.phone=null;
    this.pay = null;
    this.vehicle = null;
    this.house = null;
    this.street=null;
    this.city=null;
    this.state=null;
    this.zip=null;
}


public String createEmp() {
    clearTemps();
    System.out.println("words");
    return "FlowerStore/addEmp.xhtml";
}


//Setters and getters

public String getEmpID() {
    return empID;
}

public void setEmpID(String empID) {
    this.empID = empID;
}

public String getFirst() {
    return first;
}

public void setFirst(String first) {
    this.first = first;
}

public String getLast() {
    return last;
}

public void setLast(String last) {
    this.last = last;
}

public String getSsn() {
    return ssn;
}

public void setSsn(String ssn) {
    this.ssn = ssn;
}

public String getPhone() {
    return phone;
}

public void setPhone(String phone) {
    this.phone = phone;
}

public String getPay() {
    return pay;
}

public void setPay(String pay) {
    this.pay = pay;
}

public String getVehicle() {
    return vehicle;
}

public void setVehicle(String vehicle) {
    this.vehicle = vehicle;
}

public String getHouse() {
    return house;
}

public void setHouse(String house) {
    this.house = house;
}

public String getStreet() {
    return street;
}

public void setStreet(String street) {
    this.street = street;
}

public String getCity() {
    return city;
}

public void setCity(String city) {
    this.city = city;
}

public String getState() {
    return state;
}

public void setState(String state) {
    this.state = state;
}

public String getZip() {
    return zip;
}

public void setZip(String zip) {
    this.zip = zip;
}

/* Seam/Hibernate methods */
  @Remove
  public void remove() {
  }

  @Destroy
  public void destroy() {
  }


}

if any additional info is needed please let me know.

  • 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-04T23:13:00+00:00Added an answer on June 4, 2026 at 11:13 pm

    Injection can’t occur before construction, you’re trying to inject a component into something that hasn’t been created yet.

    Try instead making loadEmployeeList an init method and annotate it with @PostConstruct.
    https://community.jboss.org/thread/141133

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

Sidebar

Related Questions

I am making a web-based application using SEAM and JBOSS. I am trying to
I am making a web application using JBoss Seam 2.2.0, and I want to
I'm making a web application using ASP and AJAX, and I have a DropDownList
I have create a web application using CodeIgniter making at first a login interface.
I'm making a web application using PHP in where I have a form that
We're about to deploy a Java web application built using JBoss Seam as the
I'm making an application (web based) using flex and i have a requirment to
I am making an web application using silverlight 3.0 . In that application i
I am making a RIA application using Silverlight and web services. The method of
I am thinking of making an (initially) small Web Application, which would eventually have

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.