CannotInstantiateObjectException in WAS 6 with Local EJB

Discussions

EJB programming & troubleshooting: CannotInstantiateObjectException in WAS 6 with Local EJB

  1. Hi Iam new to EJB2 with Websphere, I got the following error while try to the LOCAL EJB, Please help me to solve this error. com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is com.ibm.ejs.container.ContainerEJBException: Unable to initialize deferred EJB. at com.ibm.ws.runtime.component.EJBContainerImpl.initializeDeferredEJB(EJBContainerImpl.java:4177) at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:341) at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:300) at com.ibm.ejs.container.EJSContainer.getLocalHome(EJSContainer.java:1176) at com.ibm.ejs.container.util.LocalInterfaceHomeObjectFactory.getObjectInstance(LocalInterfaceHomeObjectFactory.java:115) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:314) at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:874) at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:191) Advance Thanks.. ejb-jar.xml ----------- Common RVW EJB RVWEJB com.ramco.ejb.RVWEJBHome com.ramco.ejb.RVWEJBRemote com.ramco.ejb.RVWEJBBean Stateless Container rvw/RVWLocalEJB Session com.ramco.local.ejb.RVWEJBHomeLocal com.ramco.local.ejb.RVWEJBRemoteLocal commonEJB.jar#RVWEJBLocal RVWEJBLocal com.ramco.local.ejb.RVWEJBHomeLocal com.ramco.local.ejb.RVWEJBRemoteLocal com.ramco.local.ejb.RVWEJBBeanLocal Stateless Container client code( JSP) ---------------- InitialContext context = new InitialContext(); out.println("Context created....."); context.lookup("java:comp/env/rvw/RVWLocalEJB"); Pls post your reply as soon as possible, thanks lot......... regards Babu Jayaraman
  2. Hi, In Websphere Application server, if you want to look up an EJB which has local interface, you need to modify the JNDI name of the EJB which has local interface. The JNDI name for local EJB's should begin with local:ejb/. Then you will be able to lookup. I dont know why this kind of behaviour WAS has. Can anyone pls let me know???? Thanks Manjunath Hampanur
  3. can you please send me the ejb-jar.xml and ibm-ejb-jar-bnd.xmi that you are using. I am unable to deploy a session bean for LocalEJB with WAS 6. Your response will be highly appreciated.
  4. In WAS when you look for in an Object with "java: comp / env /" you're saying in the context that these component running for example EJB Component or Web Componente. Additionally, you must add a reference in the web.xml or ejb-jar.xml. For example, you have a servlet called MyServlet that invoke a EJB called MyEJB and the servlet MyServlet going to lookup with local interface MyEJB. You need to do: 1. Add a reference to MyEJB with local interface within web.xml. 2. Lookup MyEJB from MyServlet with "java:comp/env/" 3. The jar file of Client EJB should be in the EAR file. 4. The MANIFEST.MF of WebApplication (WAR file) should have reference to jar file of Client EJB, not like Jar file within web.xml. I don't kwow if this apply to other AppServers but, I think so. If you use "local:ejb" is valid, but It's not elegant, because it's not standard and you use when you don't have reference local in web.xml or ejb-jar.xml I hope that answer your question and sorry for my english I'm trying to improve it.
  5. In WAS when you look for in an Object with "java: comp / env /" you're saying in the context that these component running for example EJB Component or Web Componente. Additionally, you must add a reference in the web.xml or ejb-jar.xml. For example, you have a servlet called MyServlet that invoke a EJB called MyEJB and the servlet MyServlet going to lookup with local interface MyEJB. You need to do: 1. Add a reference to MyEJB with local interface within web.xml. 2. Lookup MyEJB from MyServlet with "java:comp/env/" 3. The jar file of Client EJB should be in the EAR file. 4. The MANIFEST.MF of WebApplication (WAR file) should have reference to jar file of Client EJB, not like Jar file within WEB-INF/lib. I don't kwow if this apply to other AppServers but, I think so. If you use "local:ejb" is valid, but It's not elegant, because it's not standard and you use when you don't have reference local in web.xml or ejb-jar.xml I hope that answer your question and sorry for my english I'm trying to improve it.
  6. In WAS when you look for in an Object with "java: comp / env /" you're saying in the context that these component running for example EJB Component or Web Componente. Additionally, you must add a reference in the web.xml or ejb-jar.xml. For example, you have a servlet called MyServlet that invoke a EJB called MyEJB and the servlet MyServlet going to lookup with local interface MyEJB. You need to do: 1. Add a reference to MyEJB with local interface within web.xml. 2. Lookup MyEJB from MyServlet with "java:comp/env/" 3. The jar file of Client EJB should be in the EAR file. 4. The MANIFEST.MF of WebApplication (WAR file) should have reference to jar file of Client EJB, not like Jar file within WEB-INF/lib. I don't kwow if this apply to other AppServers but, I think so. If you use "local:ejb" is valid, but It's not elegant, because it's not standard, you use when you don't have reference local in web.xml or ejb-jar.xml and only apply to WAS. I hope that answer your question and sorry for my english I'm trying to improve it.