Re: encapsulate ATMI into JNI calls

Didier:
you may want to check out Anthomy Fryer's "TUX++", a C++ encapsulation
of the TUXEDO API from 1999 (includes a Visual C++ Proyect to build
the DLL), at
http://www.geocities.com/Pipeline/Dropzone/6294/tuxobjs/tuxoview.htm.
Best regards
Thomas
Marcin Kasperski <[email protected]> writes:
Didier Schmidt wrote:
Hello,
I try to encapsulate ATMI into JNI(Java) calls. I already done the coding workSeems you compete with BEA. If you succeed, you do not need to pay for
Jolt.
but my problem is that I need a dll on the C side
and that buildclient utility only generate an exe. Hmm. I live on Unix and I just do not use buildclient. The only thing
this command does in Unix environment is to append Tuxedo libraries to
command line.
I try to simulate what buildclient
does and translate it in order to
build a dll but the dll generated does not properly work.
In my
tpinit call, i have a TPEABORT message (could not commit transaction). In the
link step of buildclient utility there's
an "-implib BC-ab0.lib" option, and that "BC-ab0" string seems
to be generated dynamically and different each time you link. I think my pb is
related to this option. Does anybody have any idea what this option is? Well I
would appreciate any help on this issue.This file is probably the same each run. Just run buildclient, keep this
file (maybe rename it) and be happy. For buildserver there is an option
'-k' which causes the command to keep this file. You can try it...
http://www.mk.w.pl /
Marcin.Kasperski | Sztuczki i kruczki w C++:
@softax.com.pl | http://www.mk.w.pl/porady/porady_cplusplus
@bigfoot.com \--
| Thomas Ehren, Orden Integración S.A. ([email protected]) |
| Miraflores 388 P4, Santiago, Chile |

Thomas Ehren wrote:
>
Didier:
you may want to check out Anthomy Fryer's "TUX++", a C++ encapsulation
of the TUXEDO API from 1999 (includes a Visual C++ Proyect to build
the DLL), at
http://www.geocities.com/Pipeline/Dropzone/6294/tuxobjs/tuxoview.htm.
Best regards
ThomasUnfortunately, download link is broken on that page.
Did anyone download the stuff already, so it could be available
from other source ?
Dmitry.

