Calling a third-party library from JNI-enabled C++ code

Hi everyone,
I have some existing C++ application code that extracts data from a file in a special format (HDF5). This code uses a static library (third party) to decode the file format. I would like to wrap this application code in a JNI wrapper so that I can call the code from Java. So I have a situation like this:
Java front end -> application code (C++) -> static library (C++)
I have compiled JNI headers and modified the application code accordingly. I created a shared library by bundling the application code together with the static library (using gcc 3.2.2 on Red Hat Linux 9):
g++ -shared hdf5_jni.cc -o libhdf5_jni.so -I<include path> -L<static library path> -lhdf5
(the <static library path> contains the static library libhdf5.a). This creates a shared library which contains the application code and the relevant bits of the static library.
When I call the Java front end, the shared library (libhdf5_jni.so) is correctly found and accessed. However, I get an UnsatisfiedLinkError which I don't understand:
Exception in thread "main" java.lang.UnsatisfiedLinkError: <blah>/lib/libhdf5_jni.so: <blah>/lib/libhdf5_jni.so: undefined symbol: _Z4formPKcz
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
... etc
I have no idea what the undefined symbol "_Z4formPKcz" represents. It's not part of the application code or the static library.
Here's some more info that might help diagnosis:
1) The problem seems to be due to the approach of having a three-step process (Java code calling bespoke shared library which includes unmodified 3rd-party code). I get an identical error (including the mysterious "_Z4formPKcz" symbol) when trying to do something similar with a different 3rd-party static library.
2) When I simply have Java code calling C++ code which I have written myself (no calls to static library methods), I have no problems, i.e. there doesn't seem to be a problem with the way I set up the JNI wrappers or the application code, or in the way I create the shared library.
3) When I simply have C++ code calling the static libraries (i.e. no Java wrapper) I have no problems, i.e. there doesn't seem to be a problem with the application code or the static libraries.
4) The static libraries were compiled from source using the same compiler that I used to compile the application code.
5) I'm using J2SDK 1.4.2 on Red Hat Linux 9, although I've tried other versions of the SDK and had the same problem.
I've done a lot of web searches on the "_Z4formPKcz" symbol and have turned up absolutely nothing (zero Google hits!).
Any help would be very much appreciated.
Thanks, Jon

Thanks chrisswhite,
I should have mentioned that I tried this too and it didn't solve the problem. You're right though, I should be compiling with -fPIC anyway.
Jon

