2016-09-28 9 views
0

beforePageLoadイベントでJavaコードを実行しました。私は、コンストラクタでExtLibUtilクラスを使用してsessionAsSignerオブジェクトを取得しようとするが、私はnullをunfortunatelly受け取る。何が原因だろうか?ここに私のクラスです。Xpages ExtLibUtil.getCurrentSessionAsSigner()がnullを返します

importPackage(com.mycompany.activiti); 
var workflow:ActivitiWorkflow = new ActivitiWorkflow(); 
workflow.foo(); 

私は確実にする

com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript action expression 
    com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:126) 
    com.ibm.xsp.component.UIIncludeComposite.initBeforePageContents(UIIncludeComposite.java:672) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:339) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.addComponent(AbstractCompiledPage.java:389) 
    com.ibm.xsp.component.UIIncludeComposite.buildContents(UIIncludeComposite.java:453) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334) 
    com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildChildren(CompiledComponentBuilder.java:123) 
    com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildAll(CompiledComponentBuilder.java:84) 
    com.ibm.xsp.component.UIViewRootEx.buildContents(UIViewRootEx.java:1649) 
    com.ibm.xsp.component.UIViewRootEx2.buildContents(UIViewRootEx2.java:247) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(AbstractCompiledPage.java:167) 
    com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(ViewHandlerExImpl.java:521) 
    com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(ViewHandlerExImpl.java:567) 
    com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(ViewHandlerExImpl.java:142) 
    com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:90) 
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:251) 
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157) 
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160) 
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) 
    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:1335) 
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853) 
    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:1319) 
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662) 
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482) 
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357) 
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313) 
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272) 
com.ibm.jscript.InterpretException: Script interpreter error, line=141, col=45: Error while calling java constructor 'com.mycompany.activiti.ActivitiWorkflow()' (java.lang.reflect.InvocationTargetException). 
    com.ibm.jscript.types.JavaAccessObject.construct(JavaAccessObject.java:262) 
    com.ibm.jscript.types.JavaWrapperObject.construct(JavaWrapperObject.java:1) 
    com.ibm.jscript.ASTTree.ASTNew.interpret(ASTNew.java:109) 
    com.ibm.jscript.ASTTree.ASTVariableDecl.interpret(ASTVariableDecl.java:82) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.std.FunctionObject._executeFunction(FunctionObject.java:261) 
    com.ibm.jscript.std.FunctionObject.executeFunction(FunctionObject.java:185) 
    com.ibm.jscript.std.FunctionObject.call(FunctionObject.java:171) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTArgumentList.interpretArguments(ASTArgumentList.java:65) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:153) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.ASTTree.ASTBlock.interpret(ASTBlock.java:100) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.ASTTree.ASTIf.interpret(ASTIf.java:85) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.std.FunctionObject._executeFunction(FunctionObject.java:261) 
    com.ibm.jscript.std.FunctionObject.executeFunction(FunctionObject.java:185) 
    com.ibm.jscript.std.FunctionObject.call(FunctionObject.java:171) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    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:448) 
    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:222) 
    com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:111) 
    com.ibm.xsp.component.UIIncludeComposite.initBeforePageContents(UIIncludeComposite.java:672) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:339) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.addComponent(AbstractCompiledPage.java:389) 
    com.ibm.xsp.component.UIIncludeComposite.buildContents(UIIncludeComposite.java:453) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334) 
    com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildChildren(CompiledComponentBuilder.java:123) 
    com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildAll(CompiledComponentBuilder.java:84) 
    com.ibm.xsp.component.UIViewRootEx.buildContents(UIViewRootEx.java:1649) 
    com.ibm.xsp.component.UIViewRootEx2.buildContents(UIViewRootEx2.java:247) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(AbstractCompiledPage.java:167) 
    com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(ViewHandlerExImpl.java:521) 
    com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(ViewHandlerExImpl.java:567) 
    com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(ViewHandlerExImpl.java:142) 
    com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:90) 
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:251) 
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157) 
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160) 
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) 
    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:1335) 
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853) 
    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:1319) 
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662) 
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482) 
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357) 
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313) 
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272) 
java.lang.reflect.InvocationTargetException 
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56) 
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) 
    java.lang.reflect.Constructor.newInstance(Constructor.java:527) 
    com.ibm.jscript.types.JavaAccessObject.construct(JavaAccessObject.java:260) 
    com.ibm.jscript.types.JavaWrapperObject.construct(JavaWrapperObject.java:1) 
    com.ibm.jscript.ASTTree.ASTNew.interpret(ASTNew.java:109) 
    com.ibm.jscript.ASTTree.ASTVariableDecl.interpret(ASTVariableDecl.java:82) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.std.FunctionObject._executeFunction(FunctionObject.java:261) 
    com.ibm.jscript.std.FunctionObject.executeFunction(FunctionObject.java:185) 
    com.ibm.jscript.std.FunctionObject.call(FunctionObject.java:171) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTArgumentList.interpretArguments(ASTArgumentList.java:65) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:153) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.ASTTree.ASTBlock.interpret(ASTBlock.java:100) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.ASTTree.ASTIf.interpret(ASTIf.java:85) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.std.FunctionObject._executeFunction(FunctionObject.java:261) 
    com.ibm.jscript.std.FunctionObject.executeFunction(FunctionObject.java:185) 
    com.ibm.jscript.std.FunctionObject.call(FunctionObject.java:171) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    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:448) 
    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:222) 
    com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:111) 
    com.ibm.xsp.component.UIIncludeComposite.initBeforePageContents(UIIncludeComposite.java:672) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:339) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.addComponent(AbstractCompiledPage.java:389) 
    com.ibm.xsp.component.UIIncludeComposite.buildContents(UIIncludeComposite.java:453) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334) 
    com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildChildren(CompiledComponentBuilder.java:123) 
    com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildAll(CompiledComponentBuilder.java:84) 
    com.ibm.xsp.component.UIViewRootEx.buildContents(UIViewRootEx.java:1649) 
    com.ibm.xsp.component.UIViewRootEx2.buildContents(UIViewRootEx2.java:247) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256) 
    com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(AbstractCompiledPage.java:167) 
    com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(ViewHandlerExImpl.java:521) 
    com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(ViewHandlerExImpl.java:567) 
    com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(ViewHandlerExImpl.java:142) 
    com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:90) 
    com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:251) 
    com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157) 
    com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160) 
    com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) 
    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:1335) 
    com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853) 
    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:1319) 
    com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662) 
    com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482) 
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357) 
    com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313) 
    com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272) 
