4 Replies Latest reply on Nov 3, 2006 11:02 AM by Joerg Glandorf

    MBean and JNI access

    Joerg Glandorf Newbie

      I'm looking for some detailed information about calling Dlls from within MBeans using JNI. I currently experience class loading problems. Does somebody have some hints where exactly to put the wrapper jar and the Dll.
      I already modified run.bat to find the Dll (-Djava.library.path) i.e. the libs seems to be found, but I still unable to get an instance of any class.

      Is there any issue using System.LoadLibrary in Mbean's static initializer ?

      Thanks for any hints.

        • 1. Re: MBean and JNI access
          Elias Ross Master

          What's the error you see? What's your deployment layout?

          • 2. Re: MBean and JNI access
            Joerg Glandorf Newbie

             

            What's the error you see? What's your deployment layout?

            The Dll is in deploy/xxx/lib and I specify the lib dir in start.bat (-Djava.library.path)
            The wrapper jar I put into the sar.
            System.LoadLibrary() does not fail but when I want to access a class e.g in mbean's start I get a java.lang.UnsatisfiedLinkError
            So I wonder if someone has figured out some rules to do JNI in MBeans...


            • 3. Re: MBean and JNI access
              Morten Haavaldsen Newbie

              Hi,

              I have the same problem.

              A general question: SCOPING.... ?

              We have some java code which works as long as calling code is not scoped, but in default package.

              If we add classes to a scope package com.myscope;

              We get Unsatisdied link error....



              Remove scope and it works stand alone java app.



              In the MBean we make sure that code accessing the native is using same class loader as code loading JNI lib...


              But unsatisfied link error....

              Perhaps removing scope in MBean makes it work???


              Any ideas, folks?

              • 4. Re: MBean and JNI access
                Joerg Glandorf Newbie

                Thanks, scoping it my case seems to work.
                I added a <loader-repository> entry to my jboss-app.xml.
                The sar contains the wrapper jar for the Dll and the Dll itself is in deploy/xxx/lib.
                I hope I can use this as a rule from now on...