Java in Notes/Domino Explained: Different kinds of sessions


When creating sessions to Notes/Domino (lotus.domino.Session) you have to distinguish between the two different types:

  • Local sessions
  • Remote sessions

Below I’ll describe both types and more importantly what you cannot do with the different types.

Local sessions

You create a local session using the methods of lotus.domino.NotesFactory class that doesn’t take a hostname argument. The session is actually just a thin wrapper around native calls to an underlying DLL/shared library hence you need to have the binary Notes and/or Domino code installed on the machine your code runs on.

Local sessions cannot be created using a LTPA (Lightweight Third Party Autentication) token or anonymously.

To use local sessions you need to include the notes.jar file on the classpath of the code.

Remote sessions

Remote (or Corba) sessions are run over the IIOP wire protocol hence you need the DIIOP server task loaded on the Domino server. You do not need to have the HTTP server task loaded on the Domino server to use remote sessions. The reason you would normally load HTTP anyway is if you want the code to automatically discover the hostname and port to use for the Domino server. This is done via the IOR (Interoperable Object Reference) and the diiop_ior.txt on the Domino server (http://diiop.example.com/diiop_ior.txt). If you do not load the HTTP task you can provide the IOR to the NotesFactory method as a String.

You cannot create remote sessions against a Notes client installation.

Remote sessions are created using the methods of lotus.domino.NotesFactory that take a hostname as an argument. Remote sessions can be created anonymously, using cleartext username/password or using a previously established LTPA token.

To use remote sessions you need to include the ncso.jar file on the classpath of the code.

8 thoughts on “Java in Notes/Domino Explained: Different kinds of sessions”

  1. Correction, it is possible to create a local session using a LTPA token or username/password or anonymous credentials. But it’s only possible on a server configuration.

    Like

  2. Hi there, I have a web-application hosted on OC4J wherein I connect to Domino R6.0 through IIOP. I have NCSO.jar in my class-path.
    I am getting the following exceptions while connecting…Login failed for HostName can’t instantiate default ORB implementation lotus.priv.CORBA.iiop.ORB.

    But the same script works fine when I connect to R5 (using NCSOW.jar) or R7(using NCSO.jar).

    Please advise…

    Like

  3. Normally the main difference in connecting to a Domino server using Corba on Domino 5 and Domino 6+ is in the use of Internet Sites to configure the web stack and/or DIIOP task. Verify that your DIIOP is correctly setup even when using Internet Sites. This would be my first advise.

    Like

  4. HI, Mr. Heisterberg,

    I can connect seamlessly locally to my notes client.

    However, I am trying to connect to my domino server 8.5 using the tool remotely.

    I added NSCO.jar at the class path. I connect anonymously. I get the

    following error. Could the problem be in some configuration in the server allowing access anonymously?

    Thank you !

    [ERROR] – Unable to create authenticated remote session.

    NotesException: Could not open Notes session

        at lotus.domino.cso.Session.initSession(Unknown Source)

        at lotus.domino.cso.Session.<init>(Unknown Source)

        at lotus.domino.cso.Session.createSession(Unknown Source)

        at lotus.domino.NotesFactory.createSessionUP(Unknown Source)

        at lotus.domino.NotesFactory.createSession(Unknown Source)

        at com.lekkimworld.sessions.Main$RemoteSessionFactory.getSession(Main.java:309)

        at com.lekkimworld.sessions.Main.main(Main.java:159)

    Caused by: org.omg.CORBA.COMM_FAILURE: java.net.ConnectException: Connection refused: connect Host: 63.202.173.232 Port: 63148  vmcid: 0x0  minor code: 1  completed: No

        at lotus.priv.CORBA.iiop.ConnectionTable.get(Unknown Source)

        at lotus.priv.CORBA.iiop.ConnectionTable.get(Unknown Source)

        at lotus.priv.CORBA.iiop.Generic.getConnection(Unknown Source)

        at lotus.priv.CORBA.iiop.Generic.locate(Unknown Source)

        at lotus.priv.CORBA.iiop.RepImpl.invokePreamble(Unknown Source)

        at lotus.priv.CORBA.iiop.RepImpl.invoke(Unknown Source)

        at lotus.priv.CORBA.portable.ObjectImpl._invoke(Unknown Source)

        at lotus.domino.corba._IObjectServerStub.createSession(Unknown Source)

        … 7 more

    Caused by: java.net.ConnectException: Connection refused: connect

        at java.net.PlainSocketImpl.socketConnect(Native Method)

        at java.net.PlainSocketImpl.doConnect(Unknown Source)

        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)

        at java.net.PlainSocketImpl.connect(Unknown Source)

        at java.net.SocksSocketImpl.connect(Unknown Source)

        at java.net.Socket.connect(Unknown Source)

        at java.net.Socket.connect(Unknown Source)

        at java.net.Socket.<init>(Unknown Source)

        at java.net.Socket.<init>(Unknown Source)

        at lotus.priv.CORBA.iiop.Connection.newSocket(Unknown Source)

        … 15 more

    Like

  5. The answer seems to be in the stacktrace. The code tried to connect to a server at IP 63.202.173.232 on port 63148 but was unable to do so ("connection refused"). If this is "internal" code i.e. it runs inside the firewall it would mean you would need to be able to access that before mentioned ip address and port from the machine running the code. In any case you need to make sure that the machine running the code can address the ip address and port despite of firewall rules etc.

    Like

  6. Hi There,

    I am using notesfactory to createsession with Domino from my Java application . After 30 connections, its saying "Unable to create notes session" . This exception occurs even though I have recycled all notes objects and garbage collected the objects in JVM also.

    Please suggest me how we can solve this problem.

    Like

  7. remote sessions from my java application ,I havenot implemented any thread concept here, Domino version 7

    Exception:

    <p style=”MARGIN: 0in 0in 0pt” class=”MsoNormal”><strong style=”mso-bidi-font-weight: normal”><span style=”FONT-FAMILY: "Courier New"; COLOR: red; FONT-SIZE: 9pt”>Construct JAXB objects…NotesException: Could not open Notes session<o:p></o:p></span>

     If connections reaches more than 30 iam getting this exception. Even though I have recycled the objects.

    Pls see my code:

    <font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>

    s

    <font size=”2″><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>

    db

    <font size=”2″><font size=”2″>

     

    <font size=”2″><font size=”2″>

    viewEntry =

    <font size=”2″><font size=”2″>

    document = viewEntry.getDocument();

    <font size=”2″>

    longDesc =document.getItemValueString(IMSWebProperties.getInstance().getNotesColumn());

    <font size=”2″>

    <p align=”left”>document.recycle();

    document=

    <font size=”2″><font size=”2″>

    <p align=”left”>viewEntry.recycle();

    <p align=”left”>viewEntry=

    <font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>

    <p align=”left”>view

     

    <font size=”2″><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>

    <p align=”left”>db

     

    <font size=”2″><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>

    <p align=”left”>s

     

    </font></font><font size=”2″>.recycle();</font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>s</font></font><font size=”2″>=</font><font color=”#7f0055″ size=”2″><font color=”#7f0055″ size=”2″>null</font></font><font size=”2″>;</font></font></font></font><font size=”2″>.recycle();</font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>db</font></font><font size=”2″>=</font><font color=”#7f0055″ size=”2″><font color=”#7f0055″ size=”2″>null</font></font><font size=”2″>;</font></font></font></font><font size=”2″>.recycle();</font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>view</font></font><font size=”2″>=</font><font color=”#7f0055″ size=”2″><font color=”#7f0055″ size=”2″>null</font></font><font size=”2″>;</font></font><font color=”#7f0055″ size=”2″><font color=”#7f0055″ size=”2″>null</font></font><font size=”2″>;</font></font></font><font color=”#7f0055″ size=”2″><font color=”#7f0055″ size=”2″>null</font></font><font size=”2″>;</font></font></font></font></font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>view</font></font><font size=”2″>.getEntryByKey(styleCode.trim());</font></font></font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>view</font></font><font size=”2″> = </font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>db</font></font><font size=”2″>.getView(IMSWebProperties.getInstance().getNotesView());</font></font></font></font><font size=”2″> = </font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>s</font></font><font size=”2″>.getDatabase(</font><font color=”#2a00ff” size=”2″><font color=”#2a00ff” size=”2″>""</font></font><font size=”2″>,IMSWebProperties.getInstance().getNotesDatabase());</font></font></font></font><font size=”2″> = NotesFactory.createSession(</font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>lotusServerHost</font></font><font size=”2″>, </font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>serverUserName</font></font><font size=”2″>, </font><font color=”#0000c0″ size=”2″><font color=”#0000c0″ size=”2″>serverPassword</font></font><font size=”2″>);</font>

    Like

Comments are closed.