Skip to Content
0
Former Member
Nov 27, 2008 at 03:24 PM

Fetch iview_List from PCD.

18 Views

Hi Folks

kindly help me on below issue.

i am trying to use the below piece of code to fetch the list of iviews from PCD.

the problem is i dont understand the error.

Code in APC:

===========

public class APC_Comp extends AbstractPortalComponent
{
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    {
 
	  try{
	  Hashtable env = new Hashtable();
	  env.put(IPcdContext.SECURITY_PRINCIPAL, request.getUser());
	  env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
//
//	  env.put(com.sap.portal.directory.Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
//		
// 		/******** Since i couldnt find 	PcmConstants.ASPECT_SEMANTICS jar i used the below code.
// 
	  env.put(Constants.REQUESTED_ASPECT,"com.sap.portal.pcd.gl.PersistencyAspect");
	  InitialContext ctx = null;
	  DirContext dirCtx;
	  List roleList = null;
	  ctx = new InitialContext(env);
	  dirCtx = (DirContext) ctx.lookup("pcd:portal_content/");
	  PcdSearchControls pcdSearchControls = new PcdSearchControls();
	  pcdSearchControls.setReturningObjFlag(false);
	  pcdSearchControls.setSearchScope(
	  PcdSearchControls.SUBTREE_WITH_UNIT_ROOTS_SCOPE);
	  dirCtx.addToEnvironment(
	  Constants.APPLY_ASPECT_TO_CONTEXTS,
	  Constants.APPLY_ASPECT_TO_CONTEXTS);
	  NamingEnumeration ne = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.*iview*)",
	  												pcdSearchControls);
 
	  while (ne.hasMoreElements()) {
	  IPcdSearchResult searchResult =
	  (IPcdSearchResult) ne.nextElement();
	  String location = "pcd:portal_content/" + searchResult.getName();
	  roleList.add(location);
	  response.write("Object is "+location);
	  }
 
		
	  }catch(Exception e )
	  {
	  	 response.write("Exception Occured due to :" +e.toString());
	  }
	
	}
 
}

Error Log :
==========
<< item 1 : >>#1.5 #001125A585A0005F000003BD0002514800045CAD115E54F3#1227798297334#com.sap.portal.prt.runtime#sap.com/irj#com.sap.portal.prt.runtime#ramesht#150270##n/a##e592fa70bc8511dd9fdd001125a585a0#SAPEngine_Application_Thread[impl:3]_19##0#0#Error##Java###07:04_27/11/08_0078_79979950 
[EXCEPTION]
{0}#1#java.lang.NoClassDefFoundError: com.sapportals.portal.pcd.gl.PcdSearchControls
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:66)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:127)