IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
Expand all | Collapse all

Using the Java Class Adapter to create a type tree

  • 1.  Using the Java Class Adapter to create a type tree

    Posted 03/05/06 01:33 PM

    Originally posted by: SystemAdmin


    Does anyone have any info on creating a type tree from a Java Class?

    The EJBs I'm trying to use were developed for a UNIX environment and the jar files have relative UNIX paths in them. The Importer Wizard seems to handle the UNIX directory separators when entering a fully qualified path but then displays an error message that it can't find the Java class definition for javax/ejb/EJBHome. I was advised I need the J2EE library. I had previously only installed JRE 1.4.2 (10) which did not seem to have the cited directory path. So I installed the J2EE SDK and now I can no longer generate the same error message. Now it says it can't find the initially entered class. Of course, I may have changed the ClassPath entry to cause that.

    I've defined the ClassPath dozens of times in various ways but nothing seems to be working. I'm assuming I only need to reference the directory where the jar files are located but I've also extracted the jar files and referenced the explicit full path.

    Any assistance would be greatly appreciated.

    Thanks.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 2.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/06/06 11:34 AM

    Originally posted by: SystemAdmin


    Here are my User & System Variables. If someone has a valid ClassPath definition, I'd like to see it. I'm unsure whether all jar files must be explicitly cited, whether spaces in directory or file names are a problem, and whether final backslashes are required in the CLASSPATH paths.

    PATH=C:\Program Files\Sun\AppServer\bin;C:\j2sdk1.4.2_10\bin;C:\j2sdk1.4.2_10\jre\bin
    J2EE_HOME=C:\Program Files\Sun\AppServer
    JAVA_HOME=C:\Program Files\Java\j2re1.4.2_10
    CLASSPATH:".;C:\Program Files\Java\j2re1.4.2_10\bin;C:\Program Files\Java\j2re1.4.2_10\lib;C:\Program Files\Sun\AppServer\lib\j2ee.jar; C:\Program Files\Sun\AppServer\lib;C:\XXXXX\jar;C:\XXXXX\jar\IPNSPOSReceiveServiceEJB-1.0.0.a2.jar"
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 12:53 AM

    Originally posted by: SystemAdmin


    I think you need to declare your JAR files in the mercator.ini/DSTX.ini file such as

    External Jar Files
    jar1=C:\J2sdkee1.3.1\lib\j2ee.jar
    jar2=F:\WEBLOGIC\weblogic.jar

    before the Launcher section
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 4.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 06:45 AM

    Originally posted by: SystemAdmin


    Thanks, Jan. I don't believe it makes a difference. I have the trace turned on in the DSTX.ini file as follows:
    code:1:dc5eae326a
    [JNI Layer Trace]
    switch=on
    file=JNI_LayerTrace.txt[/code:1:dc5eae326a]

    Examining it while varying the location of the jar entries, I have demonstrated to my satisfaction that whether the jar files are apecified in DSTX.ini or specified in the CLASSPATH system variable makes no difference in the ultimate definition of CLASSPATH except for the order of the entries.

    Currently, if I only enter the jar file containing the desired class in DSTX.ini, the Importer Wizard reports "Java.lang.NoClassDefFoundError: javax/ejb/EJBHome". Then when I add the path for the j2ee.jar file which contains EJBHome.class, the WIzard reports "Java.lang.NoClassDefFoundError: Originally Entered Class Name". The CLASSPATH entered via Windows Control Panel-->System-->Advanced-->Environment Variables-->System Variables is just "."

    Curious.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 5.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 07:14 AM

    Originally posted by: SystemAdmin


    Have you got the system variable

    J2EE_CLASPATH

    set up? I read in some documentation relating to JMS that this was needed.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 6.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 07:37 AM

    Originally posted by: SystemAdmin


    I hadn't seen that. I added "C:\Sun\AppServer\lib" to my CLASSPATH as well as J2EE_CLASSPATH but it didn't seem to have any effect.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 7.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 07:47 AM

    Originally posted by: SystemAdmin


    quote:5e1c419c75CLASSPATH:".;C:\Program Files\Java\j2re1.4.2_10\bin;C:\Program Files\Java\j2re1.4.2_10\lib;C:\Program Files\Sun\AppServer\lib\j2ee.jar; C:\Program Files\Sun\AppServer\lib;C:\XXXXX\jar;C:\XXXXX\jar\IPNSPOSReceiveServiceEJB-1.0.0.a2.jar"
    [/quote:5e1c419c75]

    Jim,
    Is this actually your classpath definition? if so it should be

    code:1:5e1c419c75CLASSPATH=C:\Program Files\Java\j2re1.4.2_10\bin;C:\Program Files\Java\j2re1.4.2_10\lib;C:\Program Files\Sun\AppServer\lib\j2ee.jar; C:\Program Files\Sun\AppServer\lib;C:\XXXXX\jar;C:\XXXXX\jar\IPNSPOSReceiveServiceEJB-1.0.0.a2.jar[/code:1:5e1c419c75]

    PS above variable should read J2EE_CLASSPATH
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 8.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 08:10 AM

    Originally posted by: SystemAdmin


    I changed my CLASSPATH so it now contains only "." The quotes are dropped when the CLASSPATH is defined. The current directory entry (.) should have no effect one way or the other. All the DSTX jar files are picked up with or without it according to the JNI_LayerTrace.txt file. I tried your entry exactly as you provided but nothing changed.

    I'm not clear at all what the Import Wizard needs to create a type tree. I can use the examples provided with the product to create a type tree but this real world example isn't working quite so well for me. Perhaps it is related to the UNIX pathing that seems to be part of the class name. Of course, my lack of knowledge of Java environments isn't helping either.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 9.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 08:32 AM

    Originally posted by: SystemAdmin


    Ah, I can't even get the example to work.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 10.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/07/06 08:53 AM

    Originally posted by: SystemAdmin


    Jan,
    In order to get the DSTX 8.0 Java Class Adapter examples to work all I had to do was define my CLASSPATH as C:\Ascential\DataStageTX_8.0\examples\adapters\javaclas. The map worked fine but I did find it was easy to muck things up. As long as I executed the map before generating new type trees with the importer or compiling class files or such, the map worked fine. Once I generated type trees or something, the map didn't work any longer. I'm not sure exactly what I did to screw up the example files but re-installing the example files got it working again each time it quit working.

    C:\Ascential\DataStageTX_8.0\examples\adapters\javaclas\result.txt:
    The result from function1 is : 2, the result from function2.1 is : A and the reference to the return value for the function2.2 is : Ref.21061094
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 11.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/08/06 01:04 AM

    Originally posted by: SystemAdmin


    Jim,
    I can get the map to run but can't get the Importer to work. what do you specify in the 'Fully qualified class name? Mine fails with
    Java.lang.NoClassDefFoundError:MainClass/class
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 12.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/08/06 05:38 AM

    Originally posted by: SystemAdmin


    I'm not clear on what "fully qualified" means either. Just leave off the ".class" and it should work fine.

    After spending way to much time on this, I believe I need to use the JCA Adapter for which there is no specific importer. It uses an XML format for it's package and the XML Schema Importer can be used.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 13.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/10/06 02:12 AM

    Originally posted by: SystemAdmin


    I think fully qualified refers to any package (namespace) definitions you have set up.

    SYSTEM CLASSPATH must be set before starting Type Tree designer (i.e. as you're doing it)
    CLASSPATH = c:\javaclasses

    classes are under c:\javaclasses\fileutils\zip (i.e. in a package hierarchy)

    and the actual class is unzipfile.class

    The fully qualified name is fileutils.zip.unzipfile

    You would put in the Type Tree importer "fileutils.zip.unzipfile"

    I found that I had to constantly shutdown one or other (or perhaps both) the type tree designer and map designer to ensure that the latest version of the class was picked up when creating the type tree and then running it via a map.

    Apologies if this is completely off topic, but thought it might be relevant.

    Jon
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 14.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/10/06 02:15 AM

    Originally posted by: SystemAdmin


    Thanks Jon, I'll give that a try.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 15.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/10/06 07:41 AM

    Originally posted by: SystemAdmin


    Jon, Thanks a million. Off-topic? I've been trying for two weeks to determine how to get the Java class importer to work. It never dawned on me to replace the forward slashes wirh periods. I edited "com/ipns/service/posreceive/ejb/IPNSPOSReceiveServiceBeanHome" to "com.ipns.service.posreceive.ejb.IPNSPOSReceiveServiceBeanHome" and now the importer works fine.

    I sure wish the documentation, Support or the Knowledgebase had the information you just provided. It would have saved me a lot of wasted efforts. Perhaps it is expected that anyone using the adapter knows Java and what to enter.

    I can confirm your suggestion. You absolutely have to stop and restart any Designers or Servers when you change the CLASSPATH variable.

    Thanks.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 16.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/10/06 09:14 AM

    Originally posted by: SystemAdmin


    No problem - glad it helped.

    Sorry didn't respond earlier, didn't twig what you were trying to do until I had time to read it properly.

    Do you do much with EJBs then? Do you use the SDK to do so? We're looking at implementing maps using the SDK and Java Classes to control maps, but have little Java (especially J2EE) experience. Any tips / advice would be gratefully received!?

    Cheers
    Jon
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 17.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/10/06 10:16 AM

    Originally posted by: SystemAdmin


    Jon,
    I'm trying to use an EJB to pass some data and return the EJB's response directly from a map rule in a map running under Event Server on a UNIX system.

    My previous client used the SDK & J2EE to call maps so I know people are doing what you plan to. Unfortunately, I have no Java experience and am just learning as I go along.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 18.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/25/09 03:40 PM

    Originally posted by: snutakki


    I am trying to get the JAVA adapter example to work in our UNIX environment.
    I did get it to work on the Desktop . Can anyone please help me to get it working on UNIX.
    For the example to work on UNIX do I need to change JNI settings in .ini file
    Should i add the jar files path to the .ini file ?? currently it is commented out.

    External Jar Files
    ;jar1=

    Any help is greatly appreciated.

    thanks,
    cai
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 19.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/25/09 05:36 PM

    Originally posted by: cemeinz


    Hello!

    Possible you get it running on your desktop (development environment), because the jar oder class file(s) where placed in a folder which was in the CLASSPATH.

    To make it available on runtime environment, you should enable the jar section you mentioned and place the path of the file including its name in the section. Additionally, enable the JNI section, because this can improve your findings regarding possible errors / issues.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 20.  Re: Using the Java Class Adapter to create a type tree

    Posted 03/26/09 11:14 AM

    Originally posted by: snutakki


    After adding the JAR files in the .ini file and uncommenting that line ( in our UNIX environment ) , I tried to run the sample provided by MERCATOR on UNIX and I am getting an error . Here is a excerpt from javatrace.log created when i ran the map. What do i need to fix this . Any help is greatly appreciated.

    <17039-077>: | | | | | | | | | Exception caught : class java.lang.reflect.InvocationTargetException
    <17039-077>: | | | | | | | | | Localized Message : null
    <17039-077>: | | | | | | | | | Message : null
    <17039-077>: | | | | | | | | | Stack trace :
    <17039-077>: | | | | | | | | | java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.ascentialsoftware.m4java.MAdapterImpl.invokeMethodsAndGenerateOutput(MAdapterImpl.java:993)
    at com.ascentialsoftware.m4java.MAdapterImpl.performClassOperation(MAdapterImpl.java:667)
    at com.ascentialsoftware.m4java.MAdapterImpl.get(MAdapterImpl.java:251)
    Caused by: java.lang.NullPointerException
    at MainClass.function1(MainClass.java:21)
    thanks,
    cai
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender