• Unexpected runtime error - opening in Notes client

    By Nick J McCann 1 decade ago

    Similar to Zeff's but not exactly the same...

     

     

    Unexpected runtime error

    The runtime has encountered an unexpected error.


    Error source

    Page Name:/home.xsp




    Exception

    Error while executing JavaScript action expression
    Script interpreter error, line=77, col=37: [TypeError] Exception occurred calling method NotesDatabase.getView(string) null
       at [/global.jss].initApplication()


    JavaScript code

       1: function checkAuth(){
       2:    if (context.getUser().getCommonName() == "Anonymous"){
       3:        sessionScope.put("entryPage",context.getUrl().getPath() + context.getUrl().getQueryString())
       4:        context.redirectToPage("/login.xsp");
       5:    }
       6: }
       7: 
       8: function checkBrowser(){
       9:    sessionScope.put("browserType","browser")
      10:    // The following is commented out till the other interfaces are ready
      11:    // var browserType = context.getUserAgent().getUserAgent();
      12:    // if (browserType.match("iPhone")){
      13:    //  sessionScope.put("browserType","iPhone");}
      14:    // if (browserType.match("iPad")){
      15:    //  sessionScope.put("browserType","iPad");}
      16:    // if (browserType.match("Blackberry")){
      17:    //  sessionScope.put("browserType","blackberry");}
      18:    // if (browserType.match("Android")){
      19:    //  sessionScope.put("browserType","Android");}
      20: }
      21: 
      22: function checkTheme(browserName){
      23:     if (browserName == "browser"){
      24:         if (context.getSessionProperty("xsp.theme") != browserName + "_" + applicationScope.blogTheme){
      25:             context.setSessionProperty("xsp.theme",browserName+ "_" + applicationScope.blogTheme);
      26:             var thisPage = context.getUrl().getAddress();
      27:             var thisPage = context.getUrl().toString();
      28:             context.redirectToPage(thisPage);
      29:         }
      30:     }
      31: }
      32: 
      33: function initSession(){
      34:    // Quick Access To the Users Name.
      35:     sessionScope.put("commonName",context.getUser().getCommonName());
      36:     sessionScope.put("fullName",context.getUser().getFullName());
      37:     
      38:    // Quick Access To The Users Roles.
      39:     sessionScope.put("showDebug",false);
      40:     sessionScope.put("forumOwner",false);
      41: 
      42:     if(@Contains(context.getUser().getRoles(),"[DEBUG]") == @True()){
      43:         sessionScope.put("showDebug",true);
      44:     }
      45:     if(@Contains(context.getUser().getRoles(),"[ForumOwner]") == @True()){
      46:         sessionScope.put("forumOwner",true);
      47:     }
      48: 
      49:    // Read or Setup User Profile
      50:     var thisDB:NotesDatabase = sessionAsSigner.getDatabase(session.getServerName(),session.getCurrentDatabase().getFilePath());
      51:     var userView:NotesView = thisDB.getView("lkp_UserProfiles");
      52:     var userDoc:NotesDocument = userView.getDocumentByKey(sessionScope.commonName);
      53:     if (userDoc == null){
      54:         var userDoc:NotesDocument = thisDB.createDocument();
      55:         userDoc.replaceItemValue("form","content_UserProfile");
      56:         userDoc.replaceItemValue("user_Name",sessionScope.commonName);
      57:         userDoc.replaceItemValue("user_UserName",sessionScope.commonName);
      58:         var userDocAuthor:NotesItem = userDoc.getFirstItem("user_UserName");
      59:         userDocAuthor.setAuthors(true);
      60:         userDoc.replaceItemValue("user_Posts",0);
      61:         userDoc.replaceItemValue("user_Replies",0);
      62:         var curDate:NotesDateTime = session.createDateTime("Today");
      63:         curDate.setNow();
      64:         userDoc.replaceItemValue("user_LastDate",curDate);
      65:         userDoc.replaceItemValue("user_JoinDate",curDate);
      66:         userDoc.save();
      67:         }
      68: 
      69:     sessionScope.userProfileUNID = userDoc.getUniversalID();
      70: 
      71:     sessionScope.put("init",true)
      72: }
      73: 
      74: function initApplication(){
      75:    // See if ExtendedAccess has been setup yet.
      76:     var exDB:NotesDatabase = sessionAsSigner.getDatabase(session.getServerName(),session.getCurrentDatabase().getFilePath());
      77:     var exView:NotesView = exDB.getView("lkp_ExtendedAccess");
      78:     var exDoc:NotesDocument = exView.getFirstDocument();
      79:     if (exDoc == null ){
      80:        // No Extended Access Documents Exist So Create The Defaults.
      81:         var ex1Doc:NotesDocument = exDB.createDocument();
      82:         ex1Doc.replaceItemValue("form","fm_ExtendedAccess");
      83:         ex1Doc.replaceItemValue("ex_Name","Everybody");
      84:         ex1Doc.replaceItemValue("ex_Value","*");
      85:         ex1Doc.save(true,true);
      86:         var ex2Doc:NotesDocument = exDB.createDocument();
      87:         ex2Doc.replaceItemValue("form","fm_ExtendedAccess");
      88:         ex2Doc.replaceItemValue("ex_Name","Anonymous");
      89:         ex2Doc.replaceItemValue("ex_Value","Anonymous");
      90:         ex2Doc.save(true,true);
      91:     }
      92:     
      93:     
      94:     
      95:    // Find The Active Blog Configuration Document.
      96:     var configView:NotesView = database.getView("lkp_cfg_ActiveConfig");
      97:     var configDoc:NotesDocument = configView.getFirstDocument();
      98:     if (configDoc == null ){
      99:        // Must be a new setup.
     100:     // Build the initial Config Document.
     101:      initialConfig();
     102:     // Refresh The View.
     103:      configView.refresh();
     104:     // Open the new Config Document.
     105:      var configDoc:NotesDocument = configView.getFirstDocument();
     106:  }
     107:  applicationScope.configUNID = configDoc.getUniversalID();
     108: // Basics
     109:  applicationScope.forumName = configDoc.getItemValueString("cfg_Basic_ForumName");
     110:  applicationScope.forumShortName = configDoc.getItemValueString("cfg_Basic_ForumShortName");
     111:  applicationScope.blogFooter = configDoc.getItemValueString("cfg_basic_blogFooter");
     112: // Layout
     113:  applicationScope.blogTheme = configDoc.getItemValueString("cfg_basic_blogTheme");
     114: // Login
     115:  applicationScope.loginMarketTitle = configDoc.getItemValueString("cfg_login_market_title");
     116:  applicationScope.loginMarketText = configDoc.getItemValueString("cfg_login_market_text");
     117:  applicationScope.loginLegal1 = configDoc.getItemValueString("cfg_login_legal1");
     118:  applicationScope.loginLegal2 = configDoc.getItemValueString("cfg_login_legal2");
     119: // Registration
     120:  applicationScope.AppAllowReg = configDoc.getItemValueString("cfg_reg_enabled");
     121:  applicationScope.AppRegDB = configDoc.getItemValueString("cfg_reg_directory");
     122: // Profiles
     123:  applicationScope.AppProfileEdit = configDoc.getItemValueString("cfg_profiles_enabled");
     124:  applicationScope.AppProfilePassword = configDoc.getItemValueString("cfg_profiles_passwordChange");
     125:  
     126:  applicationScope.put("init",true)
     127: }
     128: 
     129: function initialConfig(){
     130: // Used For The First Time A Person Opens This Application.
     131: // Builds The Default Configuration.
     132:  var thisDB:NotesDatabase = sessionAsSigner.getDatabase(session.getServerName(),session.getCurrentDatabase().getFilePath());
     133:  var newConfigDoc:NotesDocument = thisDB.createDocument();
     134:  newConfigDoc.replaceItemValue("Form","cfg_Config");
     135: // Basic
     136:  newConfigDoc.replaceItemValue("cfg_Basic_ForumName","xTalk Forums");
     137:  newConfigDoc.replaceItemValue("cfg_Basic_ForumShortName","xTalk Forums");
     138:  newConfigDoc.replaceItemValue("cfg_basic_blogFooter","Powered By xTalk V1.1");
     139: // Layout
     140:  newConfigDoc.replaceItemValue("cfg_basic_blogTheme","blue");
     141: // Login
     142:  newConfigDoc.replaceItemValue("cfg_login_market_title","What Can You Do With xTalk?");
     143:  newConfigDoc.replaceItemValue("cfg_login_market_text","xTalk : The multi-forum solution for IBM Lotus Domino.");
     144:  newConfigDoc.replaceItemValue("cfg_login_legal1","Copyright Declan F Lynch");
     145:  newConfigDoc.replaceItemValue("cfg_login_legal2","IBM, the IBM logo and Lotus are trademarks of IBM Corporation, in the United States, other countries, or both.");
     146: // Registration
     147:  newConfigDoc.replaceItemValue("cfg_reg_enabled","false");
     148:  newConfigDoc.replaceItemValue("cfg_reg_directory","");
     149: // Profiles
     150:  newConfigDoc.replaceItemValue("cfg_profiles_enabled","false");
     151:  newConfigDoc.replaceItemValue("cfg_profiles_passwordChange","false");
     152:  
     153:  newConfigDoc.save(true,true);
     154: }
     155: 
     156: var Comments = (function() {
     157:  return {
     158:      getCommentCount: function(permaLink) {
     159:          var commentCountKey = "comment_count_" + permaLink;
     160:          if (!applicationScope.containsKey(commentCountKey)) {
     161:              var comments = database.getView("lkp_Comments").getAllEntriesByKey(permaLink, true);
     162:              applicationScope.put(commentCountKey, comments.getCount());
     163:              }
     164:          return applicationScope.get(commentCountKey)
     165:      },
     166:      incrementCommentCount: function(permaLink) {
     167:          var commentCountKey = "comment_count_" + permaLink;
     168:          if (applicationScope.containsKey(commentCountKey)) {
     169:              applicationScope.put(commentCountKey, this.getCommentCount(permaLink) + 1);
     170:          } else {
     171:              applicationScope.put(commentCountKey, 1);
     172:                }
     173:      },
     174:      refreshCommentCount: function(permaLink) {
     175:          var commentCountKey = "comment_count_" + permaLink;   
     176:          var comments = database.getView("lkp_Comments").getAllEntriesByKey(permaLink, true);
     177:          applicationScope.put(commentCountKey, comments.getCount());
     178:      }
     179:  };
     180: 
     181: }());
     182: 
     183: function @makeArray( object ){
     184: // from : http://dontpanic82.blogspot.com/
     185:  if( typeof object === 'undefined' || object === null ){ return []; }
     186:  if( typeof object.toArray !== 'undefined' ){
     187:   return object.toArray();
     188:  }
     189:  if( object.constructor === Array ){ return object; }  
     190:  return [ object ];
     191: }
    

     

    Stack Trace

    com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript action expression
        com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(Unknown Source)
        com.ibm.xsp.component.UIViewRootEx.initBeforeContents(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(Unknown Source)
        com.ibm.xsp.application.ViewHandlerEx.createView(Unknown Source)
        com.ibm.xsp.webapp.FacesServlet.serviceView(Unknown Source)
        com.ibm.xsp.webapp.FacesServletEx.serviceView(Unknown Source)
        com.ibm.xsp.webapp.FacesServlet.service(Unknown Source)
        com.ibm.xsp.webapp.FacesServletEx.service(Unknown Source)
        com.ibm.xsp.webapp.DesignerFacesServlet.service(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService.access$0(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
        java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        java.util.concurrent.FutureTask.run(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceThread.run(Unknown Source)
    com.ibm.jscript.InterpretException: Script interpreter error, line=77, col=37: [TypeError] Exception occurred calling method NotesDatabase.getView(string)
    null
        com.ibm.xsp.script.WrapperDomino$fct_Database.call(Unknown Source)
        com.ibm.jscript.types.FBSObject.call(Unknown Source)
        com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTVariableDecl.interpret(Unknown Source)
        com.ibm.jscript.std.FunctionObject._executeFunction(Unknown Source)
        com.ibm.jscript.std.FunctionObject.executeFunction(Unknown Source)
        com.ibm.jscript.std.FunctionObject.call(Unknown Source)
        com.ibm.jscript.types.FBSObject.call(Unknown Source)
        com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTIf.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTProgram.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTProgram.interpretEx(Unknown Source)
        com.ibm.jscript.JSExpression._interpretExpression(Unknown Source)
        com.ibm.jscript.JSExpression.access$1(Unknown Source)
        com.ibm.jscript.JSExpression$2.run(Unknown Source)
        java.security.AccessController.doPrivileged(Unknown Source)
        com.ibm.jscript.JSExpression.interpretExpression(Unknown Source)
        com.ibm.jscript.JSExpression.evaluateValue(Unknown Source)
        com.ibm.jscript.JSExpression.evaluateValue(Unknown Source)
        com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(Unknown Source)
        com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(Unknown Source)
        com.ibm.xsp.component.UIViewRootEx.initBeforeContents(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(Unknown Source)
        com.ibm.xsp.application.ViewHandlerEx.createView(Unknown Source)
        com.ibm.xsp.webapp.FacesServlet.serviceView(Unknown Source)
        com.ibm.xsp.webapp.FacesServletEx.serviceView(Unknown Source)
        com.ibm.xsp.webapp.FacesServlet.service(Unknown Source)
        com.ibm.xsp.webapp.FacesServletEx.service(Unknown Source)
        com.ibm.xsp.webapp.DesignerFacesServlet.service(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService.access$0(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
        java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        java.util.concurrent.FutureTask.run(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceThread.run(Unknown Source)
    NotesException: Database AppTalk.nsf has not been opened yet
        lotus.domino.local.Database.getView(Unknown Source)
        com.ibm.xsp.script.WrapperDomino$fct_Database.call(Unknown Source)
        com.ibm.jscript.types.FBSObject.call(Unknown Source)
        com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTVariableDecl.interpret(Unknown Source)
        com.ibm.jscript.std.FunctionObject._executeFunction(Unknown Source)
        com.ibm.jscript.std.FunctionObject.executeFunction(Unknown Source)
        com.ibm.jscript.std.FunctionObject.call(Unknown Source)
        com.ibm.jscript.types.FBSObject.call(Unknown Source)
        com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTIf.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTProgram.interpret(Unknown Source)
        com.ibm.jscript.ASTTree.ASTProgram.interpretEx(Unknown Source)
        com.ibm.jscript.JSExpression._interpretExpression(Unknown Source)
        com.ibm.jscript.JSExpression.access$1(Unknown Source)
        com.ibm.jscript.JSExpression$2.run(Unknown Source)
        java.security.AccessController.doPrivileged(Unknown Source)
        com.ibm.jscript.JSExpression.interpretExpression(Unknown Source)
        com.ibm.jscript.JSExpression.evaluateValue(Unknown Source)
        com.ibm.jscript.JSExpression.evaluateValue(Unknown Source)
        com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(Unknown Source)
        com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(Unknown Source)
        com.ibm.xsp.component.UIViewRootEx.initBeforeContents(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(Unknown Source)
        com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(Unknown Source)
        com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(Unknown Source)
        com.ibm.xsp.application.ViewHandlerEx.createView(Unknown Source)
        com.ibm.xsp.webapp.FacesServlet.serviceView(Unknown Source)
        com.ibm.xsp.webapp.FacesServletEx.serviceView(Unknown Source)
        com.ibm.xsp.webapp.FacesServlet.service(Unknown Source)
        com.ibm.xsp.webapp.FacesServletEx.service(Unknown Source)
        com.ibm.xsp.webapp.DesignerFacesServlet.service(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(Unknown Source)
        com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService.access$0(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
        java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        java.util.concurrent.FutureTask.run(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)
        com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceThread.run(Unknown Source)