cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCastException when accessing EJB using JNDI in WebDynpro

Former Member
0 Kudos

Hi Experts,

I got a ClassCastException when accessing EJB using JNDI in WebDynpro application. Here is the scenario:

1) Create an EJB DC.

2) Create an EAR DC to deploy the EJB DC.

3) Create a Java DC to provide access to the methods in EJB DC.

4) Create a Java library DC to deploy the Java DC.

5) Create WebDynpro DC application that uses the Java DC.

In Java DC, I have added reference to EAR via Used DCs.

In WebDynpro, I have added the library reference to the java library DC and share reference to the EAR DC.

When I deploy the WebDynpro DC, I got "ClassCastException" after looking up the service.

If I look up the service locally, I got ClassCastExceptoin when I try to cast from MyServiceLocalHomeImpl0_0 to MyServiceLocalHome.

If I look up the service remotely, I got ClassCastException when I try to narrow the remote object from MyServiceHome_Stub to MyServiceHome.

Note that I can successfully access the EJB from a standalone java application using JNDI.

Could anyone outthere have solution for this problem? Your help is very much appeciated!

Regards,

Van

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Van,

Use Java DC directly in ur Web dynpro application instead of adding it to J2EE library component.

Here are the steps:

1.create 2 public parts(api and sda) for ur java classes.

2.define both public parts as Used DC for your web Dynpro DC.

3.remove the reference to ur J2EE libary component as it not required.

hope this helps

With Regards

Balaram Naidu

Former Member
0 Kudos

Thanks very much Balaram Naidu for your answer. The problem is solved!

Regards,

Van

Answers (0)