Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Cannot call method "getDataConnector" error

I'm getting the error below. Is anyone familiar with it and can suggest some solutions? Thanks!  

 org.mozilla.javascript.EcmaError: TypeError: Cannot call method "getDataConnector" of undefined (CalculatedValueSkeleton.js#19)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3563)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3582)
    at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3601)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2160)
    at org.mozilla.javascript.gen.c253._c2(CalculatedValueSkeleton.js:19)
    at org.mozilla.javascript.gen.c253.call(CalculatedValueSkeleton.js)
    at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
    at org.mozilla.javascript.gen.c253._c3(CalculatedValueSkeleton.js:44)
    at org.mozilla.javascript.gen.c253.call(CalculatedValueSkeleton.js)
    at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
    at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
    at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)

0 votes

Comments

What were you trying to do when you got the error? Where does the error message appear?



2 answers

Permanent link
Hi David, Thanks for responding. I was invoking the getFilteredValueSet method from another class. I'm trying to find a way to return a calculated value and still use the HttpConnector. See code sample below.

dojo.provide("org.example.workitems.providers.CalculatedValueSkeleton");
dojo.require("com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters");

(function() {
var HttpConnectorParameters= com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters;

dojo.declare("myclass",null,{
               
        getFilteredValueSet: function(attributeId, workItem, context, filter) {
           
            var params= new HttpConnectorParameters();
            params.url= myURL;
            params.xpath= "//srnumber";
            params.columnXpaths= ["./nextnumber/@data"];
            params.columnIds= ["nextnumber"];
           
            var connector= context.getDataConnector("HttpConnector");
            var values= connector.get(params);
           
            var result= [];
            var srnumber = "";
            while(values.hasNext()){
                var entry= values.next();
                var nextsrnumber= entry.getById("nextnumber");
                if (nextsrnumber.indexOf(filter) > -1) {
                    result.push(nextsrnumber);
                    srnumber = nextsrnumber;
                }
            }
                 
              return srnumber;
        }     
       
       
});

dojo.declare("org.example.workitems.providers.CalculatedValueSkeleton", myclass, {

    constructor: function(attributeId, workItem, context, filter) {
   
            var srnvalue = new myclass();
            this.srnumber = srnvalue.getFilteredValueSet();
        },
       
    getValue: function(attributeId, workItem, configuration) {
       
        return this.srnumber;
       
    }
});
})();

0 votes


Permanent link
Hi Alicia,
are you able to get Connector Object, i am still getting "
getDataConnector" error"
.

Please help.

0 votes

Comments

Yes, I was able to get it to work. I imported myURL client certificate into the tomcat keystore.

Alicia

Hi Alicia,

Can you please elaborate on what you did to resolve this issue.. I have a similar requirement. I need to have a scripted calculated value that relies on a REST call (Data Connector).

Thanks.

Was anyone able to resolve this issue using the code provided in this thread.  The certificate issue I believe could be resolved by setting ignoreInvalidCertificates flag to "true" for params.  However, the context is still undefined and getConnectorData is failing.

I would appreciate any input on this.

Thanks.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 369

Question asked: Jun 21 '12, 2:52 p.m.

Question was seen: 5,887 times

Last updated: Sep 09 '13, 10:19 a.m.

Confirmation Cancel Confirm