jsf - @EJB(lookup) fails with org.omg.CosNaming.NamingContextPackage.NotFound -
i deployed application on websphere 8.5 , gave following exception:
[10/6/13 22:30:18:323 pdt] 000000be injectionbind e cwnen0030e: @ejb factory encountered problem getting object instance com.chander.test.web.managebean.registration/staticdataservice binding object. exception message was: context: chander-4ae021bnode01cell/nodes/chander-4ae021bnode01/servers/server1, name: com.chander.test.service.api.staticdataservice: first component in name com.chander.test.service.api.staticdataservice not found. [10/6/13 22:30:18:417 pdt] 000000be annotation e com.ibm.ws.webcontainer.annotation.wasannotationhelper inject srve8060e: unexpected exception occurred during resource injection. com.ibm.wsspi.injectionengine.injectionexception: unable obtain instance com.chander.test.web.managebean.registration/staticdataservice: javax.naming.namenotfoundexception: context: chander-4ae021bnode01cell/nodes/chander-4ae021bnode01/servers/server1, name: com.chander.test.service.api.staticdataservice: first component in name com.chander.test.service.api.staticdataservice not found. [root exception org.omg.cosnaming.namingcontextpackage.notfound: idl:omg.org/cosnaming/namingcontext/notfound:1.0] @ com.ibm.wsspi.injectionengine.injectionbinding.getinjectionobject(injectionbinding.java:1123) @ com.ibm.ws.ejb.injection.processor.ejbinjectionbinding.getinjectionobject(ejbinjectionbinding.java:1101)
following registration class:
@suppresswarnings("serial") @managedbean(name = "registration") @sessionscoped public class registration implements serializable { private static final logger log = loggerfactory.getlogger(registration.class); private userregistrationform form = new userregistrationform(); @ejb(lookup = "com.chander.test.service.api.staticdataservice") private staticdataservice staticdataservice; public staticdataservice getstaticdataservice() { return staticdataservice; } public userregistrationform getform() { return form; } public void setform(userregistrationform form) { this.form = form; } // navigation public string tofirstpage() { log.info("registration first page"); return "registration_first_page"; } public string tosecondpage() { log.info("registration second page"); return "registration_second_page"; } }
persistence.xml
<?xml version="1.0" encoding="utf-8"?> <persistence 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" version="2.0"> <persistence-unit name="chander.test" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <jta-data-source>oracle/chander_datasource</jta-data-source> <class>com.chander.test.dao.model.userprofile</class> <class>com.chander.test.dao.model.creditcard</class> <class>com.chander.test.dao.model.address</class> <class>com.chander.test.dao.model.country</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.oracle10gdialect" /> <property name="hibernate.hbm2ddl.auto" value="none" /> <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.cmttransactionfactory" /> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.websphereextendedjtatransactionlookup" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="false" /> <property name="hibernate.use_sql_comments" value="false"/> </properties> </persistence-unit> </persistence>
i guess com.chander.test.service.api.staticdataservice
name of ejb class or interface. lookup
parameter of @ejb
annotation takes jndi path.
i not know how websphere 8 places ejbs in jndi context, sure correct? have tried leaving out lookup
, i.e.:
@ejb private staticdataservice staticdataservice;
Comments
Post a Comment