WarningInvalidEJBReference

Using JDev 10.1.3.2 - Have the following code in MasterBean.java (Stateless Session):
@Stateless(name = "Master")
public class MasterBean implements Master, MasterLocal {
@EJB(beanName = "DeptInfo")
DeptInfo di;
am getting the following message when attempt to run (deploy to embedded server) the DeptInfoBean.java (Stateless Session)
Oct 10, 2007 11:51:08 AM oracle.j2ee.jndi.JndiMessages warningInvalidEJBReference
WARNING: EJB Reference "project2.MasterBean/di" could not be resolved. Allowing J2EEContext creation to continue anyway
Also have an Entity DeptBean.java based on the Dept table in my database. Session beans have local & remote interfaces.
In MasterBean.java have following method:
public void newDept(int deptno, String dname, String loc) {
di.createNewDept(deptno, dname, loc);
When created this method entered di. and was prompted with the proper method name: di.createNewDept(deptno, dname, loc);
So I know I can see the DeptInfo.java bean from the MasterBean.java.
What is the issue and how do I fix it?
Thanks - Casey

You have to use: new InitialContext().lookup("...")

Similar Messages

  • Deploying EJB in J Developer

    hai,
    am using Jdeveloper version 10.1.3.2
    i created a JSF page and passed a Dataobject to the java file CreateTaskClient.java
    I created a session bean and there are two xml files that the Ide generated ejb-jar.xml and orion-ejb-jar.xml.
    am pasting the data i entered in these xml files
    ejb-jar.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee">
    <enterprise-beans>
    <session>
    <description>Session Bean ( Stateless )</description>
    <display-name>SessionEJB</display-name>
    <ejb-name>SessionEJB</ejb-name>
    <home>projsamp.backing.SessionEJBHome</home>
    <remote>projsamp.backing.SessionEJB</remote>
    <local-home>projsamp.backing.SessionEJBLocalHome</local-home>
    <local>projsamp.backing.SessionEJBLocal</local>
    <ejb-class>projsamp.backing.SessionEJBBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>SessionEJB</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    and in the orion-ejb-jar.xml file i put
    <orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd"
    schema-major-version="10" schema-minor-version="0">
    <enterprise-beans>
    <session-deployment name="SessionEJB" location="ejb/createtask"/>
    </enterprise-beans>
    </orion-ejb-jar>
    and from the CreateTaskClient.java I lookup for the ejb.The code is
    public class CreateTaskClient {
    public SessionEJBLocalHome createClientMethod() {
    SessionEJBLocalHome sessionEJBLocalHome = null;
    System.out.println("entering the createClienMethod of SessionLocalHome");
    try {
    Context ic;
    ic = new InitialContext();
    System.out.println("entering the createClienMethod of SessionLocalHome1");
    Object obj=ic.lookup("java:comp/env/ejb/createtask");
    sessionEJBLocalHome =
    (SessionEJBLocalHome)PortableRemoteObject.narrow(obj,SessionEJBLocalHome.class);
    System.out.println("entering the createClienMethod of SessionLocalHome" +
    "obtaining the context of the bean");
    } catch (NamingException ne) {
    ne.printStackTrace();
    System.out.println("naming exception handled");
    return sessionEJBLocalHome;
    on running the code i get the following error
    Checking that EJBs were successfully deployed in embedded OC4J...
    **** Warning: The EJB SessionEJB was not found via an InitialContext lookup. Error encountered: SessionEJB not found.
    **** Warning: Not all EJBs were successfully deployed. The EJB application may fail during testing.
    **** Please use the EJB Verifier to check your EJB modules for errors by right-clicking on ejb-jar.xml and choosing 'Verify Enterprise Beans'
    Mar 20, 2007 10:42:08 AM oracle.j2ee.jndi.JndiMessages warningInvalidEJBReference
    WARNING: EJB Reference "ejb/createtask" could not be resolved. Allowing J2EEContext creation to continue anyway
    07/03/20 10:42:08 javax.naming.NameNotFoundException: java:comp/env/ejb/createtask not found in JSFApp-ProjSamp-webapp
    Should any other files be configured or is there any error the way i configured the file[b]

    Hi Shay:
    I saw this tutorial in a viewlet before, but te problem is, that the code generated by the wizard in my case, it's a little diferent:
    public static void main(String [] args) {
    try {
    final Context context = getInitialContext();
    final EstacionTrabajoModuleHome estacionTrabajoModuleHome =
    (EstacionTrabajoModuleHome) PortableRemoteObject.narrow( context.lookup( "EstacionTrabajoModuleBean" ), EstacionTrabajoModuleHome.class );
    RemoteEstacionTrabajoModule remoteEstacionTrabajoModule;
    // remoteEstacionTrabajoModule = estacionTrabajoModuleHome.create( env );
    // Call any of the Remote methods below to access the EJB
    // remoteEstacionTrabajoModule.removeEntity( entityDTO );
    // remoteEstacionTrabajoModule._getDetallesPagosXInstXCorte( serie, identificador, inpaCveInstrumento, estatusActivo );
    // remoteEstacionTrabajoModule._getParametrosGenerales( claves );
    // remoteEstacionTrabajoModule._getListaValores( dominios );
    System.out.println( remoteEstacionTrabajoModule._getTiposFormas( ) );
    The line with bold style is generated with comments, and is the initialization that let me use the module, but when I remove the comments, I don't know how to initialize de env variable to use this client with the ejb in the embedded oc4j.
    thnks in advance.
    Alex.

  • Referencing EJB 3.0 ,problem

    Hello I have 2 session EJB 3.0 and I would reference one on body of another , but
    I have an error form embedded OC4J when I run DEBUG .
    Here is my simply code
    TransactionController ---
    package com.savino.banking.model.facade;
    import com.savino.banking.model.entity.Transaction;
    import com.savino.banking.model.entity.TransactionItem;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name="TransactionController")
    public class TransactionControllerBean implements TransactionController,
    TransactionControllerLocal {
    @PersistenceContext(unitName="Model")
    private EntityManager em;
    public TransactionControllerBean() {
    public Object mergeEntity(Object entity) {
    return em.merge(entity);
    public Object persistEntity(Object entity) {
    em.persist(entity);
    return entity;
    and I declare a reference to TransactionController into AdminController :
    package com.savino.banking.model.facade;
    import com.savino.banking.common.exception.BusinessException;
    import com.savino.banking.model.entity.Cc;
    import com.savino.banking.model.entity.CostCenter;
    import com.savino.banking.model.entity.TypeTransaction;
    import com.savino.banking.model.entity.UserCcLinks;
    import com.savino.banking.model.entity.UserCcLinksPK;
    import com.savino.banking.model.entity.Users;
    import java.util.List;
    import javax.ejb.EJB;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name="AdminController")
    public class AdminControllerBean implements AdminController,
    AdminControllerLocal {
    @PersistenceContext(unitName="Model")
    private EntityManager em;
    @EJB(name="myController",beanInterface=TransactionControllerLocal.class,beanName="TransactionControllerLocal")
    TransactionControllerLocal controller;
    public AdminControllerBean() {
    And this is the error that I caught :
    25-giu-2008 20.03.46 oracle.j2ee.jndi.JndiMessages warningInvalidEJBReference
    AVVERTENZA: Impossibile risolvere il riferimento EJB "myController". La creazione di J2EEContext può tuttavia continuare.
    25-giu-2008 20.03.46 oracle.j2ee.jndi.JndiMessages warningInvalidEJBReference
    AVVERTENZA: Impossibile risolvere il riferimento EJB "myController". La creazione di J2EEContext può tuttavia continuare.
    25-giu-2008 20.03.53 oracle.wireless.its.ra.TelnetResourceAdapter run
    INFO: Avvio di Industrial Telnet Server versione: Version 10.1.3.0.0 completato.
    I am on JDev 10g 10.1.3.1, can anyone help me?
    thanks

    dupocate of : problem referencing EJB 3.0 ( injection)

Maybe you are looking for