cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCastException in retrieving UWL Items

Former Member
0 Kudos

Hi Experts,

I am getting a ClassCastException in the very first line of the code mentioned below

IUWLService uwlService =(IUWLService) WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY);

when I am trying to get the UWL Service in a web dynpro DC maintained on NWDI track. I have created an external Library DC to put the following jars-

bc.uwl.service.api_api.jar

com.sap.security.api.jar

com.sap.security.api.perm.jar

prtapi.jar

And, have also created J2EE Library to deploy the jars in the External Library by adding dependency using public parts and used the Def public part of this J2EE Library in my target application. Apart from adding in the used DC I have put the following entries in the Web Dynpro References>Library References as well:

tckmcbc.uwl~api

bhi.com~bhmdm_uwl_j2eelib (where bhmdm_uwl_j2eelib is the J2EE Library and bhi.com is the vendor name)

The same set of code works all fine when I follow the same approach for Local Development Component (not on track).

Can you suggest me the possible reasons for it?

I am not sure if I have missed any jars as in compile time as well as in runtime it is working for Local DCs (not on track)

Regards,

Tushar S

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Nothing is missing, you have all the jar files, as per the error Object Typecasting getting problem at the line

IUWLService uwlService =(IUWLService) WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY);

please check the return type of the below line ( open the WDPortalUtils class and check the return type of getServiceReference(XX) method )

WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY);

And then Typecast with super class

Thanks,

Sreeni.

Former Member
0 Kudos

Hi Sreeni,

The return type is com.sap.netweaver.bc.uwl.core.portal.UWLPortalService. But, I am unable to figure out the jar for it.

Regards,

Tushar S

Answers (1)

Answers (1)

asif_hirani
Active Participant
0 Kudos

Hi Tushar,

1) Add Used DCs tc/kmc/bc.uwl/api added from sap.com_UWLJWF SC. Dependency can be Build Time.

2) in web Dynpro projects Library refrences ensure that you have

a) tckmcbc.uwl~api

b) entry for your external library DC something like tc/wd/libraryproject

try adding additional libraries in your library dc

1) bc.rf.framework_api.jar

2) bc.util.public_api.jar

Regards !

Former Member
0 Kudos

Thanks Asif!

I'll try that and get back to you.

Regards,

Tushar S

Former Member
0 Kudos

Hi Asif,

I am unable to add dependency as it gives an error in Used DCs saying "Illegal dependency: Access list does not allow use of...."

1) Add Used DCs tc/kmc/bc.uwl/api added from sap.com_UWLJWF SC. Dependency can be Build Time.

Regards,

Tushar S

Former Member
0 Kudos

Hi Tushar,

could you solved this issue

Regards.