cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCastException while accessing PCD objects

ankur_garg5
Active Contributor
0 Kudos

Hi,

I am trying to access iViews and System objects from the Portal PCD using the code given in the following wiki link:

http://wiki.sdn.sap.com/wiki/display/WDJava/Retrieving+all+iViews+from+PCD

I am getting ClassCastException on the following line of code:

IPcdSearchResult searchResult = (IPcdSearchResult) ne.nextElement();

The complete exception is:

java.lang.ClassCastException: class com.sapportals.portal.pcd.gl.PcdGlSearchResult:service:com.sap.tc.pcd.gl.srv@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@1e071f47@alive incompatible with interface com.sapportals.portal.pcd.gl.IPcdSearchResult:sap.com/home~mdm_framework@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@6dcec96a@alive

I am doing this in NW7.3 Portal. This very code works fine in NW7.0. Please help me to resolve this error.

Thanks & Regards,

Ankur Garg

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ankur,

Have you tried this:

 

list = initialContext.list(root);

NameClassPair nameClass;

while(list.hasMore()) {

 

nameClass = (NameClassPair) list.next();

if(nameClass

.getClassName()

.equals("com.sapportals.portal.ivs.iviews.IPortalIview"))

{ //do something }

if(nameClass

.getClassName()

.equals("com.sapportals.iviewserver.systemlandscape.service.ISystemObject"))

{ //do something }

}

Former Member
0 Kudos

Hi Ankur,

So it looks like the API has changed from 7.0 to 7.3... can you instead cast to the actual correct type (e.g. PcdGISearchResult)... the code here shows how to do this:

https://cw.sdn.sap.com/cw/sources/1199?view=file-source&path=trunk%2Fcom.sap.MobileServices%2Fsrc.co...

I can't find any public Javadocs for PcdGlSearchResult I'm afraid.

Hope this helps,
Simon