为什么我的托管bean查找失败?

时间:2018-08-28 22:02:57

标签: ejb cdi jndi

考虑以下代码:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://xmlns.jcp.org/jsf/html"
  xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
    <title>Crear Personas</title>
</h:head>
<h:body>
    <f:view>


        <h:form>
            <h1><h:outputText value="Create/Edit"/></h1>
            <h:panelGrid columns="2">
                <h:outputLabel value="Perid:" for="perid" />
                <h:inputText id="perid" value="#{lineaControl.persona.perid}" title="Perid" required="true" requiredMessage="The Perid field is required."/>
                <h:outputLabel value="Pernombre:" for="pernombre" />
                <h:inputText id="pernombre" value="#{lineaControl.persona.pernombre}" title="Pernombre" required="true" requiredMessage="The Pernombre field is required."/>
                <h:outputLabel value="Perapellido:" for="perapellido" />
                <h:inputText id="perapellido" value="#{lineaControl.persona.perapellido}" title="Perapellido" required="true" requiredMessage="The Perapellido field is required."/>
                <h:outputLabel value="Pertelefonofijo:" for="pertelefonofijo" />
                <h:inputText id="pertelefonofijo" value="#{lineaControl.persona.pertelefonofijo}" title="Pertelefonofijo" required="true" requiredMessage="The Pertelefonofijo field is required."/>
                <h:outputLabel value="Perfechanacimiento:" for="perfechanacimiento" />
                <h:inputText id="perfechanacimiento" value="#{lineaControl.persona.perfechanacimiento}" title="Perfechanacimiento" required="true" requiredMessage="The Perfechanacimiento field is required.">
                    <f:convertDateTime pattern="MM/dd/yyyy" />
                </h:inputText>
                <h:outputLabel value="Percedula:" for="percedula" />
                <h:inputText id="percedula" value="#{lineaControl.persona.percedula}" title="Percedula" required="true" requiredMessage="The Percedula field is required."/>
            </h:panelGrid>
             <h:commandButton value="Crear" action="#{personaControl.crearPersona()}" ></h:commandButton>
        </h:form>
    </f:view>


</h:body>
</html>

这是视图:

@Named(value = "personaControl")
@SessionScoped
public class PersonaControl implements Serializable {

/**
 * Creates a new instance of PersonaControl
 */
public PersonaControl() {

    persona = new Persona();
}
@EJB

private Persona persona;

PersonaFacade personaFacade;

public Persona getPersona() {
    return persona;
}

public void setPersona(Persona persona) {
    this.persona = persona;
}



public List<Persona> listarPersonas(){

    return personaFacade.findAll();
}

public void crearPersona(){

    personaFacade.create(persona);
    persona = new Persona();
}

public void eliminarPersona(Persona newPersona){

    persona = newPersona;
    personaFacade.remove(persona);
    persona = new Persona();

}

public String editarPersona(Persona newPersona){

    persona = newPersona;
    return "/Equipo/Editar";
}

public String editarPersona(){
    personaFacade.edit(persona);
    persona = new Persona();
    return "/Equipo/Editar";
}
}

这是控制器:

实体和外观是使用NetBeans IDE生成的,因此当我尝试创建新用户时,会收到以下错误输出:

  

试图注入远程ejb-ref name = controlador.PersonaControl / persona,Remote 3.x interface = entidades.Persona,ejb-link = null,lookup =,mappedName =,jndi-name = entidades.Persona,refType的异常=进入类controlador.PersonaControl的会话:在SerialContext [myEnv = {java.naming.factory.initial = com.sun.enterprise.naming.impl.SerialInitContextFactory,'中的'java:comp / env / controlador.PersonaControl / persona'查找失败, java.naming.factory.state = com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,java.naming.factory.url.pkgs = com.sun.enterprise.naming}

我不明白为什么得到此错误输出。我无法创建任何用户。

0 个答案:

没有答案
相关问题