7 Replies Latest reply on Mar 7, 2002 9:56 PM by Steve RInn

    jca/jni packaging?

    Steve RInn Newbie

      I've built a simple JNI adapter that makes C++-based JNI calls. I've packaged the C++ .dll/.so in my deployed rar file--this technique is described in the "packaging" chapter of Sharma's JCA book.

      When I run, though, I get:

      [ERROR,JniTest] TRANSACTION ROLLBACK EXCEPTION:
      javax.transaction.TransactionRolledbackException: no TestDll in java.library.path; nested exception is:
      java.lang.UnsatisfiedLinkError: no TestDll in java.library.path
      java.lang.UnsatisfiedLinkError: no TestDll in java.library.path

      Obviously, if I put the .dll/.so somewhere in my java.library.path, things work fine. But I'd really like it to find the DLL in my .RAR file. Does anyone know how I might get this to work?

      thanks,
      s.

        • 1. Re: jca/jni packaging?
          David Jencks Master

          This is not supported in any version of jboss currently, sorry. As far as I know, even if and when we do get deployment of native libraries to work, you still won't be able to redeploy them.

          If you have much experience with native libraries would you consider writing a patch for this? IMO it will be easier for jboss 3, the deployment structure is a little simpler. Either version, it should involve just a few lines in RARDeployer. If you'd like more specific pointers on where to look let me know.

          thanks
          david jencks

          • 2. Re: jca/jni packaging?
            David Jencks Master

            I added native library deployment over the weekend to jboss 3 (cvs). I don't have a very good test. Could you check and see if it works with your adapter?

            Thanks
            david jencks

            • 3. Re: jca/jni packaging?
              Hans Newbie

              My colleague just tried to use SLSB to call a native method in a helper class.
              We found that if we don't put the helper class in any package,we can avoid the exception and call the native method sucessfully.

              • 4. Re: jca/jni packaging?
                David Jencks Master

                What?? Is the native lib in a package? If the helper class isn't in any package anywhere how does jboss or your code know about it? Please explain what you did that does work and what doesn't work.

                Thanks

                • 5. Re: jca/jni packaging?
                  Martin Kuhn Newbie

                  What is the right way to do this?
                  When I have to deal with JNI in EJB-context what I have to do to get no error?

                  • 6. Re: jca/jni packaging?
                    David Jencks Master

                    The only way I actually got to work was to put the native lib in with the java native libs so it would be loaded at vm startup. I've never succeeded in dynamically loading a native library and having it usable. However, others have, and are working on making this available in jboss.

                    • 7. Re: jca/jni packaging?
                      Steve RInn Newbie

                      Sorry I didn't respond to your earlier mail, David. I've been out on vacation for a week or so.

                      I got the native library to work (on NT, at least) by putting the DLL containing the native code in the path and loading it during static initialization of the class containing the native code.

                      s.