S
sid_mulpuru
Hi,
I would greatly appreciate your help since i am stuck with this error
for more than a week now ..
I have been trying to access the remote home interface of a session
bean from a java class belonging to a different
web Application.
This is the code segment :
private static EJBHome lookupTargetHome(String jndiName, Class
homeClass,String factoryName) throws NamingException {
java.util.Properties properties = new java.util.Properties();
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
factoryName);
javax.naming.InitialContext initialContext =
getInitialContext(properties);
java.lang.Object obj = initialContext.lookup(jndiName);
EJBHome home = (EJBHome) javax.rmi.PortableRemoteObject.narrow(obj,
homeClass);
return home;
}
I have two Web Applications and the EJB packaged into a single EAR.
I am running this on WSAD 5.1 test server.
This is the exception i am getting:
java.lang.ClassCastException: cannot cast class
com.ibm.ejs.container._EJSWrapper_Stub to interface
com.mayco.ldap.ejbs.LdapEjbsHome
at
com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:366)
at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:146)
at
com.mayco.ldap.EJBLdapHelper.lookupTargetHome(EJBLdapHelper.java:104)
at com.mayco.ldap.EJBLdapHelper.getTargetHome(EJBLdapHelper.java:81)
at com.mayco.ldap.MayLdapServlet.getLdapEJB(MayLdapServlet.java:374)
at
com.mayco.ldap.MayLdapServlet.checkUserBean(MayLdapServlet.java:201)
at
com.mayco.ldap.MayLdapServlet.processRequest(MayLdapServlet.java:448)
at com.mayco.ldap.MayLdapServlet.service(MayLdapServlet.java:497)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at org.apache.jsp._index._jspService(_index.java:144)
at
com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:357)
at
com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet..java:675)
at
com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:773)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection..java:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Both the webapps have the ejb checked in their MANIFEST.MF file..
This is the EJB deployment descriptor:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
<display-name>Mayco_LdapEJBV5</display-name>
<enterprise-beans>
<session id="Session_1107557246140">
<ejb-name>LdapEjbsBean</ejb-name>
<home>com.test.ldap.ejbs.LdapEjbsHome</home>
<remote>com.test.ldap.ejbs.LdapEjbs</remote>
<ejb-class>com.test.ldap.ejbs.LdapEjbsBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
Please let me know your thoughts on the excpetion and what needs to be
done so i can access the Session EJB's in wsad.
Thanks for your help
Sid
I would greatly appreciate your help since i am stuck with this error
for more than a week now ..
I have been trying to access the remote home interface of a session
bean from a java class belonging to a different
web Application.
This is the code segment :
private static EJBHome lookupTargetHome(String jndiName, Class
homeClass,String factoryName) throws NamingException {
java.util.Properties properties = new java.util.Properties();
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
factoryName);
javax.naming.InitialContext initialContext =
getInitialContext(properties);
java.lang.Object obj = initialContext.lookup(jndiName);
EJBHome home = (EJBHome) javax.rmi.PortableRemoteObject.narrow(obj,
homeClass);
return home;
}
I have two Web Applications and the EJB packaged into a single EAR.
I am running this on WSAD 5.1 test server.
This is the exception i am getting:
java.lang.ClassCastException: cannot cast class
com.ibm.ejs.container._EJSWrapper_Stub to interface
com.mayco.ldap.ejbs.LdapEjbsHome
at
com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:366)
at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:146)
at
com.mayco.ldap.EJBLdapHelper.lookupTargetHome(EJBLdapHelper.java:104)
at com.mayco.ldap.EJBLdapHelper.getTargetHome(EJBLdapHelper.java:81)
at com.mayco.ldap.MayLdapServlet.getLdapEJB(MayLdapServlet.java:374)
at
com.mayco.ldap.MayLdapServlet.checkUserBean(MayLdapServlet.java:201)
at
com.mayco.ldap.MayLdapServlet.processRequest(MayLdapServlet.java:448)
at com.mayco.ldap.MayLdapServlet.service(MayLdapServlet.java:497)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at org.apache.jsp._index._jspService(_index.java:144)
at
com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:357)
at
com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet..java:675)
at
com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:773)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection..java:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Both the webapps have the ejb checked in their MANIFEST.MF file..
This is the EJB deployment descriptor:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
<display-name>Mayco_LdapEJBV5</display-name>
<enterprise-beans>
<session id="Session_1107557246140">
<ejb-name>LdapEjbsBean</ejb-name>
<home>com.test.ldap.ejbs.LdapEjbsHome</home>
<remote>com.test.ldap.ejbs.LdapEjbs</remote>
<ejb-class>com.test.ldap.ejbs.LdapEjbsBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
Please let me know your thoughts on the excpetion and what needs to be
done so i can access the Session EJB's in wsad.
Thanks for your help
Sid