Similar Messages

  • Calling a third Party dll from java using JNI

    Hi
    I want an immediate help from u all.
    I have athird party c dll with .h and .lib file
    I wont be able to cahnge any thing in those files.
    I want to call the functions of that from my Java code.
    Ist possible to call the dll without writing any c or c++ wrapper over it?if yes , how to do it?

    Hi,
    You may use a generic wrapper like JNative.
    Commercial wappers also exists.
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                               

  • Error calling a third party WSDL from BPEL

    Hi,
    I am trying to invoke a third party WSDL. This WSDL belongs to Oracle OPPM. When I call this wsdl from SOAPUI or even from the Enterprise Manger, it works fine.
    However, when I call it from BPEL, it is giving me an error. Here is the request and error response:
    Request
    <messages>
    <input>
    <Login_Input>
    <part name="sUser">
    <sUser xsi:type="def:string">Username</sUser>
    </part>
    <part name="sPassword">
    <sPassword xsi:type="def:string">Password</sPassword>
    </part>
    <part name="lTimeOut">
    <lTimeOut xsi:type="def:int">10</lTimeOut>
    </part>
    </Login_Input>
    </input>
    Response
    <fault>
    <bpelFault>
    <faultType>0</faultType>
    <remoteFault>
    <part name="summary">
    <summary>Server was unable to read request. ---> There is an error in XML document (1, 2168). ---> <Login xmlns='http://tempuri.org/'> was not expected.</summary>
    </part>
    <part name="detail">
    <detail>oracle.j2ee.ws.client.jaxws.JRFSOAPFaultException: Client received SOAP Fault from server : Server was unable to read request. ---> There is an error in XML document (1, 2168). ---> <Login xmlns='http://tempuri.org/'> was not expected.</detail>
    </part>
    <part name="code">
    <code>{http://schemas.xmlsoap.org/soap/envelope/}Client</code>
    </part>
    </remoteFault>
    </bpelFault>
    </fault>
    <faultType>
    <message>0</message>
    </faultType>
    </messages>
    I checked the diagnostics logs and it is not giving me any further information.
    I think the issue is with the WSDL file. I tried importing the WSDL locally too, but I cannot get rid of this error.
    I also tried to import the namespace in the <WSDL:Types> area, but no luck.
    WSDL
    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions
         targetNamespace="http://tempuri.org/"
         xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
         xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
         xmlns:s="http://www.w3.org/2001/XMLSchema"
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
         xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
         xmlns:tns="http://tempuri.org/"
         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
         xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
         xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
        >
        <wsdl:types>
        </wsdl:types>
        <wsdl:message name="DebugSoapIn"/>
        <wsdl:message name="DebugSoapOut"/>
        <wsdl:message name="LoginSoapIn">
            <wsdl:part name="sUser" type="s:string"/>
            <wsdl:part name="sPassword" type="s:string"/>
            <wsdl:part name="lTimeOut" type="s:int"/>
        </wsdl:message>
        <wsdl:message name="LoginSoapOut">
            <wsdl:part name="Result" type="s:string"/>
        </wsdl:message>
        <wsdl:message name="ReleaseSecurityTokenSoapIn">
            <wsdl:part name="sSecurityToken" type="s:string"/>
        </wsdl:message>
        <wsdl:message name="ReleaseSecurityTokenSoapOut"/>
        <wsdl:message name="GetCurrentUserIDSoapIn">
            <wsdl:part name="sSecurityToken" type="s:string"/>
        </wsdl:message>
        <wsdl:message name="GetCurrentUserIDSoapOut">
            <wsdl:part name="Result" type="s:int"/>
        </wsdl:message>
        <wsdl:portType name="psPortfoliosSecurityRpcSoap">
            <wsdl:operation name="Debug">
                <wsdl:input message="tns:DebugSoapIn"/>
                <wsdl:output message="tns:DebugSoapOut"/>
            </wsdl:operation>
            <wsdl:operation name="Login">
                <wsdl:input message="tns:LoginSoapIn"/>
                <wsdl:output message="tns:LoginSoapOut"/>
            </wsdl:operation>
            <wsdl:operation name="ReleaseSecurityToken">
                <wsdl:input message="tns:ReleaseSecurityTokenSoapIn"/>
                <wsdl:output message="tns:ReleaseSecurityTokenSoapOut"/>
            </wsdl:operation>
            <wsdl:operation name="GetCurrentUserID">
                <wsdl:input message="tns:GetCurrentUserIDSoapIn"/>
                <wsdl:output message="tns:GetCurrentUserIDSoapOut"/>
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="psPortfoliosSecurityRpcSoap" type="tns:psPortfoliosSecurityRpcSoap">
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
            <wsdl:operation name="Debug">
                <soap:operation style="rpc" soapAction="http://tempuri.org/action/psPortfoliosSecurity.Debug"/>
                <wsdl:input>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:output>
            </wsdl:operation>
            <wsdl:operation name="Login">
                <soap:operation style="rpc" soapAction="http://tempuri.org/action/psPortfoliosSecurity.Login"/>
                <wsdl:input>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:output>
            </wsdl:operation>
            <wsdl:operation name="ReleaseSecurityToken">
                <soap:operation style="rpc" soapAction="http://tempuri.org/action/psPortfoliosSecurity.ReleaseSecurityToken"/>
                <wsdl:input>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:output>
            </wsdl:operation>
            <wsdl:operation name="GetCurrentUserID">
                <soap:operation style="rpc" soapAction="http://tempuri.org/action/psPortfoliosSecurity.GetCurrentUserID"/>
                <wsdl:input>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="encoded" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                </wsdl:output>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="psPortfoliosSecurityRpc">
            <wsdl:port name="psPortfoliosSecurityRpcSoap" binding="tns:psPortfoliosSecurityRpcSoap">
                <soap:address location="http://dc01oppmsv01.molina.mhc/ProSightSOAP/psPortfoliosSecurityRpc.asmx"/>
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    Thanks
    Asif Hussain

    Thanks chrisswhite,
    I should have mentioned that I tried this too and it didn't solve the problem. You're right though, I should be compiling with -fPIC anyway.
    Jon

  • Sending query to third party portal from TREX Search Engine

    HI Experts,
    we need to implement normal search option in SAP portal.
    when we search any thing from portal ,
    It has to search in EP & KM and also it has to search
    windows sharepoint portal and bring the data back to SAP Portal.
    For this purpose one solution is
    1) implementing  enterpise search,
       but my client dont want to go for enterprise search(federated search).
    2) The other way
    Sending query to third party portal from TREX Search Engine
    In this way what i want is ,
    how TREX can send query to third party portal SEARCH ENGINE
    (in my case share point portal search ENGINE).
    There is no problem to search in EP & KM becuse it is default.
    To search in Micro soft Share point portal,
    TREX should pass the query to share point portal search ENGINE.
    Is there any API TO send a query to third party portal like sharepoint?
    I searched in SDN and Other sites also but i am not getting exactly what I require.
    If any one has ideas or implemented already please guide me.
    My client require searching option like this,
    we need to provide drop down box in SAP Portal with 3 options like
    1) search in Share point portal
    2) search in SAP EP & KM
    3) Search in both the portals
    please provide any code samples in case if you have.
    please help me , its urgent
    Thanks in advance.
    Regards
    Bala

    Hi Bala,
    please check the information on the KM IMS (Index Management Service) in KMC's developer guide. A connection to a 3rd party search is done from KM, then calling TREX and XY in parallel, not serially from TREX.
    Here's a paper describing this for an older KM release:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5e514b57-0701-0010-3796-deb3636835fa
    Regards, Karsten

  • EjbCreate not completing when calling into third party JAR ?

    Hi
    Are there any limitations/restrictions on calling out to a third-party library within an ejbCreate method of a stateless session bean.
    I've set <initial-beans-in-free-pool> to 1 so that when I deploy the bean ejbCreate is invoked, but only the first System.out appears. The weblogic console shows the EJB deployment status as available, no stack traces of exceptions are shown.
       public void ejbCreate() {
            try {
                System.out.println(new Date() + " EJB XTestBeam ejbCreate invoked");
                searcher = new SearcherService();
                System.out.println(new Date() + " EJB XTestBean created SearchService " + searcher);
                System.out.println(new Date() + " EJB XTestBean ejbCreate completed ok");
            } catch (EJBException e) {
                e.printStackTrace();
                throw e;
            } catch (RuntimeException e) {
                e.printStackTrace();
                throw e;
            } catch (Exception e) {
                e.printStackTrace();
        }The environment is WLS 8.1 SP4, W2K, HotSpot Client VM 1.4.2_05.
    Rgs
    Erik

    Thanks chrisswhite,
    I should have mentioned that I tried this too and it didn't solve the problem. You're right though, I should be compiling with -fPIC anyway.
    Jon

  • Any third party library ?

    java can not fetch the System information. may be its a windows machine or may be its a linux machine. because they depend upon native. though JNI has given some access but that is tedious to do.
    I am looking for some third party library which can fetch the System information .
    Do you know any such third party library ?
    i need CPU and Memory information of the System.
    is there any third party library provides that ?

    does java 1.5 can help us in this regard ?
    i found
    In 1.5, you have the management beans. will it be of any use ?

  • How to use third party library (like .dll and .lib files) in flascc?

    I have a number of .dll and .lib files of the  third party library, which are generated from C++ code.
    I read about flascc on other web site says:
    "If you want to use third party library in your Flascc project,you must have either the source code or the linkable file which is compiled of the third party library   "
    Dose the linkable file mean .dll file or .lib file?
    AND
    How can I use the fuctions in them in my flascc project.?

    Native code is not interchangeable between platform.
    It means that you can't use library that wasn't build specifically for flascc.
    And when they say linkable files they mean libraries compiled for flascc, not any libraries.
    So if your libs are for windows, no luck, you have to recompile everything

  • How to raise customer invoice in case of third party sale from PS

    Dear All,
               In case of third party sale from project systems module, PR is raised which is further converted to PO and once the material reaches at client place GRN is done.Based upon the GRN the actual cost is booked to the project.How should I raise the customer invoice against the materials received by the customer?
    I went through the Forum and based upon the threads there, I came to know that one option is to  create sales order for the same items and do order based billings.But for this I have to enter the same materials items again in the Sales order which is nothing but duplicacy of data.
    Is there any alternative to this? Or some other way by which the PO line items be copied to sales order so that I can save time while creating sales order.
    Regards,
    B P Singh

    Hi Virendra,
                       Business scenario is like this.
    I have created project and activities.Have assigned materials as 3rd party sale in NWA. I have released the project.PR are getting followed by PO.On doing the GR the actual costs are getting booked on NWA.
    My concern is how to bill the Items(the same material components) which are assigned to activity.
    As per your input I need to do Resource Related billing.Thanks for the input.It is no longer required to assign materials in DIP to Carry out RRB. 
    To carry out RRB do I need to create Sales Order first ? If  No then how to do RRB? If Yes  I need to create a Sales Order with all the material components which I have assigned at activity level. So I was looking for some alternative so that SO creation becomes less tedious.
    Regards,
    B P Singh

  • Third party returns from customer to vendor (Urgent)

    Hi,
    We have an urgent requirement regarding an issue with third party returns from customer.
    The scenario required is as follows :
    When the customer returns the goods in Third party proccess the goods should be directly returned to the vendor instead of receiving into our plant .
    How can we map this bussiness proccess?
    Currently the returns are handled as per the standard SAP proccess ie.,
    Customer returns the goods> Return order is created>Return delivery created (PGR)>Credit memo created.
    In this case we are receiving goods into our plant .

    Hi Shrikant
    1. If delivery of goods is the only issue then you can ask customer to make invoice with Invoice to your company address and Delivery address as the vendor address. Practically it is possible.
    2. Then you can make corresponding entries in SAP and regularise it.
    Thnx
    Nilesh

  • Warning, third party software from Lenogo

    Hi,
    I just wanted to warn others about purchasing third party software from "Lenogo" www.lenogo.com
    I saw this company mentioned here on the apple forum, and I then purchased the ipod to mac transfer software so I could transfer my music from my ipod (all paid for, no copyright issues here) back to my computer's itunes after an unsuccessful sync.
    The software wouldn't download or install and the company did not reply to any of my emails or support tickets, or provide telephone contact details.
    They did not provide support or a 30 day money back guarantee refund, as advertised.
    I've been ripped off, basically!
    Just wanted to let you guys know so it doesn't happen to you!
    Kate.

    Hello and Welcome to Apple Discussions. 
    Thanks for this and bump!
    cheers
    mrtotes

  • Third-party library for J2ME

    Can I use third-party library in the J2ME wireless toolkit? and How?
    I have trouble using MathFP library provided by http://home.rochester.rr.com/ohommes/MathFP/
    with the J2ME wireless toolkit(1.04, 2.1 and 2.2).
    If I can not use third-party library with the toolkit, is there any way around it?
    Also, I find out that even if I wipe out my CLASSPATH on my windows system, the J2ME wireless tool kit still remember the old CLASSPATH. It means I still can compile Java project with J2ME wireless toolkit, but I can not compile any Java file with command line ( it can not find any Java library!). The bottom line is J2ME wireless toolkit has special setup. And I don't know to use third-party library with the toolkit. If developer can not use third-party library with the toolkit, it would be kind of ridiculus. It would be just like the Visual Studio .NET can not use any other third-party DLL.

    Hi,
    You can very well use third party libraries in J2ME as far as it is compatible. If u have the source code of the library copy it in to the src directory of the project or if u have only the library then put it in lib directory of the project

  • How to Launch a downloaded third party app from my own app on the iPad using objective c

      How to Launch a downloaded third party app from my own app on the iPad using objective c

      How to identify whether the third party app has registered URL scheme or not. I also send a request mail to the third party app developers regarding URL scheme, but there is no reply from them.

  • How can i download third party Softwares from Support tab in Apple site?

    Hi,
    Previously i downloaded third party softwares for mac like Browsers, Anti- Virus softwares from Apple site but now i can download only Apple products (softwares) not third party softwares from download links so any one please let me know the status.
    Thanks in advance,
    Suresh Balakrishnan.

    Apple no longer hosts a website for 3rd party software.  Instead it runs the Mac App Store, which offers a good range of software.
    If you are very keen for the apps and other things that are not in the Mac App Store, a good app to download is "Bodega" - which provides another app store experience.
    Cheers,
    Rodney

  • How to transfer contents of third party apps from iPhone 4 to iphone  5?

    How to transfer contents of third party apps from old iPad to new iPad?

    Backup from old iPad, new iPad restore from that backup.

  • Intellisense with third party JavaScript libraries in Visual Studio Code

    With the release of Visual Studio Code today, I thought I would give it a look. Prior to this I had done most of my web development in Aptana and had recently started using Sublime Text 3, using the SublimeCodeIntel package to help with navigating unfamiliar
    code, as it provides Intellisense like functionality, but I found it a little limited. Anyway, because I saw JavaScript was supported by Code, I wanted to see how well it worked.
    I opened a
    project I had been going over, trying to understand some aspects of a JavaScript library I am interested in,
    PlaygroundJS. I wanted to add intellisense to the library, and had seen how easy it was to do this with Angular on this webiste:
    http://www.johnpapa.net/intellisense-witha-visual-studio-code/ which talks about this issue. In this they bring up the quick action menu in angular, and select the option "Add /// reference to angularjs/angular.d.ts". However, when I look at the
    PlaygroundJS library I simply get option to mark the variable as local. So I was wondering, is there a way to add intellisense to this library, and even better, ensure that the entire project is indexed, so I can more easily find the definitions of functions
    that are declared in other files, and use the code completion features?
    EDIT: I did find out that I can add references manually, to each file, so that it can resolve the definitions for the code in other files, but this requires adding a lot of extra directives manually, eg:
    /// <reference path="Global.js" />
    /// <reference path="engine/Score.js"/>
    /// <reference path="engine/Camera.js"/>
    etc etc
    Is there no way of automating this process?

    Hi MrProsser,
    For third aprty library, actually we didn't support it.
    But for the Intellisense issue, I think we would know the real way how we use the
    Intellisense.
    Tools->Options->Text Editor->the specific language you use, and then enable the Auto list members or others.
    Reference:
    https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx?f=255&MSPPError=-2147217396
    So we would enable it for the specific development language, so please make sure that you have enabled it for your current development language, if it still no help, we would make sure that it doesn't support it in VS IDE for this third party library. 
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • How to upload file from client to server in servlets.

    actually in my application i have to upload file from client m/c to server. it is not possible through file i/p stream as fileStreams does not work on network. Please mail me if you have any solution to this. Thank's in advance............

  • Firefox won't open, error message"can't find file at jar:file" etc.

    "Firefox cannot find file@jar:file:///program files/Mozilla Firefox/omni jar!/browser config. properties." I tried to download firefox and refreshed the desktop link and still no go. Cannot get firefox to browse.

  • BPM -80112 error

    Dear team, We are working on JDEV11.1.1.7 version and SOA suite is 11.1.1.7. We extended domain for BPM11g . I am getting below error while creating BPM MDS.SOA MDS is created successfully. Test Failed: BPM-80112: Generic Security Error.  Cause: Inva

  • Digital audio ouput - why no volume control??

    This is a problem that has been around for a while (ie. pre-Leopard). Why is there *no global volume control* when using digital audio output? This includes the inability to mute the output as well as adjust the volume with either the keyboard or the

  • Steps required while moving employees from one organisational

    Can any one explain and write down steps required while moving employees from one organisational unit to other organisational unit. regards