Groups > IBM > IBM Tivoli Directory Integrator > Re: Question with using external Java class in TDI 6.0




Re: Question with using external Java class in TDI 6.0

Re: Question with using external Java class in TDI 6.0
Tue, 12 Feb 2008 17:00:59 +030
"I tried to remove the importPackage and importClass statement, and to
have
var el = new come.support.some();
It returned "come not defined"."
Hi, you have a mistake : not "comE.support.some();"

try to:

var el = new com.support.some(); 

Post Reply
Re: Question with using external Java class in TDI 6.0
Tue, 12 Feb 2008 21:32:14 +010
In 6.0 you must prefix the package/classname with
"Packages":

    var el = new Packages.come.support.some();

 From 6.1 (with the IBM JSEngine) you don't need this
prefix anymore.

Hope this helps.

-Eddie

Alex P wrote:
> "I tried to remove the importPackage and importClass statement, and to
have
> var el = new come.support.some();
> It returned "come not defined"."
> Hi, you have a mistake : not "comE.support.some();"
> 
> try to:
> 
> var el = new com.support.some(); 
> 
Post Reply
Question with using external Java class in TDI 6.0
Tue, 12 Feb 2008 23:52:19 +080
Hi,

I wrote a java class which simply looks through a text file and return 
message using the log4j. I created a jar file, and put it into <IDI 
home>/jars/ directory.  In the slolution.properties file, I have: 
com.ibm.di.loader.userjars=C:\Program 
Files\IBM\IBMDirectoryIntegrator\jars\some.jar

In the Scripts node, I created a script with the following function:

importPackage(Packages.com.support);
importClass(Packages.com.support.some);

function test( ) {
 var el = new some( );
 task.logmsg("pass constructor...");
 el.getLibFile( ); //should return the content
}

However, it always returns "Script execution failed undefined: undefined is

not a function" after initializing the constructor method.
I thought it's because it couldn't find the getLibFile( ) method, or the 
method contains methods that TDI couldn't resolve, so I modified 
getLibFile( ) to do nothing but return a simple String value.  The same 
error message returned again.

I tried to remove the importPackage and importClass statement, and to have
var el = new come.support.some();
It returned "come not defined".

Any suggestion? This is TDI6.0. Thank you!

Post Reply
Re: Question with using external Java class in TDI 6.0
Tue, 12 Feb 2008 23:56:43 +080
I'm also wondering if it has anything to do with the conflict that may be 
caused by the existing log4j in TDi and the one I called in my java class. 
Because in my constructor method, I have logger.info("initialized");
but 
"initialized" string was not printed anywhere. not in ibmdi.log, not
in the 
console, not in the TDI Config editor output window.

Regards,
YF



"yf" <vrcat101@gmail.com>
дÈëÏûÏ¢ÐÂÎÅ:fos8b4$1ug2a$1@news.boulder.ibm.com...
> Hi,
>
> I wrote a java class which simply looks through a text file and return 
> message using the log4j. I created a jar file, and put it into <IDI 
> home>/jars/ directory.  In the slolution.properties file, I have: 
> com.ibm.di.loader.userjars=C:\Program 
> Files\IBM\IBMDirectoryIntegrator\jars\some.jar
>
> In the Scripts node, I created a script with the following function:
>
> importPackage(Packages.com.support);
> importClass(Packages.com.support.some);
>
> function test( ) {
> var el = new some( );
> task.logmsg("pass constructor...");
> el.getLibFile( ); //should return the content
> }
>
> However, it always returns "Script execution failed undefined:
undefined 
> is not a function" after initializing the constructor method.
> I thought it's because it couldn't find the getLibFile( ) method, or the 
> method contains methods that TDI couldn't resolve, so I modified 
> getLibFile( ) to do nothing but return a simple String value.  The same 
> error message returned again.
>
> I tried to remove the importPackage and importClass statement, and to have
> var el = new come.support.some();
> It returned "come not defined".
>
> Any suggestion? This is TDI6.0. Thank you!
>
> 

Post Reply
about | contact