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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:20:18+00:00 2026-06-04T20:20:18+00:00

I am trying to code a small website which just uses a form. I

  • 0

I am trying to code a small website which just uses a form. I use Eclipse IDE(indigo) and JBOSS AS 7.1 server. I have coded using JSF 2.0 and latest ICEfaces components. Right now i have added JPA components to read/write to oracle database. Entity was created for a sample table and i able to map to the database. But during runtime when i try to call the entity manger from a bean to get the persistence unit, it get null value. I am not sure where i am doing wrong.

Here is the code for the entity, persistence file, bean, xhtml

    package org.icefaces.training.applicant.view.model;

import java.io.Serializable;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.AjaxBehaviorEvent;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceUnit;
import javax.persistence.Query;
import javax.transaction.NotSupportedException;
import javax.transaction.SystemException;
import javax.transaction.UserTransaction;

import org.icefaces.training.applicant.model.EmployeesEntity;

@ManagedBean(name = "jobApplicant")
@ViewScoped
public class JobApplicant implements Serializable {
    private String firstName;
    private String lastName;
    private String country;
    private String title;
    private Integer salary;
    private String email;
    private String subject;
    private String resume;
    private String lastName1;

    @PersistenceUnit(unitName="jobApplication")
    private EntityManagerFactory emf;





