on 05-02-2007 2:09 AM
Hello experts,
I have written a SessionBean with Home and Remote Interfaces that has a method UpdateKbUpdateInfo() which uses
CMP Entity beans to do the database transactions.
I call the UpdateKbUpdateInfo() method of the session bean like the following
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
out = new PrintWriter(response.getWriter());
try {
javax.naming.Context context = new javax.naming.InitialContext();
Object obj = context.lookup("applications/knet");
UserInfoHome userInfoHome = (UserInfoHome) javax.rmi.PortableRemoteObject.narrow(obj,UserInfoHome.class);
UserInfo userInfo = userInfoHome.create();
String msg = userInfo.UpdateKbUpdateInfo("1234","test","test",12345678);
out.println(" the message is : " + msg);
} catch (ClassCastException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
It works fine - no problem.
In the same par file I have created a repository service. The following is the defination of the service
public class ReportingService
extends AbstractRepositoryService
implements IReconfigurable, IResourceEventReceiver {
}
In the received() method of the service I use the follwing code to call the ejb. It is similar to the above code.
public void received(IEvent event) {
ResourceEvent resEvent = (ResourceEvent) event;
IResource aResource = resEvent.getResource();
String room_id = .......................
String resourceName = .....................
String eventtype = ................
long timestamp = .....................
try {
javax.naming.Context context = new javax.naming.InitialContext();
Object obj = context.lookup("applications/knet");
UserInfoHome userInfoHome = (UserInfoHome) javax.rmi.PortableRemoteObject.narrow(obj,UserInfoHome.class);
UserInfo userInfo = userInfoHome.create();
userInfo.UpdateKbUpdateInfo(roomid,resourceName,eventType,timestamp);
} catch (ClassCastException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else
log.LogAction(" Rerource null " ,Logger.LEVEL_ERROR);
}
catch (ResourceException re) {
log.LogAction("Exception in archieving --" + re.getMessage(),Logger.LEVEL_ERROR);
}
}
But I get the following error. Similar code works from Portal Component but does not work form a repository service.
#1.5#000E7FED310600560000007E000025DD00042F720590D1D2#1178066672991#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###java.lang.ClassCastException: com.watercorp.knet.ejbs.UserInfoHome#
#1.5#000E7FED310600560000007F000025DD00042F720590F36D#1178066673000#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:179)#
#1.5#000E7FED3106005600000080000025DD00042F720590F53C#1178066673000#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.sap.engine.system.PortableRemoteObjectProxy.narrow(PortableRemoteObjectProxy.java:24)#
#1.5#000E7FED3106005600000081000025DD00042F720590F6A6#1178066673001#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)#
#1.5#000E7FED3106005600000082000025DD00042F720590F835#1178066673001#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.watercorp.knet.ReportingService.received(ReportingService.java:172)#
#1.5#000E7FED3106005600000083000025DD00042F720590F959#1178066673001#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.sapportals.wcm.util.events.ReceiverEntry.doSend(ReceiverEntry.java:223)#
#1.5#000E7FED3106005600000084000025DD00042F720590FA9D#1178066673002#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.sapportals.wcm.util.events.EventBroker.send(EventBroker.java:86)#
#1.5#000E7FED3106005600000085000025DD00042F720590FBC8#1178066673002#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.sapportals.wcm.util.events.TransactionalEventBroker.send(TransactionalEventBroker.java:56)#
#1.5#000E7FED3106005600000086000025DD00042F720590FCDC#1178066673002#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.sapportals.wcm.repository.manager.ResourceEventBroker.send(ResourceEventBroker.java:219)#
#1.5#000E7FED3106005600000087000025DD00042F720590FE15#1178066673003#System.err#sap.com/irj#System.err#AHMEDS0#147#####SAPEngine_Application_Thread[impl:3]_6##0#0#Error##Plain###at com.sapportals.wcm.repository.manager.AbstractRepositoryManager.sendEvent(AbstractRepositoryManager.java:322)#
Please Help
Sabbir
Hi,
plz check whether ru bean is in project's build path
Regards,
Beevin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
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.