Skip to Content
author's profile photo Former Member
Former Member

nullpointer exception while reading properties from km content

//java file

package TestKMApi;





import com.sapportals.portal.prt.component.IPortalComponentRequest;


import com.sapportals.wcm.repository.IProperty;

import com.sapportals.wcm.repository.IPropertyName;

import com.sapportals.wcm.repository.IResource;

import com.sapportals.wcm.repository.PropertyName;

import com.sapportals.wcm.repository.ResourceContext;

import com.sapportals.wcm.repository.ResourceFactory;

import com.sapportals.wcm.util.uri.RID;

import com.sapportals.wcm.util.usermanagement.WPUMFactory;

public class TestKMApi extends PageProcessorComponent {

public DynPage getPage() {

return new TestDynPage();


public static class TestDynPage extends JSPDynPage {

public void doInitialization() {


public void doProcessAfterInput() throws PageException {

final String OriginProp = "Origin.Country";

final String CREATED_BY_PROP_PREFIX ="";

final String try {

IPortalComponentRequest request =

(IPortalComponentRequest) this.getRequest();

IUser user = WPUMFactory.getUserFactory().getEP5User(request.getUser());

//IUser user= (IUser)request.getUser();

ResourceContext ctxt = new ResourceContext(user);

RID rid = RID.getRID("/documents");

IResource res =

ResourceFactory.getInstance().getResource(rid, ctxt);

IPropertyName propName =

new PropertyName(CREATED_BY_PROP_PREFIX, OriginProp);

IProperty p = res.getProperty(propName);


} catch (Exception e) {




public void doProcessBeforeOutput() throws PageException {





//xml file

<?xml version="1.0" encoding="utf-8"?>





<component name="TestKMApi">


<property name="ClassName" value="TestKMApi.TestKMApi"/>







//jsp file

<%@ page language="java" %>

<%@ page import="java.util.*"%>

<%@ page import="javax.servlet.http.*"%>

<%@ page import="com.sapportals.htmlb.*" %>

<%@ page import="javax.servlet.jsp.*" %>

<%@ page import ="com.sapportals.portal.prt.component.*"%>


String hi="hi";

String text="text";

IPortalComponentRequest currentRequest =(IPortalComponentRequest)pageContext.getAttribute(javax.servlet.jsp.PageContext.REQUEST);


text = currentRequest.getComponentSession().getValue("Country").toString();


catch(Exception e)







I am getting java.lang.NullPointerException.

I have already set properties.

plz help me.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2006 at 07:55 AM

    Could you please provide the stack trace?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.