You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ho...@armacell.com on 2005/04/27 16:18:31 UTC

Custom Realm for Lotus Domino "Could not open notes session"

Hi, I' trying to implement a realm to authenticate against a Notes DIIOP 
service.

This is done using a class which extends RealmBase and fill some of the 
methods (for reference
I leave all the code inside here, if you like to write your own Realm, you 
can start with that code below).

In other places, this code works, but within the authenticate() method it 
won't work and will end up in an exception:
NotesException: Could not open Notes session: org.omg.CORBA.MARSHAL: 
vmcid: 0x0  minor code: 0  completed: No
        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.armacell.tomcat.auth.DominoRealm.authenticate(DominoRealm.java:98)
        at 
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:229)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) 

        ...

The really weird about this is, that it actually works if I move it to the 
constructor. It makes no sense to move it there of course and I did it for 
testing only, but why doesn't it work in the authenticate() method while 
it does in another place ? 

Not even the packet to the DIIOP server (at Port 63148) seems to be sent. 
(It will when used from the constructor).

Since the code needs to access a server I wonder if authenticate() is 
somehow synchronized or access of other servers is locked within the 
authenticate() method?

Any help appreciated.

Code (Check the MARKED CODE section):
-----
public class DominoRealm extends RealmBase {

        String username;
        String passwd;
        ArrayList roles = null;
 
        public DominoRealm()  {
        }
 
        protected String getName() {
                return username;
        }

        protected String getPassword(String arg0) {
                return passwd;
        }

        protected Principal getPrincipal(String arg0) {
                return new GenericPrincipal(this,username,passwd,roles);
        }
 
        public Principal authenticate(String user, String pass) {
 
                try {
                        // --> MARKED CODE START
                        String[] args = new String[1];
                        args[0] = "";
                        // create the notes session
                        Session s = 
NotesFactory.createSession("lnmun06.armacell.com:63148",args,"<user>","<pass>");
                        //  MARKED CODE END

                        Database db = s.getDatabase("","names.nsf");
 
                        this.username = user;
                        this.passwd = pass;
                } catch (NotesException e) {
                        // HERE COMES THE ERROR
                        System.out.println(e.text);
                        e.printStackTrace();
                        return null;
                }
 
                return getPrincipal(user);
 
        }
 
Thanks
Holger

Re: Custom Realm for Lotus Domino "Could not open notes session"

Posted by ho...@armacell.com.
Hello,

I figured out how to get it to work, even if there was no hint in all the 
documentation I know... The NotesFactory provides another createSession() 
which uses org.omg.CORBA.ORB to implement an "Object Request Broker" which 
seems to do  connection pooling. Using this makes the problem disappear...

So, if you try to connect to a Domino (6.5.3) server using Tomcat (5.0.28) 
in a custom realm, keep in mind that you should use Connection pooling. If 
you want more specific info, mail to holger.willenborg__AT_gmx.net.

Regards
Holger

---
I wrote:

Hi, I' trying to implement a realm to authenticate against a Notes DIIOP 
service.

This is done using a class which extends RealmBase and fill some of the 
methods (for reference
I leave all the code inside here, if you like to write your own Realm, you 

can start with that code below).

In other places, this code works, but within the authenticate() method it 
won't work and will end up in an exception:
NotesException: Could not open Notes session: org.omg.CORBA.MARSHAL: 
vmcid: 0x0  minor code: 0  completed: No
        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.armacell.tomcat.auth.DominoRealm.authenticate(DominoRealm.java:98)
        at 
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:229)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) 


        ...

The really weird about this is, that it actually works if I move it to the 

constructor. It makes no sense to move it there of course and I did it for 

testing only, but why doesn't it work in the authenticate() method while 
it does in another place ? 

Not even the packet to the DIIOP server (at Port 63148) seems to be sent. 
(It will when used from the constructor).

Since the code needs to access a server I wonder if authenticate() is 
somehow synchronized or access of other servers is locked within the 
authenticate() method?

Any help appreciated.

Code (Check the MARKED CODE section):
-----
public class DominoRealm extends RealmBase {

        String username;
        String passwd;
        ArrayList roles = null;
 
        public DominoRealm()  {
        }
 
        protected String getName() {
                return username;
        }

        protected String getPassword(String arg0) {
                return passwd;
        }

        protected Principal getPrincipal(String arg0) {
                return new GenericPrincipal(this,username,passwd,roles);
        }
 
        public Principal authenticate(String user, String pass) {
 
                try {
                        // --> MARKED CODE START
                        String[] args = new String[1];
                        args[0] = "";
                        // create the notes session
                        Session s = 
NotesFactory.createSession("lnmun06.armacell.com:63148",args,"<user>","<pass>");
                        //  MARKED CODE END

                        Database db = s.getDatabase("","names.nsf");
 
                        this.username = user;
                        this.passwd = pass;
                } catch (NotesException e) {
                        // HERE COMES THE ERROR
                        System.out.println(e.text);
                        e.printStackTrace();
                        return null;
                }
 
                return getPrincipal(user);
 
        }
 
Thanks
Holger