500 Exception on XPages

Now I am in my second day and I am still stuck with this problem…

I have a XPages and on “Events”, “beforePageLoad” I am running:

var doc = document1.getDocument();

doc.replaceItemValue(“personTag”, “true”);

var agent:NotesAgent = database.getAgent(“MyAgent”);

agent.runWithDocumentContext(doc);

And I get the exception as following:

The runtime has encountered an unexpected error.

500 Exception

com.ibm.xsp.FacesExceptionEx: Invalid context factory.

Invalid context factory.

javax.servlet.ServletException: com.ibm.xsp.FacesExceptionEx: Invalid context factory.

com.ibm.xsp.webapp.FacesServlet.init(Unknown Source)

com.ibm.xsp.webapp.FacesServletEx.init(Unknown Source)

com.ibm.xsp.webapp.DesignerFacesServlet.init(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.createServlet(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.createServlet(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.getXspEngineServlet(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.getServlet(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFService.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(Unknown Source)

com.ibm.domino.xsp.bridge.websrv.servlets.DispatcherServlet.service(Unknown Source)

org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(Unknown Source)

javax.servlet.http.HttpServlet.service(Unknown Source)

com.ibm.pvc.webhttpservice.BridgeServlet.service(Unknown Source)

com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Unknown Source)

com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.webapp.BundleWebApp.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.VirtualHost.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.WebContainer.handleRequest(Unknown Source)

com.ibm.wsspi.webcontainer.WebContainer.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(Unknown Source)

com.ibm.ws.http.HttpConnection.readAndHandleRequest(Unknown Source)

com.ibm.ws.http.HttpConnection.run(Unknown Source)

com.ibm.ws.util.ThreadPool$Worker.run(Unknown Source)

com.ibm.xsp.FacesExceptionEx: com.ibm.xsp.FacesExceptionEx: Invalid context factory.

com.ibm.xsp.webapp.FacesServlet.createFacesController(Unknown Source)

com.ibm.xsp.webapp.DesignerFacesServlet.getContextFacesController(Unknown Source)

com.ibm.xsp.webapp.FacesServlet.getFacesController(Unknown Source)

com.ibm.xsp.webapp.FacesServlet.init(Unknown Source)

com.ibm.xsp.webapp.FacesServletEx.init(Unknown Source)

com.ibm.xsp.webapp.DesignerFacesServlet.init(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.createServlet(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.createServlet(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.getXspEngineServlet(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.getServlet(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFService.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(Unknown Source)

com.ibm.domino.xsp.bridge.websrv.servlets.DispatcherServlet.service(Unknown Source)

org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(Unknown Source)

javax.servlet.http.HttpServlet.service(Unknown Source)

com.ibm.pvc.webhttpservice.BridgeServlet.service(Unknown Source)

com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Unknown Source)

com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.webapp.BundleWebApp.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.VirtualHost.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.WebContainer.handleRequest(Unknown Source)

com.ibm.wsspi.webcontainer.WebContainer.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(Unknown Source)

com.ibm.ws.http.HttpConnection.readAndHandleRequest(Unknown Source)

com.ibm.ws.http.HttpConnection.run(Unknown Source)

com.ibm.ws.util.ThreadPool$Worker.run(Unknown Source)

com.ibm.xsp.FacesExceptionEx: Invalid context factory.

com.ibm.xsp.controller.FacesControllerImpl.init(Unknown Source)

com.ibm.xsp.controller.DesignerFacesController.init(Unknown Source)

com.ibm.xsp.webapp.FacesServlet.initializeFacesController(Unknown Source)

com.ibm.xsp.webapp.FacesServlet.createFacesController(Unknown Source)

com.ibm.xsp.webapp.DesignerFacesServlet.getContextFacesController(Unknown Source)

com.ibm.xsp.webapp.FacesServlet.getFacesController(Unknown Source)

com.ibm.xsp.webapp.FacesServlet.init(Unknown Source)

com.ibm.xsp.webapp.FacesServletEx.init(Unknown Source)

com.ibm.xsp.webapp.DesignerFacesServlet.init(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.createServlet(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.createServlet(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.getXspEngineServlet(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.getServlet(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(Unknown Source)

com.ibm.domino.xsp.module.nsf.NSFService.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(Unknown Source)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(Unknown Source)

com.ibm.domino.xsp.bridge.websrv.servlets.DispatcherServlet.service(Unknown Source)

org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(Unknown Source)

org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(Unknown Source)

javax.servlet.http.HttpServlet.service(Unknown Source)

com.ibm.pvc.webhttpservice.BridgeServlet.service(Unknown Source)

com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Unknown Source)

com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.servlet.ServletWrapper.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.webapp.BundleWebApp.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(Unknown Source)

com.ibm.pvc.internal.webcontainer.VirtualHost.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.WebContainer.handleRequest(Unknown Source)

com.ibm.wsspi.webcontainer.WebContainer.handleRequest(Unknown Source)

com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(Unknown Source)

com.ibm.ws.http.HttpConnection.readAndHandleRequest(Unknown Source)

com.ibm.ws.http.HttpConnection.run(Unknown Source)

com.ibm.ws.util.ThreadPool$Worker.run(Unknown Source)

Any idea what this might be???

Subject: You can’t run with context in 8.5.1…

  • Also search the forum for error 500 things. This is a generally useless error that a XPage tosses out for a bewildering array of issues. It’s a catch-all, like the old “MAV” dialog in windoze. In a nutshell you have to just change things and run it until it works, then the last thing you changed is where the problem is. Doesn’t tell you what the problem is, only where.

Good luck…

Subject: two days of googling

Thank you David for you reply. I did search for 500 Exception and I found quite many having the same problem and also found many suggestions and solutions which I tried them all but didn’t resolve the issue.

This is our first try with XPages which is working fine in one of our servers (a test-server). When I copy paste the files to another server which is a mirror and all the server settings as OS, Notes version, doc-settings e t c are exactly the same I get this 500 Exception when I open the XPages. I also know what is causing the problem.

var doc = document1.getDocument();

var agent:NotesAgent = database.getAgent(“MyAgent”);

agent.runWithDocumentContext(doc); ← //This line is causing the 500 Exception

Anyway, I will continue trying today and hopefully find a solution.

Subject: Your original post indicated your server is R8.5.1…

  • You can not use agent.runWithDocumentContext() on R8.5.1. That is an R8.5.2 addition. If you are in fact running R8.5.1 on your server then this line is expected to fail. If you are not running R8.5.1 on your server then I have no pearls of wisdom, and I am on R8.5.1 myself.

Hope this helps…