This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Aug 13, 2014, 8:56 AM
6 Posts

A Lotus Domino Servlet gives me this error: “Cannot create a session from an agent”

  • Category: Domino Server
  • Platform: Windows
  • Release: 9.0
  • Role: Developer
  • Tags: servlet,java
  • Replies: 2

I create a servlet in a Lotus Notes database on a Lotus Domino 9.0 IF5 server. The source code was taken from a tutorial page. Also, the servlet was developed in Domino Designer

This is the most important source code:

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lotus.domino.*;
[...]

public class TestServlet extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse res) {
    try {
        res.setContentType("text/html");        
            PrintWriter toBrowser = res.getWriter();        
            [...]
            try {    
                NotesThread.sinitThread();        
                Session s = NotesFactory.createSession();    //<== ERROR
                Database db = s.getDatabase("","names.nsf");        
                toBrowser.println(db.getTitle());        
                [...]
            }    
            catch (NotesException n) {
                System.out.println("Exception ID:  " + n.id);        
                System.out.println("Exception description:  " + n.text);
                n.printStackTrace();
            }    
            [...]
        }
        catch (Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
    }
}

When I call the servlet, I get this message on the server console.

13/08/2014 04:31:43   HTTP JVM: Exception ID:  4493
13/08/2014 04:31:43   HTTP JVM: Exception description:  Cannot create a session from an agent
13/08/2014 04:31:43   HTTP JVM: NotesException: Cannot create a session from an agent
13/08/2014 04:31:43   HTTP JVM:        at lotus.domino.local.Session.checkSecurityManagerExtender(Unknown Source)
13/08/2014 04:31:43   HTTP JVM:        at lotus.domino.local.Session.createSession(Unknown Source)
13/08/2014 04:31:43   HTTP JVM:        at lotus.domino.NotesFactory.createSession(Unknown Source)
[...]

If I write the servlet without the Lotus Notes code (Session, Database, Document, etc.) it works fine. I can do everything I want always I do not use the Lotus Domino objects. But if I add that lines, the error occurs.

What would be the problem?

TIA,

EDIT:

This how it looks the servlet on Domino Designer. I wrote it in a Notes DB, no outside as an standalone file

Aug 13, 2014, 7:23 PM
3 Posts
looks like a bug
Java security has been tightened in various places of late due to new JVM security requirements.  Looks like a regression -  I put in this spr to track it:  JCOR9MXQUU

Thanks!
Aug 16, 2014, 1:07 PM
6 Posts
It works

I had to write again the servlet as a standalone program, copying the class file on the servlets folder and it worked fine. However, it still does not works as a servlet inside the database.

 


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal