I have ran the below code in java, but it is throwing an NoSuchField error. Can you please help me to correct this code? I have included all the required Jar files and pointed in Environment variable.I am using Java JDK 1.6.It successfully compiles but throws error while running.
I am following the instructions to run this Java Code as given in the below link
http://www.ibm.com/developerworks/data/library/cognos/development/how_to/page565.html?ca=drs-
code:-
Expand|Select|Wrap|Line Numbers
- public class try2
- {
- public static String dispatcherURL = "http://cog8dv01.merck.com:26423/p2pd/servlet/dispa tch";
- private static String nameSpaceID = "cogdvldap";
- private static String userName = "goodr";
- private static String password = "hjghhbh";
- public ContentManagerService_Port cmService=null;
- private static String reportSearchPath1 = "/content/package[@name='Z_USHH ROME Inventory Reporting']/folder[@name='USHH']/folder[@name='USH H - ROME']/report[@name='ROME Literature Spreadsheet']";
- private static String saveLocation1 = "C:/Report";
- public ReportService_Port reportService = null;
- public static void main(String args[])
- {
- try
- {
- try2 mainClass = new try2(); // instantiate the class
- // Step 1: Connect to the Cognos services
- mainClass.connectToCognos(dispatcherURL);
- }
- catch(Exception e)
- {
- }
- }
- public void connectToCognos(String dispatcherURL)
- {
- ContentManagerService_ServiceLocator cmServiceLocator = new ContentManagerService_ServiceLocator();
- try
- {
- URL url = new URL(dispatcherURL);
- cmService = cmServiceLocator.getcontentManagerService(url);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
C:\Program Files\Java\jdk1.6.0_27\bin>java try2
Exception in thread "main" java.lang.NoSuchFieldError: RPC
at com.cognos.developer.schemas.bibus._3.ContentManag erServiceStub.<clin
it>(ContentManagerServiceStub.java:25)
at com.cognos.developer.schemas.bibus._3.ContentManag erService_ServiceLo
cator.getcontentManagerService(ContentManagerServi ce_ServiceLocator.java:43)
at try2.connectToCognos(try2.java:100)
at try2.main(try2.java:78)