on 05-19-2006 8:01 PM
Alright.. I am about to throw my laptop out of the window.. So before I do that I thought I would post my issue here.
Basically, I am trying to get some properties of an iView. Should be pretty basic.. Here is a code snipet..
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL,request.getUser());
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sapportals.portal.pcd.gl.PcdInitialContextFactory");
env.put("com.sap.portal.jndi.requested_aspect","com.sap.portal.pcd.gl.PersistencyAspect");
InitialContext iCtx = null;
iCtx = new InitialContext(env);
IiView result =(IiView)iCtx.lookup("portal_content/Folder/iView");
What ALWAYS happens is that I get a NULLPOINTEREXCEPTION at the 'IiView result=IiView result =(IiView)iCtx.lookup("portal_content/Folder/iView");' line..
Any ideas.. is it something to do with my content configuration??
Hi Craig,
Look in to this technical article.This will solve your problem.
I think you have not updated your portalapp.xml.
Let me know if you need more info.
Regards,
Karthick Eswaran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Craig,
I am not sure for which purpose you need this, but looks promising for me. I have just tested it quickly. This might only regard to master iViews.
IPortalComponentProfile otherProfile = request.getComponentContext("com.sweetlets.pct.test.Profile").getProfile();
Use the PAR file name together with the component name as the urn string. Such as "com.sweetlets.pct.test" + "." + "Profile". Use PortalAnywhere.Go to see all available master iViews.
I hope that helps.
Well. I solved it.. Not really sure how.. But when I put the code into its own Try-Catch.. It magically worked..
String id = "pcd:portal_content/Folder/iView";
InitialContext iCtx = null;
try {
iCtx = new InitialContext(env);
IiView result = (IiView) iCtx.lookup(id);
response.write(result.getAttribute("com.sap.portal.pcm.Title",request.getLocale()));
} catch (Exception e) {
response.write(e.getMessage());
}
Hmm..
Hi Craig,
Try adding pcd: while doing the context lookup
pcd:portal_content/Folder/iView
Regards,
Piyush
ps: please mark useful answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.