0

有没有其他人注意到这个问题:

'context.getUser().getCommonName()' 为空

我在一台特定服务器上遇到此问题,但无法在其他服务器上重现此问题。

任何帮助,将不胜感激。

这是问题的堆栈跟踪:

com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript computed expression
    com.ibm.xsp.binding.javascript.JavaScriptValueBinding.getValue(JavaScriptValueBinding.java:132)
    javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:451)
    com.ibm.xsp.component.UIDataPanelBase.isRenderedProp(UIDataPanelBase.java:81)
    com.ibm.xsp.component.UIDataPanelBase.fillShadowedFlags(UIDataPanelBase.java:231)
    com.ibm.xsp.component.UIDataPanelBase.encodeBegin(UIDataPanelBase.java:240)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:840)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.component.UIViewRootEx._renderView(UIViewRootEx.java:1317)
    com.ibm.xsp.component.UIViewRootEx.renderView(UIViewRootEx.java:1255)
    com.ibm.xsp.application.ViewHandlerExImpl.doRender(ViewHandlerExImpl.java:641)
    com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:320)
    com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:335)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
    com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:264)
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:248)
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:200)
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137)
    com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1267)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:847)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1251)
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:598)
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:421)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
com.ibm.jscript.InterpretException: Script interpreter error, line=1, col=35: 'context.getUser().getCommonName()' is null
    com.ibm.jscript.InterpretException.<init>(InterpretException.java:123)
    com.ibm.jscript.ASTTree.ASTMember.interpret(ASTMember.java:97)
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:88)
    com.ibm.jscript.ASTTree.binaryop.ASTBinaryDefaultOp.interpret(ASTBinaryDefaultOp.java:49)
    com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119)
    com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139)
    com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435)
    com.ibm.jscript.JSExpression.access$1(JSExpression.java:424)
    com.ibm.jscript.JSExpression$2.run(JSExpression.java:414)
    java.security.AccessController.doPrivileged(AccessController.java:284)
    com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:410)
    com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251)
    com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:234)
    com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:221)
    com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:193)
    com.ibm.xsp.binding.javascript.JavaScriptValueBinding.getValue(JavaScriptValueBinding.java:78)
    javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:451)
    com.ibm.xsp.component.UIDataPanelBase.isRenderedProp(UIDataPanelBase.java:81)
    com.ibm.xsp.component.UIDataPanelBase.fillShadowedFlags(UIDataPanelBase.java:231)
    com.ibm.xsp.component.UIDataPanelBase.encodeBegin(UIDataPanelBase.java:240)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:840)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:851)
    com.ibm.xsp.component.UIViewRootEx._renderView(UIViewRootEx.java:1317)
    com.ibm.xsp.component.UIViewRootEx.renderView(UIViewRootEx.java:1255)
    com.ibm.xsp.application.ViewHandlerExImpl.doRender(ViewHandlerExImpl.java:641)
    com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:320)
    com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:335)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
    com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:264)
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:248)
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:200)
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137)
    com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1267)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:847)
    com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
    com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
    com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1251)
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:598)
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:421)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
4

4 回答 4

2

我们也遇到了这个问题,对于从辅助多米诺地址簿(通过目录帮助知道)认证的用户我们决定不再使用“context.getUser()”:

  • 用 database.queryAccessRoles(session.getEffectiveUserName()) 替换 context.getUser().getRoles()
  • 用 userBean.commonName 替换 context.getUser().getFullName()
  • 用 userBean.commonName 替换 context.getUser().getCommonName()
  • (即使这个有效)将 context.getUser().getDistinguishedName() 替换为 session.getEffectiveUserName()
  • 将 context.getUser().getGroups() 替换为 _getUserGroupNameList() (不是 session.getUserGroupNameList(),NotesName 列表而不是字符串)

    function _getUserGroupNameList() {
        var lNotesName:java.util.Vector = session.getUserGroupNameList(); // list of NotesName
        var lString:java.util.Vector = new java.util.Vector();
        for (var i = 0; i < lNotesName.size(); i++) lString.add(lNotesName.get(i).getCanonical());
        return lString;
    }
    
于 2019-06-19T06:43:42.970 回答
1

我构建了一个快速示例,但无法重现错误

<xp:text escape="true" id="computedField1"
    value="#{javascript:context.getUser().getCommonName()}" />

你到底在做什么?

顺便说一句,你也可以使用 EL

    <xp:text escape="true" id="computedField1"
    value="#{context.user.commonName}" />
于 2012-09-23T04:25:31.407 回答
1

我仍然不确定为什么这会导致一台特定服务器而不是其他服务器出现错误。我决定同时使用 session.getEffectiveUserName() 来解决这个问题。

于 2012-09-28T10:16:12.573 回答
0

我目前有这个问题。这与此服务器上的用户 ID 和 NAB 有关。我不知道到底是什么,但我的 id 密码摘要有问题。这意味着我在此特定服务器上的个人文档(姓名)中的密码未与我的 ID 上的 psw 同步。所以在笔记客户端中,我收到了“对不起,你被锁定了”的消息。我现在已经刷新了密码并且可以登录了,但是之后就开始发生这种情况了。我无法获取用户名。既不是来自上下文,也不是会话。基本上它很有趣。

于 2014-09-18T06:47:28.867 回答