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

Error On Sample SDK java

Started by dmk.3678, 04 Aug 2015 04:35:42 PM

Previous topic - Next topic

dmk.3678

Hi,

I am getting the below error when i try to run the PermissionsGUI.java

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
   at Security.Logon.getNamespaces(Logon.java:524)
   at Security.Logon.logon(Logon.java:157)
   at PermissionsGUI.PermissionsUI.main(PermissionsUI.java:245)

Can someone please help on this ?
i am getting this error on all java files where Logon class has been imported and used.

dmk.3678

Quote from: dmk.3678 on 04 Aug 2015 04:35:42 PM
Hi,

I am getting the below error when i try to run the PermissionsGUI.java

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
   at Security.Logon.getNamespaces(Logon.java:524)
   at Security.Logon.logon(Logon.java:157)
   at PermissionsGUI.PermissionsUI.main(PermissionsUI.java:245)

Can someone please help on this ?
i am getting this error on all java files where Logon class has been imported and used.

Andrew Weiss

Dmk,

Can you post the file or the code please

Andy.
MetaManager makes administering IBM Cognos a breeze.  http://www.bspsoftware.com/MetaManager

dmk.3678

Quote from: Andrew Weiss on 05 Aug 2015 10:32:51 AM
Dmk,

Can you post the file or the code please

Andy.

Andrew,

I figured it out. But thanks for the reply.

dmk.3678

Quote from: dmk.3678 on 05 Aug 2015 02:30:13 PM
Andrew,

I figured it out. But thanks for the reply.


Andrew Sorry for wrong reply last time. Its still not working. I am attaching My code file.

Please help. Getting the same error again and again.

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
   at Logon.getNamespaces(Logon.java:524)
   at Logon.logon(Logon.java:153)
   at DispatcherUI.main(DispatcherUI.java:573)

Andrew Weiss

Dmk,

It's going to be hard to give you a solution but I can give you some more information about what's supposed to happen and perhaps you can figure out what's different in your environment.

At the bottom I've pasted a sample XML response that the GetNamespaces method is parsing.  This is what it's supposed to look like, I believe yours is different.

You're failing on this line:
if (dob[i+1].getName().equalsIgnoreCase(("CAMNamespaceDisplayName")))

dob is the node for the CAMNamespace.  We know that it is there because we passed a check on line 506.
dob[i+1] is supposed to be the CAMNamespaceDisplayName node (example below) which can be expected if the first node is CAMNamespace.  I believe that this is missing, in fact you only have the CAMNamespace node, nothing else.  Hence the Index error when you try to index [i+1].

The next thing to look at is your configuration.  How many namespaces do you have set up and what are they?


There is another thing you can do which is a workaround, not a solution.

Replace this code:
if (dob[i+1].getName().equalsIgnoreCase(("CAMNamespaceDisplayName")))
{
   namespaces = new String[2];
   namespaces[0] = dob[i+1].getValue();
   namespaces[1] = dob[i].getValue();
}else
{
   namespaces = null;
  }


With this:
   namespaces = new String[2];
   namespaces[0] = dob[i].getValue();
   namespaces[1] = dob[i].getValue();


This will show the Namespace ID as the ID and Display Name.  Perhaps this can also help you uncover the real issue.


--- SAMPLE NAMESPACES RESPONSE ---

              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">hidden</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMNamespace</name>
                <value xsi:type="xsd:string" xml:space="preserve">OpenDJ</value>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">display</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMNamespaceDisplayName</name>
                <caption xsi:type="xsd:string" xml:space="preserve">Namespace:</caption>
                <value xsi:type="xsd:string" xml:space="preserve">OpenDJ</value>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">text</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMUsername</name>
                <caption xsi:type="xsd:string" xml:space="preserve">User ID:</caption>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">textnoecho</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMPassword</name>
                <caption xsi:type="xsd:string" xml:space="preserve">Password:</caption>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">hidden</type>
                <name xsi:type="xsd:string" xml:space="preserve">h_CAM_action</name>
                <value xsi:type="xsd:string" xml:space="preserve">logonAs</value>
              </item>




