on 06-14-2004 10:12 AM
HI,
I have deployed a EJB in SAP J2EE Engine EP6.0Sp2. I have a portal component also deployed.when i access the EJB from portal component i get Class Cast Exception.I'm able to perform lookup,but when i try to narrow the object to my HomeClass i get this exception.
<b>MY Portal Component</b>
package com.sap.demo;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.inqmy.services.rmi_p4.P4ObjectBroker;
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.tetrapak.ejb.UserHome;
import com.tetrapak.ejb.UserRemote;
public class MyFirstPortalComponent extends AbstractPortalComponent
{
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
String key = "UserBean";
try
{
Context context = new InitialContext();
Object obj = context.lookup(key);
response.write("After lookup: " + obj + "<br>");
UserHome home =(UserHome) P4ObjectBroker.init().narrow(obj,UserHome.class);
UserRemote hello = home.create();
response.write("Bean message: " + hello.hello());
}
catch(Exception e)
{
response.write("Error :" + e.fillInStackTrace());
}
}
}
Any help is welcome
Hi,
as far as I know, in case the lookup went wrong, the object you get from the lookup is some kind of j2ee engine class object, which then might create a ClassCastException upon narrowing - check the obj.getClass().getName() from your lookup.
Regards,
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
Thanks for ur reply,After the lookup i tried to print the name of the class,it gives com.tetrapak.ejb.UserHomeImpl10.I have even put the client.jar file which i got from visual administrator get client jar for that EJB.will try once again clearing all files and start with new project and test.
BR
Srinivas.p
I had to create a reference from the IRJ to my EJB application. See - https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https://
hi,
try to put your client.jar and your ejb-interfaces in the directorey C:\usr\sap\EP60\j2ee\j2ee_01\cluster\server\services\servlet_jsp\work\jspTemp\irj\root\WEB-INF\lib
in my case, it works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.