Similar Messages

  • JNI Calling Java code when attaching to existing JVM

    I've got an Active/X that runs within IE, and also makes JNI calls (via the Invocation API) to Java code. Running within IE means there's already a JVM around, so I attach to it using JNI_GetCreatedJavaVMs
    This is fine. The problem is that I can't use the JNI findClass() to locate my Java classes, because I have no control over the classpath that the JVM is using to locate classes. The only solution I can think of so far is to either add my classes as part of the JVM, OR find out the classpath of the existing JVM (using System.getProperty("java.class.path") and copy my classes into that directory.
    Both solutions look ugly - anyone know of a cleaner way ?
    Mark.

    Toby, thanks for the reply.
    You're welcome.
    I notice from elsewhere on this forum, you're clearly a JNI expert.
    I've been known to work with it a little from time to time. =)
    My code has to work with JDK 1.1 so URLClassLoader is out. Writing my own classloader is fine, but how do I load it in the first place ? Is there something in JNI I've missed ?
    Possibly. Using DefineClass() you can load a class into the virtual machine, given it's byte-code. Now here's the tricky part. First, write your ClassLoader. It will be easiest if it doesn't rely on any other classes other than what is core to the JRE. Once you compile that classloader, you then need to include the bytecode as a resource in your executable/dll. Then, at runtime, you can load that resource, and use DefineClass to class-load it. Once you've class-loaded it, you can use NewObject, GetMethodID, CallXXXMethod, etc... to do the other class loading you need to do.
    Trust me, this really isn't as hard as it might sound.
    God bless,
    -Toby Reyelts
    As always, I recommend you check out the free, open-source JNI toolkit, Jace, at http://jace.reyelts.com/jace.

  • Local ref garbage collection within "nested" JNI calls

    I am using a JVM started in C++ to make calls to java classes. The C++ code makes JNI call into the JVM which instantiates a java class. The java class, in the course of execution, makes other JNI calls. All this happens on one thread of execution.
    What I am seeing is that local references from the native methods being called by the java class are not being released until the initial C++ native call exits. The JNI spec (text included below) seems to indicate there is registry of "nonmovable local references to Java objects" which "keeps the objects from being garbage collected". Is there only one such registry which does not get deleted until the initial C++ native call exits? If so, this would explain what I am seeing. How do I get around it?
    Thanks,
    Iztok
    From the JNI spec:
    "To implement local references, the Java VM creates a registry for each
    transition of control from Java to a native method. A registry maps nonmovable local references to Java objects, and keeps the objects from being garbage collected. All Java objects passed to the native method (including those that are returned as the results of JNI function calls) are automatically added to the registry. The registry is deleted after the native method returns, allowing all of its entries to be garbage collected."

    When I say "initial" I mean the initial C++ JNI call into a JVM running in a C++ process as shown in the pseudo code below. initNativeFunc() makes a call to Foo.doSomething() function which calls nativeFunc2 (another native function). Only a local reference to Retval was created in nativeFunct2, so when nativeFunct2 returns and the Retval is no longer used in Foo it should be a candidate for garbage collection. But this is not what happens. The Retval from nativeFunc2 is not being cleaned up until Foo.doSomething() returns. If I make the loop in Foo.doSomething() long enough, NewDoubleArray() returns a NULL when it runs out of memory.
    void initNativeFunc() {
    jclass clazz = env->FindClass("Foo");
    jmethodID mid = env->GetMethodID(clazz, "doSomething", "()V");
    env->CallVoidMethod(clazz, mid, ...);
    JNIEXPORT jobject JNICALL nativeFunc2() {
    jclass clazz = env->FindClass("Retval");
    jmethodID mid = env->GetMethodID("Retval, "<init>", "()V");
    jobject retval= env->NewObject(clazz, mid);
    jdoubleArray da = env->NewDoubleArray(100000);
    jfieldID fid = ...
    env->SetObjectField(retval, fid, da);
    return retval;
    public class Foo {
    public native void nativeFunc2();
    public void doSomething() {
    for (int i = 0; i < 100; i++) {
    Retval retval = nativeFunc2();
    }

  • Wildcards in Classpath for JNI-Calls

    Is it possible to use wildcards in the classpath for KNI-Calls?
    I would like to use wildcard for jni-calls like for normal java-calls (java -classpath *.jar ...), but it is not working.
    JDK version is JDK 1.5.0 on Win32

    I would like to use wildcard for jni-calls like for normal
    java-calls (java -classpath *.jar ...), but it is not working.It would be the Shell, not Java doing the wildcard magic.
    You would have to do the globbing manually (or use any OS APIs, or 3rd party APIs).

  • Core dump on solaris 8/7 making JNI call.

    Hi,
    I am running solaris 8 and solaris 7 with Java 1.3.1. I have required solaris patches installed on the machine for java 1.3.1.
    From a C program I am making some JNI calls and when I run the program it core dumps at the very first JNI call. C program that make JNI calls are in a .so file.
    Same C code with Java 1.3.1 is running fine on window 2000, AIX 5.1, RedHat Advanced Server 2.1 and SuSE Enterprise Linux 7.
    Any help will be greatly appriciated.
    Thanks

    Hiya,
    Any resolution to this post , we have a native JNI call on a Websphere server running on Solaris 8 .. and same thing happening .. random core dump on the box ..
    No warning , no explanation
    Thanks so much for your help
    (btw . running Sun jvm 1.4.2_13)

  • Classpath for JNI call in NT4?

    ?I prepare MyClass for JNI call on iPlanet 6 running on NT. The corresponding DLL is put in WINNT\SYSTEM32. The classpath set in registry is updated too. But error "class not found. (no MyClass in java.library.path)" still occurs. Is there any work i miss? Please advise.?

    Hi,
    Can you check the Environment variable CLASSPATH ?, the application server's classpath found under Software/iPlanet->Application Server->6.0->Java using kregedit.
    Thanks & Regards
    Ganesh .R
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • Stack overflow in JNI call

    Hi,
    I am doing a wrapper with JNI for a Windows library of image compression. I have a test program running correctly in C. This program compress data and it can move a lot of memory. If I call this program from a JNI functions I obtain a JNI error:
    An unrecoverable stack overflow has occurred.
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_STACK_OVERFLOW (0xc00000fd) occurred at PC=0x5FF88497
    Function=unpack_data+0x189D7
    Library=C:\WINDOWS\system32\NCSEcw.dll
    This error is produce inside my compression library. I try to adjust the parameters (-Xms -Xmx -Xss) of the JVM but in any case before the process ends it shows this exception. I have done other JNI interfaces and I never found with this problem before. Can anybody help me?
    Thanks in advance.

    I found in this forum a piece of code with a same kind problem but It is simpler than mine. I have proved this program in Windows and it produce the same error. In Linux it runs but if I enlarge the array largebuf it ends with the same error. In Linux I can reserve until 2 MB (in windows +-256K). Is there any way to increase the stack size in a jni call?.
    #include <stdio.h>
    #include <jni.h>
    #include "test.h"
    int myprint2(int a, int b){
         char extrabuf[100];
         printf("got here next\n");
         extrabuf;
         return 0;
    int myprint(int a, int b){
         char largebuf[260000];
         printf("got here\n");
         myprint2(1,1);
         largebuf;
         return 0;
    JNIEXPORT jint JNICALL Java_test_init(JNIEnv *env, jobject obj){
         myprint(1,1);
         return 1;
    test.java
    public class test{
         public native int init();
         public static void main(String []args){
              new test();
         public test(){
              System.loadLibrary("Nat");
              System.out.println(this.init());
    }

  • JNI calls in an Applet

    Hi all,
    I have an applet that makes an JNI call to a DLL. The DLL is in a custom directory c:\testing\test.dll. Under the default JDK that ships with Windows 2000 it works fine when I do a
    System.loadLibrary("c:/testing/test");
    However, I've switch to the JDK 1.3 plugin and now I get an UnsatisfiedLinkError. If I move the file to c:\winnt\system32, it works fine. I've tried setting the "java.library.path" property to no avail.
    Anyone have any ideas, besides moving the dll to c:\winnt\system32?
    thx.
    Mike

    the solution was to use System.load instead of System.loadLibrary

  • How do i turn a ringtone into a call tone

    how do i turn a ringtone into a call tone

    Settings---> Sounds---> Ringtones---> select the tone you want.
    KOT

  • Creating JVM to Make JNI calls

    I am trying to create a JVM to make JNI calls to Java. When I try to link my C++ program with jvm.lib, I am getting following error. Please advise.
    "fatal error LNK1106: invalid file or disk full"
    I am sure the disk is not full.

    What IDE are you using? I am using MS VC++ 5.0 with jdk 1.3 and I got the same error. After trying several things (including recreating my project)I realized that jdk 1.3 was created after VC++ 5.0. So on a wild hunch I installed jdk 1.2.2. I then removed all project referrences to jdk 1.3. Closed all my files. Reopend them. Made sure the jni.h external dependency was pointing to 1.2.2 (you may have to do a build to force it) and then everything linked fine.

  • JNI call CallLongMethod causes gpf

    Hi,
    I am using the JNI call CallLongMethod to return a jlongArray.
    jlongArray itemArray = (jlongArray)env->CallLongMethod(jObjFilterCondition, JavaIDs::_mids[JMETHOD_FI_GETALLVALUES]);
    Here method id is cached and it was retrieved as follows:
    env->GetMethodID (env->FindClass("com/fujitsu/pureweb/valueobjects/FilterItem"), "getAllValues", "()[J");
    After this if I try to call GetLongArrayElements(), it results in gpf. This occurs only in Solaris (compiler used is cc 5.0 and JDK 1.3.1_02. The problem does not occur in Windows.
    What can be possible reason for this?
    *** Interestingly, if I replace CallLongMethod with CallIntMethod, it works!!!!!!
    Regards,
    Harish

    If you are trying to get a reference to an array, then you are using the wrong JNI subroutine. An array is an object, and you have to use CallObjectMethod...

  • JNI Calling  a multithreaded C code from Java

    Hi,
    I am new to JNI . I am calling a multithreaded C (in which threads are created at runtime )code from a Java application (swing) on some event . The application crashes and it says "pthreads mutex_lock()". I have added -pthread as a command line argument .But even this does not help although the build is proper .It crashes at runtime .All other JNI calls are working perfectly ...
    Please help .
    Thanks in advance ...
    Regards
    Rohit

    Are any of those threads calling java code? If yes then are you calling the Attach method?

  • JNI call to WIN2K3/OracleAS

    Here is problem faced by one of my collegue, any help is appreciated.
    We are facing problems with handling Oracle 10G AS java security.
    Due to business needs we have to make a JNI call to the underlying OS (Win2K3) and invoke an executable (.EXE). During this call, the App Server hangs the requested executable further killing it using Dr.Watson and taking javaw to 100%. This is observed only in production environment and not in the development environment using JDeveloper. We feel that it is a App Server policy or Sandbox issue.

    Here is problem faced by one of my collegue, any help is appreciated.
    We are facing problems with handling Oracle 10G AS java security.
    Due to business needs we have to make a JNI call to the underlying OS (Win2K3) and invoke an executable (.EXE). During this call, the App Server hangs the requested executable further killing it using Dr.Watson and taking javaw to 100%. This is observed only in production environment and not in the development environment using JDeveloper. We feel that it is a App Server policy or Sandbox issue.

  • Step into method- call the same method (bermuda triangle)

    I don't know why but I have:
    step into method1-> call the same method1->step into method1-> call the same method1->step into method1-> call the same method1 and so on.
    Off course, the result is error "stack over flow".
    public Object getObject(Object o, String msg) {
              Object object = null;
              if (o instanceof Center) {
                   object = this.getObject((Center) o, msg);
              if (o instanceof Student) {
                   object = this.getObject((Student) o, msg);
              if (o instanceof Curriculumn) {
                   object = this.getObject((Curriculumn) o, msg);
              if (o instanceof Course) {
                      System.out.println("YAHOO!");
                object = this.getObject((Course) o, msg);
                   System.out.println("google");                                // no google
              return object;
    public Object getObject(Curriculumn curriculumn, String msg) {
              Object object = null;
              if(msg.equals("Author")) {
                   String s = new String();
                   curriculumn.setAuthor(s);
                   return s;
              if(msg.equals("CurriculumTitle")) {
                   String s = new String();
                   curriculumn.setTitle(s);
                   return s;
              if(msg.equals("RevisionDate")) {
                   String s = new String();
                   curriculumn.setRevisionDate(this.stringToCalendar(s));
                   return s;
              if(msg.equals("id")) {
                   String s = new String();
                   s ="0";                                     //dfsfsdfsd_____________0
                   curriculumn.setId(Integer.parseInt(s));
                   return s;
              if(msg.equals("Course")) {
                   Course course = new Course();
                   curriculumn.addCourse(course);
                   return course;
              return object;
         public Object getObjest(Course course, String msg) {
              Object object = null;
              if(msg.equals("RevisionDate")) {
                   String s = new String();
                   course.setRevisionDate(this.stringToCalendar(s));
                   return s;
              if(msg.equals("Author")) {
                   String s = new String();
                   course.setAuthor(s);
                   return s;
              if(msg.equals("Task")) {
                   Task task = new Task();
                   course.addTask(task);
                   return task;
              if(msg.equals("id")) {
                   String s = new String();
                   s = "0";                             //dfsdfffffffff______________________--3
                   course.setId(Integer.parseInt(s));
                   System.out.println("MESSAGE in id COurse"); ///9009090909
                   return s;
         if(object==null) System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");     
         return object;
         } The problem is that getObject((Curriculumn curriculumn,...) works well, but getObject((Course course, ) not.
    The out put is
    Yahoo
    Yahoo
    Yahoo
    and so on... it does not print google

    You forgot to use the @Overload
    annotation.
    Err.. @Override ?Won't work here :):-( Obviously I'm missing the point!There isn't one :)

  • How to create MAC JNI call to launch the native email client

    How to write JNI code to call native default email client on MAC OSX and add attachment in that email client. Thanks plz help in this regard.

    Which suggests that you want to open the actual email client, rather than using java itself to send the email.
    However it doesn't answer why.
    At any rate that requires the following.
    1. A platform specific way to run the email client. If you can't figure out how to do this from the command line (nothing to do with java) then you can't do it in java.
    2. A way to manipulate an application that is running. The Robot package is intended for that. It might or might not do it. If not then you would need to find or create something else to do this.
    3. Custom scripts for each possible email client which is fed into part 2 to make it do something.
    Obviously a lot of work especially the last as that part might vary not only by vendor by also by version and user configuration.

Maybe you are looking for