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
-
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?
thanksdupocate of : problem referencing EJB 3.0 ( injection)
Maybe you are looking for
-
Can it not possible that i can retrive it for all line items in a single qu
I have to make report for my application in which I am facing a following problem: In the application there are multiple suppliers and each supplier having multiple line items and each item having multipale events. each evant having three status GREE
-
The time actually ran up to 27hours remaining before I force quit it (it was installing for at least an hour already) I have tried this on iMacs running various versions of OSX including Maverick and Yosemite and they both have this issue. This is CC
-
Transaction code for product master - SNP
What is the significance of CFM2 transaction and EXIT_SAPLCMAT_001 user exit.
-
I can't download the new Pages since my computer doesn't have OS X 10.9. How can I get around the problem? Or is there anything to do about the problem that my Open Office has flipped and says that there are pages that needs to be re-opened, but I ca
-
More Major Issues with ZFS + Dedup
I'm having more problems - this time, very, very serious ones, with ZFS and deduplication. Deduplication is basically making my iSCSI targets completely inaccessible to the clients trying to access them over COMSTAR. I have two commands right now tha