This is a brief overview on how to debug a custom security provider using Eclipse. The techniques used to debug a custom security provider are no different than debugging a normal remote java application. These steps can be found in many sites on the web. The appendix A contains an example of how to do this.
There are a couple of ways to debug any cognos code. One method is to start cognos via the command prompt using startup.bat and then put print messages in your code. As the code gets invoked you will see the results in the command window. Another way is to use an IDE such as eclipse or Intellj to debug the code. There are many advantages of debugging via an IDE but one of the biggest is that you can step through the code one line at a time inspecting any variable vs knowing ahead of time which variable you want to print. This document identifies how this can be done.
Here are the steps necessary to debug using eclipse.
1.) Allow cognos server to be run in debug mode.
The first step is to modify the bootstrap_win32.xml file located in the bin directory to allow for debugging. You will see a section (<!-- uncomment these for debug -->) that needs to be uncommented. Notice the default port in this file is 9091. If you are already using that port or your network is blocking it then you should modify it to a port that is allowed. Once this change is made restart cognos. Note: On windows you must restart cognos via the service mode in order to get this to work.
2.) Create an Eclipse project with your custom security provider code.
Make sure it compiles clean
3.) Create a jar file that contains all the class files for debugging.
In order for your code to be debugged it is convenient to place all the class files in a single jar file which you can point eclipse to when debugging.
4.) Set up debugging in eclipse
Open eclipse and perform the steps identified above in the Appendix A titled: Configuring Eclipse to Debug a Remotely Running Application. For the project pick the project you created in step 2.
5.) Set break points in your source code identified above in step 2
In my case I put break points in the logon method, logout method and the searchobject method of the class file called “SingleTenantProvider” which extends Namespace implements INamespaceAuthenticationProvider2
6.) Logon to cognos, with your browser, picking your csp as namespace
You should then hit a break point if you put one in the logon method or the search method.
You might get an error message indicating cannot find source for class file. If so then configure it to point to the jar file build in step 3.There is more detail provided in the debug_csp_eclipse.pdf document.