    public String getValue() throws NotSupportedException, SystemException
    {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("jobApplication");
        EntityManager em = emf.createEntityManager();
        EmployeesEntity emp = em.find(EmployeesEntity.class, 207);

        return emp.getLAST_NAME();

    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getResume() {
        return resume;
    }

    public void setResume(String resume) {
        this.resume = resume;
    }

    public  void submit(ActionEvent ae) {
    if (firstName.equals("joe") && lastName.equals("bush")){
        String str="Joe Bush is already existed";
        FacesMessage facesMessage = new FacesMessage(str);
        FacesContext facesContext = FacesContext.getCurrentInstance();
        String clientID = null; // this is a global message
        facesContext.addMessage(clientID, facesMessage);
    }
    }

    @Override
    public String toString() {
        return "jobApplicant " + super.toString();
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getSalary() {
        return salary;
    }

    public void setSalary(Integer salary) {
        this.salary = salary;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
    @PostConstruct
    public void clear() {
        setFirstName("");
        setLastName("");
        setCountry("");
        setSalary(0);
        setEmail("");
        setTitle(null);
    }




}

Entity

package org.icefaces.training.applicant.model;

import java.io.Serializable;
import java.lang.Number;
import java.lang.String;
import javax.persistence.*;
import static javax.persistence.AccessType.FIELD;

/**
 * Entity implementation class for Entity: EmployeesEntity
 *
 */
@Entity

@Table(schema = "TUHRA", name = "EMPLOYEES")

public class EmployeesEntity implements Serializable {

    @Id
    private Number Employee_ID;
    private String FIRST_NAME;
    private String LAST_NAME;
    private static final long serialVersionUID = 1L;

    public EmployeesEntity() {
        super();
    }   
    public Number getEmployee_ID() {
        return this.Employee_ID;
    }

    public void setEmployee_ID(Number Employee_ID) {
        this.Employee_ID = Employee_ID;
    }   
    public String getFIRST_NAME() {
        return this.FIRST_NAME;
    }

    public void setFIRST_NAME(String FIRST_NAME) {
        this.FIRST_NAME = FIRST_NAME;
    }   
    public String getLAST_NAME() {
        return this.LAST_NAME;
    }

    public void setLAST_NAME(String LAST_NAME) {
        this.LAST_NAME = LAST_NAME;
    }

}

Persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="jobApplication">

    <provider>org.hibernate.ejb.HibernatePersistence</provider> 
    <!--   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> -->
     <jta-data-source>java:/OracleJINDI</jta-data-source>
    <class>org.icefaces.training.applicant.model.EmployeesEntity</class>
      <properties>
      <!-- <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver" />
      <property name="hibernate.connection.url" value="jdbc:oracle:thin:@oracleapps:1521:PROD" />
      <property name="hibernate.connection.username" value="tuhra" />
      <property name="hibernate.connection.password" value="tuhra" /> -->


      </properties>

    </persistence-unit>
</persistence>

xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:icecore="http://www.icefaces.org/icefaces/core"   xmlns:ace="http://www.icefaces.org/icefaces/components"    xmlns:ice="http://www.icesoft.com/icefaces/component">

<h:head>


    </h:head>
    <h:body >
    <ui:composition template="/WEB-INF/templates/template.xhtml" >
    <ui:param name="title" value="Applicant System" />
    <ui:define name="header">
    <h:graphicImage library="images" name="icefaces.png" />
    <h:outputStylesheet library="css" name="jobApplication.css" /> 
    </ui:define>
    <ui:define name="menu">
    <h:button outcome="applicants" value="Listing Page" />
    </ui:define>
    <ui:define name="content">

    <h:messages globalOnly="true" />
    <h:form>
    <h:panelGrid columns="3">
    <h:outputLabel for="title" value="Title: " />
    <h:selectOneRadio id="title" value="#{jobApplicant.title}"  required="true">
     <f:selectItem itemLabel="Dr." itemValue="1"/>
      <f:selectItem itemLabel="Ms." itemValue="2"/>
       <f:selectItem itemLabel="Mrs." itemValue="3"/>
        <f:selectItem itemLabel="Miss." itemValue="4"/>
         <f:selectItem itemLabel="Mr." itemValue="5"/>
     </h:selectOneRadio>
     <h:message for="title" />
        <h:outputLabel for="firstName" value="First Name"></h:outputLabel>
        <h:inputText id="firstName" value="#{jobApplicant.firstName}" required="true" 
        converter="wordCapitalization"/>
        <h:message for="firstName" />
        <h:outputLabel for="lastName" value="Last Name"></h:outputLabel>
        <h:inputText id="lastName" value="#{jobApplicant.lastName}" required="true"
        converter="wordCapitalization" />
        <h:message for="lastName" />
        <h:outputLabel for="country" value="Country" />
        <h:selectOneMenu id="country" value="#{jobApplicant.country}" required="true">
         <f:selectItem itemLabel="-Select-" noSelectionOption="true"/>
         <f:selectItems value="#{countryList.countries}"/>
        </h:selectOneMenu> 
        <h:message for="country" />
        <h:outputLabel for="salary" value="Salary: " />
        <h:inputText id="salary" value="#{jobApplicant.salary}" required="true">
    <f:validateLongRange minimum="1" maximum="1000000"/> 
        <f:convertNumber type="currency"   />
        </h:inputText>
        <h:message for="salary" />
        <h:outputLabel for="email" value="Email: " />
        <h:inputText id="email" value="#{jobApplicant.email}"  validator="emailValidator" required="true"/>
        <h:message for="email"/>
        <h:outputLabel for="lastname1" value="Last Name: " />
        <h:outputText value="#{jobApplicant.value}" />
        <h:message for="lastname1"/>


        <h:outputLabel for="subject" value="Subject: " />
                    <ice:inputText id="subject" value="#{jobApplicant.subject}"></ice:inputText>
                    <h:message for="subject"/>
        <h:outputLabel for="body" value="Body: " />
                    <ice:inputRichText id="resume" saveOnSubmit="true" toolbar="Default" width="500" height="200" value="#{jobApplicant.resume}"></ice:inputRichText>
                    <h:message for="body"/>
                    <h:commandButton value="Submit: Applicant" action="#{applicationController.addApplicant}" />

         <h:commandButton id="clearButton" value="Clear" >
         <f:ajax event="click" render="@form" listener="#{applicationController.clearForm}" immediate="true"/>
         </h:commandButton>
         <h:commandButton id="cancelButton" action="cancelJobApplication" immediate="true" value="Cancel" />
      </h:panelGrid>
    </h:form>
    </ui:define>
    <ui:define name="footer">
    <br />
    - Server - <br />
    Title: <h:outputText value="#{jobApplicant.title}" /> <br />
    First Name: <h:outputText value="#{jobApplicant.firstName}" /> <br />
    Last Name: <h:outputText value="#{jobApplicant.lastName}" /> <br />
    Country: <h:outputText value="#{jobApplicant.country}" /><br />
    Salary: <h:outputLabel value="#{jobApplicant.salary}" /><br />
    Email: <h:outputLabel value="#{jobApplicant.email}" /><br />
    Applicants: <h:outputLabel value="#{applicants.applicantsList}" /><br />
    </ui:define>
    </ui:composition>
</h:body>
</html>

Thanks for responding, but when i look through the books below is what i assume is correct.

    @PersistenceUnit(unitName="jobApplication")
private EntityManagerFactory emf;
public String getValue() throws NotSupportedException, SystemException {
EntityManager em = emf.createEntityManager();
 EmployeesEntity emp = em.find(EmployeesEntity.class, 207);
        return emp.getLAST_NAME();
}

But still i am getting error, it could be due to JPA2.0 [hibernate] used from JBOSS 7.1 runtime libararies. Below is the error i am getting, am i missing anything

13:34:08,316 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-1) Error Rendering View[/job-applicant.xhtml]: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:95) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.web.deployment.component.WebComponentInstantiator$2.<init>(WebComponentInstantiator.java:96) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.web.deployment.component.WebComponentInstantiator.initializeInstance(WebComponentInstantiator.java:94) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:86) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.web.deployment.jsf.JsfInjectionProvider.invokePostConstruct(JsfInjectionProvider.java:69) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
    at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72) [jbossweb-7.0.10.Final.jar:]
    at org.apache.el.parser.AstValue.getValue(AstValue.java:147) [jbossweb-7.0.10.Final.jar:]
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.0.10.Final.jar:]
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at javax.faces.component.UIOutput.getValue(UIOutput.java:169) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at com.sun.faces.renderkit.html_basic.MenuRenderer.getCurrentSelectedValues(MenuRenderer.java:648) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:122) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:49) [icefaces.jar:]
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_25]
Caused by: javax.persistence.PersistenceException: Hibernate cannot unwrap interface javax.persistence.EntityManagerFactory
    at org.hibernate.ejb.AbstractEntityManagerImpl.unwrap(AbstractEntityManagerImpl.java:1173) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
    at org.jboss.as.jpa.container.AbstractEntityManager.unwrap(AbstractEntityManager.java:68) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.jpa.injectors.PersistenceContextInjectionSource$PersistenceContextJndiInjectable.getReference(PersistenceContextInjectionSource.java:188) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:104) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:106) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]
    ... 54 more
  • 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-04T20:20:19+00:00Added an answer on June 4, 2026 at 8:20 pm

    Instead of

    @PersistenceUnit(unitName="jobApplication")
    private EntityManagerFactory emf;
    
    public String getValue() throws NotSupportedException, SystemException {
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("jobApplication");
            EntityManager em = emf.createEntityManager();
            EmployeesEntity emp = em.find(EmployeesEntity.class, 207);
    
            return emp.getLAST_NAME();
    }
    

    Could you try :

    @PersistenceContext
    private EntityManager em;
    
    public String getValue() throws NotSupportedException, SystemException {
            EmployeesEntity emp = em.find(EmployeesEntity.class, 207);
    
            return emp.getLAST_NAME();
    }
    

    I don’t know if thats helps, but this way the code is much cleaner 🙂

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

Sidebar

Related Questions

Im having a small problem with my code. I have been trying to read
I am trying to code a small test-server for completion ports. But when I
Hi I m trying to execute small code in python , it is giving
Boost Network I am trying out this code in a small console app on
I'm trying to reuse a small chunk of code inside a custom button class.
A very small portion of our codebase is some legacy Java code. I'm trying
Begginer's question. I'm trying to write small piece of code in Visual Studio (VB.net)
I´m trying to code a tooltip (Yes I know, I have my reasons to
I am making a small website as my first project. I have finalized to
I started trying to use sqlite to host small websites and on my own

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.