oraclecommerce-从ATG中的存储库获取属性时出现NullPointerException



我正试图从概要文件存储库中获取诸如名字和姓氏之类的属性,并使用液滴将其显示在jsp中。以下是我的示例代码:SampleDroplet.java

public class SampleDroplet extends DynamoServlet {
private Repository mProfileRepository;
@Override
public void service(DynamoHttpServletRequest pReq, DynamoHttpServletResponse pRes)
        throws ServletException, IOException {
    String lFirstName = null;
    String lLastName = null;
    String lProfileId = pReq.getParameter("profileId");     
    try {
        RepositoryItem lItem = getProfileRepository().getItem(lProfileId, "user");
        lFirstName = (String) lItem.getPropertyValue("firstName");
        lLastName = (String) lItem.getPropertyValue("lastName");
    } catch (RepositoryException e) {
        e.printStackTrace();
    }
    pReq.setParameter("firstName", lFirstName);
    pReq.setParameter("lastName", lLastName);
    pReq.serviceParameter("output", pReq, pRes);
}

SampleDroplet.properties

$class=com.tap.droplet.SampleDroplet
scope=global
profileRepository=/atg/userProfiling/ProfileAdaptarRepository

SampleDroplet.jsp

<dsp:page>
<dsp:importbean bean="/atg/userprofiling/Profile" var="profile" />
<dsp:importbean bean="/com/tap/droplet/SampleDroplet" />
<dsp:getvalueof var="profileId" bean="Profile.id"/>
    <dsp:droplet name="SampleDroplet">
        <dsp:param name="profileId" value="${profileId}" />
        <dsp:oparam name="output">
            Profile's First Name : <dsp:valueof param="firstName"/>
                      Last Name : <dsp:valueof param="lastName"/>
        </dsp:oparam>
    </dsp:droplet>
</dsp:page>

我试着在jsp中显示profileId,它正在工作。但当我把它传给液滴时,它显示NullPointerException

java.lang.NullPointerException
at com.tap.droplet.SampleDroplet.service(SampleDroplet.java:26)
at atg.servlet.DynamoServlet.service(DynamoServlet.java:152)
at atg.taglib.dspjsp.DropletTag.invokeServlet(DropletTag.java:420)
at atg.taglib.dspjsp.DropletTag.doAfterBody(DropletTag.java:705)
at     jsp_servlet._test._droplet.__sampledroplet._jsp__tag18(__sampledroplet.java:874)
Truncated. see log file for complete stacktrace

如果有人知道问题出在哪里,请帮帮我。

提前感谢

看起来问题就在这里:

profileRepository=/atg/userProfiling/ProfileAdaptarRepository

Nucleus找不到此组件:

  1. "userprofiling"应该用小写
  2. 配置文件适配器库->配置文件适配器存储库

相关内容

  • 没有找到相关文章

最新更新