Note that there are some explanatory texts on larger screens.

plurals
  1. POEntityManager is null. Using Seam and JBOSS
    primarykey
    data
    text
    <p>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:</p> <pre><code>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&lt;FlowerStoreEmployee&gt; employeeList; //Constructor public EmployeeBean(){ employeeList = new ArrayList&lt;FlowerStoreEmployee&gt;(); loadEmployeeList(); } @SuppressWarnings("unchecked") public void loadEmployeeList(){ employeeList = new ArrayList&lt;FlowerStoreEmployee&gt;(); entityManager.isOpen(); Query query = entityManager.createQuery("SELECT e FROM FlowerStoreVehicle e"); employeeList.addAll((List&lt;FlowerStoreEmployee&gt;)query.getResultList()); } //Getters and Setters public List&lt;FlowerStoreEmployee&gt; getEmployeeList() { return employeeList; } public void setEmployeeList(List&lt;FlowerStoreEmployee&gt; 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 &amp;&amp; i&lt;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() { } } </code></pre> <p>if any additional info is needed please let me know.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload