Discussion:
Custom Adapter For Test Operation
(too old to reply)
Noah B
2018-04-13 18:11:04 UTC
Permalink
Hi All,

I am trying To do a custom adapter for Test operation from ISIM to my TDI for DB2. So on my Default on Error hook I tried to write this code:

work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL));

and gave me, CTGDIS181E Error while evaluating Hook 'Default On Error' in the Component 'JDBCConnector' (JDBCConnector.default_fail).
com.ibm.jscript.InterpretException: Script interpreter error, line=19, col=24: Cannot convert JavaPackageObject to java.lang.String.

Any help much appreciated.

Thanks,
yn2000
2018-04-16 17:03:33 UTC
Permalink
Hi Noah,
I am not sure why you choose to use UNSUCCESSFUL code, instead of SUCCESSFUL code for your test operation. But, then there are so many missing information on your post neither, which generate more questions, such as:
- Where do you see the error? In TDI Console or in TIM Console?
- Have you install RMI dispatcher?
- Have you import the package, such as importPackage(Packages.com.ibm.di);?
and so on.

Rgds. YN.
Noah B
2018-04-16 17:14:15 UTC
Permalink
Post by Noah B
Hi All,
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL));
and gave me, CTGDIS181E Error while evaluating Hook 'Default On Error' in the Component 'JDBCConnector' (JDBCConnector.default_fail).
com.ibm.jscript.InterpretException: Script interpreter error, line=19, col=24: Cannot convert JavaPackageObject to java.lang.String.
Any help much appreciated.
Thanks,
Hi YN,

Thanks for your reply. Yes you're right I might have not posted enough info..

Am using my OnError hook to identify whenever my test operation is not Succesful it will display it.Here is my code.

work.removeAllAttributes();
work.setProperty(
Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new java.lang.Integer(
Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL
)
);
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.REASONCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Reason.PROCESSING_ERROR));

work.setProperty(Packages.comPackages.java.lang.Integer.ibm.di.dispatcher.Defs.REASON_MESSAGE,
DispatcherReasonMessage.ADAPTER_SRCH_FAILED);

var v = new Packages.java.util.Vector();
v.add("[Lookup Error] Lookup Entry Unsuccesful : " + error.toString());
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.REASON_MESSAGE_ARGS, v);

fLogMessage("ERROR", "[Lookup Error] Lookup Entry Unsuccessful " + error.toString());

var e = new Packages.com.ibm.di.exception.ITDIAgentException("");
e.setEntry(work);
throw e;


Also for the SUCCESFUL message i will use Override ADD hook to get the message.
I would like to see the error or suuccess in either TDI or TIM.
I have imported all the packages as you said, But isn't RMI already installed, if not how do i install it and does my error has anything to do with the RMI dispatcher.

Thanks for your help.

Noah,
Enio Padilla
2018-04-17 13:24:57 UTC
Permalink
Post by Noah B
Post by Noah B
Hi All,
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL));
and gave me, CTGDIS181E Error while evaluating Hook 'Default On Error' in the Component 'JDBCConnector' (JDBCConnector.default_fail).
com.ibm.jscript.InterpretException: Script interpreter error, line=19, col=24: Cannot convert JavaPackageObject to java.lang.String.
Any help much appreciated.
Thanks,
Hi YN,
Thanks for your reply. Yes you're right I might have not posted enough info..
Am using my OnError hook to identify whenever my test operation is not Succesful it will display it.Here is my code.
work.removeAllAttributes();
work.setProperty(
Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new java.lang.Integer(
Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL
)
);
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.REASONCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Reason.PROCESSING_ERROR));
work.setProperty(Packages.comPackages.java.lang.Integer.ibm.di.dispatcher.Defs.REASON_MESSAGE,
DispatcherReasonMessage.ADAPTER_SRCH_FAILED);
var v = new Packages.java.util.Vector();
v.add("[Lookup Error] Lookup Entry Unsuccesful : " + error.toString());
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.REASON_MESSAGE_ARGS, v);
fLogMessage("ERROR", "[Lookup Error] Lookup Entry Unsuccessful " + error.toString());
var e = new Packages.com.ibm.di.exception.ITDIAgentException("");
e.setEntry(work);
throw e;
Also for the SUCCESFUL message i will use Override ADD hook to get the message.
I would like to see the error or suuccess in either TDI or TIM.
I have imported all the packages as you said, But isn't RMI already installed, if not how do i install it and does my error has anything to do with the RMI dispatcher.
Thanks for your help.
Noah,
Hi Noah,

