• Using OpenLog with Servlet

    By Johan Bladh 2 decades ago

    Hi Julian.



    I've tried the OpenLog-db a little to see if I could use it and it looked great until I tried it with servlets. It seems as if it's not possible to use the notesobjects like session and db, that you declare as global for the OpenLogItem-class, in a method that did not create it.



    In my test I compiled the two classes OpenLogItem and SynchronizedOpenLogItem and put them in the same folder as the servlet. When I tried the servlet with an error I got

    "NotesException: Object has been removed or recycled". The error was thrown in the method "useDefaultLogDb" at first. So I tried to create the session in that method with NotesFactory and then it was ok. But now the same error occured in the function "writeToLog" where you try to create a logDocument using logDoc = db.createDocument();. So I created the session again in writeToLog and used it to get the logdb and than everything works. Now i'm not a java-guru so I don't really know if I have missed something in how it supposed to work here and I know you haven't really tested the OpenLog with servlets but I would really love for a fix. ;-)



    Oh, almost forgot. I had to create a NotesThread with NotesThread.sinitThread(); in the constructor public OpenLogItem (String dbName, String agentName) to be able to use the notesclasses from servlets ie. session.



    //Johan

    • I'll try to do a little testing this weekend

      By Julian Robichaux 2 decades ago

      Johan -



      Thanks. I think you're my first servlet user, so you're probably treading new ground there. I think I have a few simple servlets I can test against this weekend if I get a chance. In the meantime, if you find a way to fix it yourself, please let me know.


      • Julian