• Custom Database Servlet: access to Domino Backend Classes?

    By Wolfgang Herder 1 decade ago

    Hi,

    the possibility of having servlets' code reside in databases instead of jars on the server's filesystem is very interesting. The examples that I see all redirect to other REST service implementation that come with the extension library. As a first step of getting my existing servlets to work, I tried to create a Notes Session object. So far, I have failed. Did I miss something or is that not supposed to work?

    What I have tried so far:

    NotesFactory.createSession() returns null.

    ExtLibUtil.getCurrentSession() results in
    NotesException: Cannot create a session from an agent
    at lotus.domino.local.Session.checkSecurityManagerExtender(Unknown Source)

    DominoUtils.getCurrentSession() throws a NullPointerException at com.ibm.xsp.util.FacesUtil.resolveRequestMapVariable(FacesUtil.java:1050)

    ContextInfo.getUserSession() throws java.lang.NoClassDefFoundError: com/ibm/designer/domino/napi/NotesAPIException
    The servlet code has access to that class (I require com.ibm.domino.osgi.core and com.ibm.domino.napi plugins in plugin.xml), I can create instances of it.
     
    Thanks for any help!

    Cheers,
    Wolfgang Herder

    • Can you please attach some sample code failing?

      By Philippe Riand 1 decade ago

      We can then have a look and tell you what the best approach is. Also, are you using 852 or 853?

      • Attached

        By Wolfgang Herder 1 decade ago

        This is on 853.

        Attached just the java code for the test class here, will create another response with minimum test case database.

        The result on my server for the query

        http://xxx/ExtLibTest.nsf/xsp/testagi/echo?bla=blub

        is

        Hello unknown, you asked: bla=blub

        The server console reads:

        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: Classloading ServletFactory
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: creating factory
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: Created ServletFactory
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: Classloading ServletFactory$EchoEngine
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: Constructing EchoEngine
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: processing request
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: request: bla=blub
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: ex: test
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: trying NotesFactory.createSession()
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: NotesException: Cannot create a session from an agent
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at lotus.domino.local.Session.checkSecurityManagerExtender(Unknown Source)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at lotus.domino.local.Session.createSession(Unknown Source)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at lotus.domino.NotesFactory.createSession(Unknown Source)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at de.agiimc.test.xext.ServletFactory$EchoEngine.processRequest(ServletFactory.java:52)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.xsp.extlib.services.servlet.ServiceServlet.service(ServiceServlet.java:48)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1267)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:847)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1251)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:598)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:421)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: trying ExtLibUtil.getCurrentSession()
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: Result: null
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: trying DominoUtils.getCurrentSession()
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: java.lang.NullPointerException
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.xsp.util.FacesUtil.resolveRequestMapVariable(FacesUtil.java:1050)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.xsp.model.domino.DominoUtils.getCurrentSession(DominoUtils.java:106)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.xsp.model.domino.DominoUtils.getCurrentSession(DominoUtils.java:78)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at de.agiimc.test.xext.ServletFactory$EchoEngine.processRequest(ServletFactory.java:68)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.xsp.extlib.services.servlet.ServiceServlet.service(ServiceServlet.java:48)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1267)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:847)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1251)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:598)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:421)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: trying ContextInfo.getUserSession()
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: java.lang.NoClassDefFoundError: com/ibm/designer/domino/napi/NotesAPIException
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at de.agiimc.test.xext.ServletFactory$EchoEngine.processRequest(ServletFactory.java:76)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.xsp.extlib.services.servlet.ServiceServlet.service(ServiceServlet.java:48)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1267)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:847)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1251)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:598)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:421)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: Caused by: java.lang.ClassNotFoundException: com.ibm.designer.domino.napi.NotesAPIException
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at java.security.AccessController.doPrivileged(Native Method)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at com.ibm.domino.http.bootstrap.osgi.LaunchRCP$OSGILaunchClassLoader.loadClass(LaunchRCP.java:118)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM:  ... 14 more
        [22684:00056-00073] 10/27/2011 15:21:15   HTTP JVM: got session: null
         

        • Testcase database

          By Wolfgang Herder 1 decade ago
        • The next build is fixed

          By Philippe Riand 1 decade ago

          The next build will have the ExtlibUtils methods enhanced to support their use in servlets