cancel
Showing results for 
Search instead for 
Did you mean: 

Navigation - ClassCastException

christiansche
Active Participant
0 Kudos

Hello,

I have an Custom Menu Navigation implemented in our portal. There are lots of helpful Threads here for such a task. But now, my Logfile is Full of ClassCastExceptions. It works as follows:

INavigationNode currentNode = navHelperService.getCurrentNavNode(request);

currentNode = navHelperService.getParentNode(currentNode, request);

So, after I have the current Node, I want to retrieve the parent node. It seems to work, but I also get this ClassCastException:

#1.5#000E7FED022C004A0000018B00005E8C000427C9306796CD#1169644949851#com.sap.portal.roles.RoleNavigation#sap.com/irj#com.sap.portal.roles.RoleNavigation#schebesta_c#16988##obdvee6.burda.com_EE6_666051050#schebesta_c#675dc470abaa11dbc029000e7fed022c#Thread[PRT-Async 0,5,PRT-Async]##0#0#Error##Java###URL does not point to an object of type INavigationConnectorNode: portal_content/com.burda/com.burda.HBM

[EXCEPTION]

#1#java.lang.ClassCastException

at com.sapportals.portal.pcd.pcm.roles.RoleNavigationConnector.getNodes(RoleNavigationConnector.java:282)

at com.sapportals.portal.pcd.pcm.roles.RoleNavigationConnector.getNode(RoleNavigationConnector.java:151)

at com.sapportals.portal.navigation.NavigationConnectorProxy.getNode(NavigationConnectorProxy.java:54)

at com.sapportals.portal.navigation.NavigationService.getNavNode(NavigationService.java:1034)

at com.sapportals.portal.navigation.NavigationService.getNode(NavigationService.java:370)

at com.sapportals.portal.navigation.cache.CachedNavigationService.getNode(CachedNavigationService.java:164)

at com.sapportals.portal.navigation.NavigationEventsHelperService.getParentNode(NavigationEventsHelperService.java:1305)

at burda.com.NavigationKnotenAnzeigenHierarchisch2.doContent(NavigationKnotenAnzeigenHierarchisch2.java:131)

at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)

at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)

at com.sapportals.portal.prt.core.async.AsyncIncludeRunnable$1$DoDispatchRequest.run(AsyncIncludeRunnable.java:377)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.core.async.AsyncIncludeRunnable.run(AsyncIncludeRunnable.java:390)

at com.sapportals.portal.prt.core.async.ThreadContextRunnable.run(ThreadContextRunnable.java:164)

at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:729)

at java.lang.Thread.run(Thread.java:534)

By currentNode.getClass().toString() I tried to find out, what Class it consists. The result was:

class com.sapportals.portal.navigation.cache.CacheNavigationNode

So, after I defined currentNode as INavigationNode why is it now CacheNavigationNode? And if I have to use this in my code, does anybody know, in what file I can find it?

I'm on NW04 SPS 19.

Hope anybody out there has any suggestion. Thanks for help,

best regards,

Christian

Accepted Solutions (0)

Answers (3)

Answers (3)

christiansche
Active Participant
0 Kudos

Hello Martin,

Yes, NWDS is also SPS19

But thats been a helpful suggestion, because I downloaded com.sap.portal.navigation.helperservice_api.jar and com.sap.portal.navigation.api_service_api.jar from the portal, when ist was SPS 15. I now downloaded and replaced the the jars by the current SPS 19 jars from the portal server. I recompiled and uploaded the component, but I still get the same error.

Do you have any further hint, what the problem could be?

Best regards,

Christian

christiansche
Active Participant
0 Kudos

Hello Martin,

thank you for this help.

We are with Wetweaver, Portal, KM and TREX on SPS19.

Best Regards,

Christian

Former Member
0 Kudos

Hi Christian,

well, I should have asked more specifically. I assume you developed your portal component with the SAP NetWeaver Developer Studio (NWDS). What version is your NWDS.

I suspect that you compiled your portal component against a local version of class INavigationNode. During runtime the server uses a different version of the INavigationNode interface. Could you try to compile your code against the server classes and try to reproduce the error once more?

Best regards,

Martin

Former Member
0 Kudos

Hi Christian,

You will find the file CacheNavigationNode.class on your portal server's file system in the jar file com.sap.portal.navigation.serivce_core.jar in directory

\usr\sap\<J2E>\<JC00>\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.navigation.service\private\lib

CacheNavigationNode is a class that implements the interface com.sapportals.portal.navigation.cache.ICacheNavigationNode. The interface (com.sapportals.portal.navigation.cache.ICacheNavigationNode) extends another interface com.sapportals.portal.navigation.INavigationNode.

That means when you receive a object of type CacheNavigationNode that object has also implemented the expected interface INavigationNode. So that's alright.

The ClassCastException is a very strange thing indeed. The error message mentions a URL that's supposed to point to an object of type INavigationConnectorNode (deprecated as of SP17) but does not.

What portal version are you using?

Best regards,

Martin