java.lang.NullPointerException 
    com.mycompany.activiti.ActivitiWorkflow.<init>(ActivitiWorkflow.java:88) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56) 
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) 
    java.lang.reflect.Constructor.newInstance(Constructor.java:527) 
    com.ibm.jscript.types.JavaAccessObject.construct(JavaAccessObject.java:260) 
    com.ibm.jscript.types.JavaWrapperObject.construct(JavaWrapperObject.java:1) 
    com.ibm.jscript.ASTTree.ASTNew.interpret(ASTNew.java:109) 
    com.ibm.jscript.ASTTree.ASTVariableDecl.interpret(ASTVariableDecl.java:82) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.std.FunctionObject._executeFunction(FunctionObject.java:261) 
    com.ibm.jscript.std.FunctionObject.executeFunction(FunctionObject.java:185) 
    com.ibm.jscript.std.FunctionObject.call(FunctionObject.java:171) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTArgumentList.interpretArguments(ASTArgumentList.java:65) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:153) 
    com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.ASTTree.ASTBlock.interpret(ASTBlock.java:100) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.ASTTree.ASTIf.interpret(ASTIf.java:85) 
    com.ibm.jscript.ASTTree.ASTDebug.interpret(ASTDebug.java:148) 
    com.ibm.jscript.std.FunctionObject._executeFunction(FunctionObject.java:261) 
    com.ibm.jscript.std.FunctionObject.executeFunction(FunctionObject.java:185) 
    com.ibm.jscript.std.FunctionObject.call(FunctionObject.java:171) 
    com.ibm.jscript.types.FBSObject.call(FBSObject.java:161) 

答えて

5

ことの一つは、内のすべての設計要素ということで、次のスタックトレースを使用してそれを読む:私はbeforePageLoadイベントでそれを実行するには、次のコードを使用し

package com.mycompany.activiti; 

public class ActivitiWorkflow { 
    private Session sAsSigner = null; 
    private String currentUser = null; 
    private Database db 

    public ActivitiWorkflow() throws NotesException { 
     currentUser = DominoUtils.getCurrentSession().getEffectiveUserName();  
     sAsSigner = ExtLibUtil.getCurrentSessionAsSigner(); 

     db = sAsSigner.getCurrentDatabase(); 
     //... 
    } 

    public void foo(){...} 
} 

NSFは同じユーザーと署名されています。それ以外の場合はsessionAsSignerが失敗し、場合によっては(8.5.xサーバーバージョンでは、おそらくはまだ)、サーバーがクラッシュする可能性があります。

+0

これはヒントかもしれません。他の開発者が変更を加えたときに問題が発生しました。私たちはアプリケーションを構築してクリアしましたが、辞めるわけではありません。 –

+0

ええ、データベースに署名することで問題は解決しました。毎回dbに署名しなければならない場合、私たちはどのようにアプリケーションを開発できるのだろうか... –

+3

@dj_universeあなたはgitまたはsourcetreeを使ってソースコントロールを見たいかもしれません。各開発者はデータベースのコピーを持ち、自分で署名することができます。 –

関連する問題