Good Luck!
-Andy
MetaManager makes administering IBM Cognos a breeze.  http://www.bspsoftware.com/MetaManager

dmk.3678

Quote from: Andrew Weiss on 11 Aug 2015 08:52:10 AM
Dmk,

It's going to be hard to give you a solution but I can give you some more information about what's supposed to happen and perhaps you can figure out what's different in your environment.

At the bottom I've pasted a sample XML response that the GetNamespaces method is parsing.  This is what it's supposed to look like, I believe yours is different.

You're failing on this line:
if (dob[i+1].getName().equalsIgnoreCase(("CAMNamespaceDisplayName")))

dob is the node for the CAMNamespace.  We know that it is there because we passed a check on line 506.
dob[i+1] is supposed to be the CAMNamespaceDisplayName node (example below) which can be expected if the first node is CAMNamespace.  I believe that this is missing, in fact you only have the CAMNamespace node, nothing else.  Hence the Index error when you try to index [i+1].

The next thing to look at is your configuration.  How many namespaces do you have set up and what are they?


There is another thing you can do which is a workaround, not a solution.

Replace this code:
if (dob[i+1].getName().equalsIgnoreCase(("CAMNamespaceDisplayName")))
{
   namespaces = new String[2];
   namespaces[0] = dob[i+1].getValue();
   namespaces[1] = dob[i].getValue();
}else
{
   namespaces = null;
  }


With this:
   namespaces = new String[2];
   namespaces[0] = dob[i].getValue();
   namespaces[1] = dob[i].getValue();


This will show the Namespace ID as the ID and Display Name.  Perhaps this can also help you uncover the real issue.


--- SAMPLE NAMESPACES RESPONSE ---

              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">hidden</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMNamespace</name>
                <value xsi:type="xsd:string" xml:space="preserve">OpenDJ</value>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">display</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMNamespaceDisplayName</name>
                <caption xsi:type="xsd:string" xml:space="preserve">Namespace:</caption>
                <value xsi:type="xsd:string" xml:space="preserve">OpenDJ</value>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">text</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMUsername</name>
                <caption xsi:type="xsd:string" xml:space="preserve">User ID:</caption>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">textnoecho</type>
                <name xsi:type="xsd:string" xml:space="preserve">CAMPassword</name>
                <caption xsi:type="xsd:string" xml:space="preserve">Password:</caption>
              </item>
              <item xsi:type="bus:displayObject">
                <type xsi:type="xsd:string" xml:space="preserve">hidden</type>
                <name xsi:type="xsd:string" xml:space="preserve">h_CAM_action</name>
                <value xsi:type="xsd:string" xml:space="preserve">logonAs</value>
              </item>




Good Luck!
-Andy


Andrew,

I have 2 NameSpaces configured, one is cognos (Which comes default with BI) and another which is mentioned in my java code (Its a Custom Java Provider)

Andrew Weiss

Ah hah! That there's your problem.  The Customer Authentication Provider provides the prompt information to the Logon Screen.  The sample logon scripts that IBM ships assume that you're following the standard that there's a namespace id, namespace name, username and password.  With a customer provider it's up to you to provide this information or something different.  You'll need to modify the script to match what the custom authentication provider actually uses to authenticate (which may not be a username and password).  At this point you're working on something custom so I'm not sure that there's much more I can provide. However if you want to consider using our MetaManager API as opposed to the Cognos SDK I think yo will find more success with working with Custom Authentication Providers.  We have full support custom authentication providers.   You can find some more information and example MetaManager API Scripts here: http://www.bspsoftware.com/products/metamanager/api/

Thank you,
-Andy
MetaManager makes administering IBM Cognos a breeze.  http://www.bspsoftware.com/MetaManager