In order for this to work you need to install the RMI dispatcher on the TDI server where you're running the adapter.
yn2000
2018-04-17 16:00:40 UTC
Permalink
Hi Noah,
Here are some background of the story.
You have to install RMI dispatcher (for example part number: CNMH1ML) in the TDI server and you have to run it. Then your custom adapter have to be constructed into a profile and import it into the ISIM system. Please also note that at this point in time, your custom adapter is stored in the ISIM repository, not in TDI server. So, when you perform a Test connection from ISIM console, the ISIM system sends your test AL (yes, the whole test AL) to the TDI server (where RMI is waiting for it) and run it there. The RMI using a technique called Task Call Block (TCB) to run your AL. So, with this concept, technically, you cannot (or should not) open TDI console, independently run your test AL, and expect a success, because you are missing the TCB component. In other words, if you can run your test AL independently via TDI console, then your test AL will not work in real adapter installation. (It's either-or situation. That is why I asked where you see the error. If you see the error from TDI console, then I can determine that you are in the wrong path.)
HTH. YN.
Noah B
2018-04-16 17:20:13 UTC
Permalink
Post by Noah B
Hi All,
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL));
and gave me, CTGDIS181E Error while evaluating Hook 'Default On Error' in the Component 'JDBCConnector' (JDBCConnector.default_fail).
com.ibm.jscript.InterpretException: Script interpreter error, line=19, col=24: Cannot convert JavaPackageObject to java.lang.String.
Any help much appreciated.
Thanks,
Or What would be the best way or Hook to write my SUCCESFUL status code to and Mode of the connector?
Noah B
2018-04-17 15:40:11 UTC
Permalink
Post by Noah B
Hi All,
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL));
and gave me, CTGDIS181E Error while evaluating Hook 'Default On Error' in the Component 'JDBCConnector' (JDBCConnector.default_fail).
com.ibm.jscript.InterpretException: Script interpreter error, line=19, col=24: Cannot convert JavaPackageObject to java.lang.String.
Any help much appreciated.
Thanks,
Hey Enio,

Yes I have already installed RMI, is there any configration that I need to do after that, I am getting same error. I feel like am missing some configuration after installation.

Thanks,
Noah B
2018-04-17 16:51:01 UTC
Permalink
Post by Noah B
Hi All,
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL));
and gave me, CTGDIS181E Error while evaluating Hook 'Default On Error' in the Component 'JDBCConnector' (JDBCConnector.default_fail).
com.ibm.jscript.InterpretException: Script interpreter error, line=19, col=24: Cannot convert JavaPackageObject to java.lang.String.
Any help much appreciated.
Thanks,
Hey YN,

Thanks for the detailed explanation of the process. Yes I get what you saying which is perfectly clear.
What I am having is an exception in my TDI when building my AL is => Cannot convert JavaPackageObject to java.lang.String on
work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE,
new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.UNSUCCESSFUL)); ,
Which I have no idea why its doing that and couldnt find a clear answer to that.

Thanks much,

Noah
yn2000
2018-04-18 15:15:49 UTC
Permalink
Hi Noah,

You said "...Yes I get what you saying which is perfectly clear...", but you also said "...an exception in my TDI when building my AL..." It sounds that you did not get what I said... clearly. I said "...you cannot (or should not) open TDI console, independently run your test AL, and expect a success..."

Here is some explanation...
First, the RMI Dispatcher code, when you run it, it establishes some environment configuration where the standard/default TDI Console will not do. Unfortunately, the later version of the RMI Dispatcher code is hidden, so that you cannot easily break down on what this code is exactly doing. Once again, the one that run Packages.com.ibm.di should be the RMI, not you via TDI Console.
Second, the code Packages.com.ibm.itim.remoteservices is designed to return a message to the caller, which is the itim.remoteservices (an internal RMI communication, so to speak), not for us to see (interact) in TDI environment.
Third, this RMI Dispatcher code/communication was not design to solicit communication into the ISIM. It is a listening service, which is a different design than the TDI Datafeed 'push' processing design.

So, could you please please please try what I said "...your custom adapter have to be constructed into a profile and import it into the ISIM system..." and test it from ISIM console?

Rgds. YN.

Loading...