If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

problem connecting to cognos, java

Started by henry555, 31 Jan 2008 04:16:47 PM

Previous topic - Next topic

henry555

I want to give users the ability to run Cognos reports inside a java web application that I am making.  However I am having problems making a connection to my Cognos server.  The wierd thing is that if I run one of the examples provided by Cognos directly (in Eclipse, right click, run as, Java application) I am able to make a connection with no problems.  It is only when I move the exact same code to my web application the problems arise.  I have included all of the correct jar files into my build path (from \Cognos\c8\sdk\java\lib), but keep getting the following error:

Servlet.service() for servlet default threw exception
java.lang.NoSuchFieldError: RPC

My code looks like this:


import com.cognos.developer.schemas.bibus._3.*;
import org.apache.axis.client.Stub;
...
String endPoint = ""http://localhost/cognos8/cgi-bin/cognos.cgi";

ContentManagerService_ServiceLocator cmServiceLocator = new ContentManagerService_ServiceLocator();
ReportService_ServiceLocator  rsServiceLocator = new ReportService_ServiceLocator();
//cmService  is set up with a Stub
cmService = new ContentManagerServiceStub(new java.net.URL(endPoint), cmServiceLocator);
...


It fails on this line:  'cmService = new ContentManagerServiceStub(new java.net.URL(endPoint), cmServiceLocator);'

Any ideas?



larsonr

Just taking a quick look at your code posted, you have two quotation marks at the beginning of your URL.  Did this code compile? or is the error being thrown during your project build.

If you are still getting errors, try hitting the dispatcher directly

"http://cognosServer:9300/p2pd/servlet/dispatch"

where 9300 is the port number you configured your dispatcher to receive requests on.


henry555

Thank you for the response.

I accidently put that double quote in front of my URL when I posted the question.  My code does compile and run, it just throws a 'NoSuchFieldError' exception.

I changed my endpoint url to reference the dispatcher directly but it did not make a difference.  It does work as a standalone java app, only when I run the code inside a webapp it does not work.  My webapp is a simple struts2 project.  I deployed the 'struts2-blank-2.0.11.war' file and modified it by adding the jar files from 'Cognos/c8/sdk/java/lib'.