Lotus Notes API giving error while accessing the NSF

久未见 提交于 2021-02-11 14:15:51

问题


I have been working for accessing the Lotus Notes(.nsf) data from the external server using JAVA Lotus notes API, but I'm getting the following error for Lot of functions while accessing the NSF.

NotesException: Not implemented
  at lotus.domino.cso.Base.notImplemented(Unknown Source)
  at lotus.domino.cso.View.getAllUnreadEntries(Unknown Source)
  at com.lotus.GetName.runNotes(GetName.java:40)
  at lotus.domino.NotesThread.run(Unknown Source)

Observations:

  1. I have rechecked my settings with class path(Notes.jar)
  2. Able to access the external server.
  3. Able to create session of Lotus Domino on external server

So I would like to request all for any suggestions or solutions to sort out this issue.


Thanks for your quick reply. I really appreciate that. I am using NCSO.jar and yes i am making remote calls.I checked with my admin and asked for the same NCSO.jar as well as Notes.jar . The server they are using is 8.5 . But it is still throwing the same Error. Apart from that i Dont know how to write and use a java using eclipse as i am completly novice to the Notes Java Development . Please help me as soon as possible . Thanks. :)

The Code i am using is :

public class GetName
{
  public static void main(String argv[])
  {
       try
       {

           Database db;

           String ior = NotesFactory.getIOR("****");

             Session s =  NotesFactory.createSessionWithIOR(ior,"****","****");

             db =  s.getDatabase("****","mail/mail1/****");

    View v =  db.getView("$Inbox");

System.out.println(v.getAllUnreadEntries().getCount());// Getting error on this line
}
}

回答1:


I'm going to have to infer some things here without more information. Firstly, the error indicates you're using a feature only available in Lotus Notes/Domino 8.5. Given that the error says "not implemented", I would guess that you're using a Notes.jar/NCSO.jar that does not implement getAllUnreadEntries. I suspect this problem is environmental rather than your logic.

Check that your jar files you've imported into your project are from Domino 8.5. Earlier versions of Domino's java API do not support "getAllUnreadEntries".

The best way to make sure is to locate and copy the jar files that are installed (by defaut) in a Lotus Notes client (found in the notes\jvm\lib\ext directory). Also, make sure the jar files you're compiling against match the version you're running with. So, you if you've developed this using Notes 8.5 jar's, and this runs on a Domino 7, or 8.0 on the server or client, the runtime will generate an error trying to run a method that doesn't exist. You'll need to make sure it's running on 8.5.

Here is an example of a java agent I extracted from the Domino Designer help that accesses unread entries in a view.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      View view = db.getView("All");
      ViewEntryCollection vec = view.getAllUnreadEntries();
      System.out.println("View has " +
      vec.getCount() + " unread entries");     
      view.markAllRead();
      view.refresh();
      vec = view.getAllUnreadDocuments();
      System.out.println("View has " +
      vec.getCount() + " unread entries after markAllRead");    
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}

This may not exactly reflect what you're trying to do, because it uses "AgentBase" for a java agent. But everything inside the try statement is applicable. Sounds like you're running outside of a Notes agent.

You can write any class that uses the Domino-Java API by making sure Notes.jar and NCSO.jar are in your class path and check which imports are actually being used. If you're not doing remote calls you can just use lotus.domino.*, not lotus.domino.cso.*.




回答2:


If the Notes.jar you used was taken from a local notes installation then I think it can only be used to access a locally running Notes client. To access a remote server there is another jar named NCSO.jar that implements the remote Corba/IIOP protocol. You probably need to ask your administrator to give you a copy of this jar from the server.



来源:https://stackoverflow.com/questions/8543346/lotus-notes-api-giving-error-while-accessing-the-nsf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!