Hi,
I am working on a portal application that personalize's iView property via APIs. The code snippet I am using is as follows:
import java.util.Hashtable; import com.sap.portal.directory.Constants; import com.sap.portal.pcm.admin.IAdminBase; import com.sap.portal.pcm.admin.IAttributeSet; import com.sap.portal.pcm.admin.PcmConstants; import com.sapportals.portal.pcd.gl.IPcdContext; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY); env.put(Context.SECURITY_PRINCIPAL, user); env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_ADMINISTRATION); IPcdContext pcdContext = (IPcdContext) new com.sapportals.portal.prt.jndisupport.InitialContext(env).lookup(""); IAdminBase adminBase = (IAdminBase)pcdContext.lookup(path_to_iView); IAttributeSet attrSet = (IAttributeSet)adminBase.getImplementation(IAdminBase.ATTRIBUTE_SET); attrSet.putAttribute("com.sap.portal.pcm.Title", Locale.ENGLISH ,title); attrSet.save();
I have added the following JARs specific to the above code:
com.sap.portal.pcm.admin.apiservice_api.jar
gl_api.jar
prtjndisupport.jar
tc~epbc~pcm~adminapi~java.jar
In SharingReference of portalapp.xml I have added the entries com.sap.portal.pcd.glservice, com.sap.portal.pcm.admin.apiservice, com.sap.portal.ivs.connectorservice, com.sap.portal.navigation.api_service
At runtime when I execute the application I get the following exception:
java.lang.ClassCastException: class com.sapportals.portal.pcd.gl.PcdGlContext:com.sapportals.portal.prt.util.ApplicationClassLoader@44d2247a@com.sapportals.portal.prt.util.ApplicationClassLoader@44d2247a(D:\usr\sap\TT1\JC01\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.pcd.glservice\private\lib\com.sap.portal.pcd.glservice_core.jar;D:\usr\sap\TT1\JC01\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.pcd.glservice\private\lib\concurrency.jar;D:\usr\sap\TT1\JC01\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.pcd.glservice\private\lib\gl_core.jar;) incompatible with interface com.sap.portal.pcm.admin.IAdminBase:com.sap.engine.core.service630.container.ComponentClassLoader@52fe21c2@library:tc~epbc~pcm~adminapi~java
This occurs at line 12 in the code above.
Any help would be highly appreciated.
Regards,
Melwyn