Error in JNI method code

can anybody tell me the errors in this code.
JNIEXPORT jstring JNICALL Java_TestParams_replicate
(JNIEnv * env, jobject obj, jstring s)
const char s2, s2_copy, *s3;
jboolean copy;
jstring s4;
copy = JNI_TRUE;
s2 = (*env)->GetStringUTFChars (env, s, & copy);
s2_copy = (*env)->GetStringUTFChars (env, s, & copy);
printf ("Inside C: replicate String = %s\n", s2);
s3 = strcat (s2, s2_copy);
s4 = (*env)->NewStringUTF (env, s2);
printf ("Inside C: replicate return value = %s\n", s3);
return s4;
when i am trying to compile the above code i am getting the warning like this
test_params.c: In function ?Java_TestParams_replicate?:
test_params.c:34: warning: passing argument 1 of ?strcat? discards qualifiers from pointer target type
thanks
str

Well, first of all you should not cat or copy into memory specified as "const".
Second - NEVER copy or cat data to memory (pointed by s2 in your case) if you have no info about buffer length. 99% your code will cause illegal memory access error.

Similar Messages

  • Error calling JNI method

    Hello Everyone,
    I´m trying to call a method wich is inside a DDL by JNI. This works fine in a Java console application. However, this call doesn´t work when i put this operation in a web apllication and deploy in a weblogic server. I´ve already put the dll path in the PATH variable but it didn´t work. When I debug the application, the DLL can be loaded but i call the native method a error happens and a get the following message:
    java.lang.UnsatisfiedLinkError: criptografa
         at com.tim.util.cripto.ACC_Cripto.criptografa(Native Method)
    Why does it work when I use a java console application ?
    Thanks for help
    Rodrigo Lopes

    I see yere points but what I see on linux is it makes it to the constructor of the Java object and somewhere afterwards it bails out, the Java app does work alone. It appears to have problems initializing the JFrame, could there be a problem with the Java inheritance when a JVM is invoked throurgh native invocation??
    Here's some of the Java stuff
    public class Framework extends WindowAdapter {
        public int numWindows = 0;
        private Point lastLocation = null;
        private int maxX = 500;
        private int maxY = 500;
        public Framework() {
            System.out.println("JAVA Framework cnst");//GETTING HERE
            makeNewWindow();
        public void makeNewWindow() {
            System.out.println("JAVA makeWindow"); //GETTING HERE
            JFrame frame = new MyFrame(this); //NOT GETTING HERE!!!!!!!!!
            numWindows++;
            System.out.println("Number of windows: " + numWindows);
            System.out.println("Frame location: " + lastLocation);
            frame.setVisible(true);
            System.out.println("Post Java set frame visible");
        public static void main(String[] args) {
        System.out.println("Main method in Framework");
            Framework framework = new Framework();//GETTING HERE
    class MyFrame extends JFrame {
        protected Dimension defaultSize = new Dimension(200, 200);
        protected Framework framework = null;
        public MyFrame(Framework controller) {
            super("New Frame");
            System.out.println("MyFrame cnst ");//NOT GETTING HERE!!!!!!
            framework = controller;
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            addWindowListener(framework);
            JMenu menu = new JMenu("Window");
            menu.setMnemonic(KeyEvent.VK_W);
           setSize(defaultSize);
    }

  • Error call JNI method

    In call native method print in sign applet got following error:
    java.lang.UnsatisfiedLinkError: LabelPrinter.print Possible causes: If you are trying to use J/Direct (@dll.import), check your compiler version (for JVC, requires 4336 or greater.) If you are trying to use RNI, there are new requirements: see documentation.
    at LabelPrinter.print (LabelPrinter.java)
    at LabelPrinter.start (LabelPrinter.java:110)
    at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java)
    at com/ms/applet/AppletPanel.securedCall (AppletPanel.java)
    at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
    at com/ms/applet/AppletPanel.run (AppletPanel.java)
    at java/lang/Thread.run (Thread.java)
    I not using J/Direct or RNI.
    Any ideas?
    Thanks
    Carlo Cerqueira

    This could be a matter of incorrect case in the Method or library you are calling out to - or it could be that the DLL is not found - are you specifying the full path to it on the client system?

  • Getting HeapDump on out of memory error when executing method through JNI

    I have a C++ code that executes a method inside the jvm through the JNI.
    I have a memory leak in my java code that results an out of memory error, this exception is caught in my C++ code and as a result the heap dump is not created on the disk.
    I am running the jvm with
    -XX:+HeapDumpOnOutOfMemoryError
    -XX:HeapDumpPath=C:\x.hprof
    Any suggestions?
    Thanks

    I'll rephrase it then.
    I have a java class named PbsExecuter and one static method in it ExecuteCommand.
    I am calling this method through JNI (using CallStaticObjectMethod). sometimes this method causes the jvm to throw OutOfMemoryError and I would like to get a heap dump on the disk when this happens in order to locate my memory leak.
    I've started the jvm with JNI_CreateJavaVM and I've put two options inside the JavaVMInitArgs that is used to create the Jvm. -XX:+HeapDumpOnOutOfMemoryError and -XX:HeapDumpPath=C:\x.hprof
    which supposed to create a heap dump on the disk when OutOfMemoryError occurs.
    Normally if I would execute normal java code, when this exception would occur and I wouldn't catch it the Jvm would crash and the heap dump would be created on the disk.
    Since I need to handle errors in my C++ code I am use ExceptionOccured() and extracts the exception message from the exception it self and write it.
    For some reason when I execute this method through JNI it doesn't create the dump.

  • FATAL ERROR in native method: Non-array passed to JNI array operations

    After stepping up to JDK 1.4.2 we started getting a hotspot error, I added -Xcheck:jni and it yielded the above error which was not existent in JDK 1.4.1 and for the life of me I cannot find out whats wrong:
    Native method dec:
    private native byte[] cost(final byte[] byte_array,
    final double minCostPerMeter,
    final int costFuncSelection,
    final double maxCostThreshold);
    Method call:
    ByteArrayInputStream
    inputByteStream = new ByteArrayInputStream(
    cost(output_byte_stream.toByteArray(),
    minCostPerMeter,
    costFunctionSelection.length,
    maxCostThreshold));
    An array is being passed I have no idea why it is complaing about the method call.
    Any help would be appreciated.
    -R

    What happens if you remove all the code from the JNI method - so it just calls and then returns?
    If it still occurs then I would expect that you have a memory problem in a piece of code before this one. Such problems can have no impact when run in one environment but cause failures in another becomes some other legitimate piece of data moved.
    If it doesn't then I would expect that the problem is in the method itself and not the call.
    It could be some odd VM problem so trying a different version of 1.4.2 might help (but in of itself would not eliminate the possibility that you have a memory problem.)

  • Error: The AcquireConnection method call to the connection manager failed with error code 0xC0202009 using DB2 connection

    I have a SSIS project that I am newly running on the SQL server (2005) .  It was previously run on my PC.  I am importing data from a DB2 server to the SQL server.
    I am in the SA group on the server
    My connection to DB2 works
    When open the package and run it in preview mode, I can retrieve the data.
    When I execute the package I get the below errors:
    [MIDAS OLE DB Source [1]] Error: The AcquireConnection method call to the connection manager "NGMDSPA.alharris" failed with error code 0xC0202009.
    [DTS.Pipeline] Error: component "MIDAS OLE DB Source" (1) failed validation and returned error code 0xC020801C.
    What I have already done that has not worked:
    The original Protection level was set to EncryptSensitiveWithPassword. 
    I have reset the Package Password.
    I have set the protection level to DontSaveSensitive
    I saved the package on the server and set a Package Password.
    I created a new package, set the Protection level to DontSaveSensitive, set a package password in a configuration file using the Package Configuration Wizard.
    Error continues

    Yes.  The Drivers are installed and I have a successfull connection.  I am trouble shooting the issue on the server in BIDS.  I can connect to the DB2 server via the Connectionmanager.  I can also preview the data in the OLE
    DB source connection.  Therefore I know that I have a proper connection
    If you're setting option as DontSaveSensitive then you need to pass the connection information from configuration file/ config table. Otherwise it wont be able to use it for connecting to your source/destination servers. This is the recommended way as it
    will enable you to change connection info at runtime.
    If you want connection info to persist you need to use protection level as EncryptSensitiveUsingUserKey or EncryptSensitiveUsingPassword and set a password.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Error when compiling the native c method: error in jni.h

    Hello friends,
    I am using windows 2000, JDK1.4 and Borland Turbo C++ Comipler.
    I am learing JNI. And therefore I followd instruction on creating a simp,e JNI call from "Sun Java Tutorial"
    But I am getting problem during compiling of the C program.
    there are about 26 errors in jni.h and jni_md.h
    Here are the errors:
        Error JNI_MD.H 16: , expected
        Error JNI_MD.H 108: Declaration missing ;
        Error ../JNI.H 193: ) expected
        Error ../JNI.H 195: ) expected
        Error ../JNI.H 198: ) expected
        Error ../JNI.H 201: ) expected............ and so on.
    Can anyone help me.

    The basic problem is that Borland C and VC++ define some things differently, and the header files are geared to VC++.
    The way I got around this is to make some adjustments to my C code to impose the Borland definitions in place of the VC++ definitions. I do this creating a .h file that
    o Includes my definitions.
    o Includes jni.h
    I then #include my .h file instead of directly including jni.h. That way, I don't need to change jni.h or jni.md.h
    Here is roughly what it looks like. (Can't give you the exact code - the files are proprietary and include a lot not-relevant stuff.)
    If you run into troubles with some files compiling, and some not, then I suggest you move some of the macro redefinitions to a .cpp file, and just # include that into your own .cpp file.
    (file shell.h)
    #ifndef ShellH
    #define ShellH
    // This file is used to make Borland-specific settings.
    // Normal kinds of stuff.
    #define WIN32
    #define HAS_BOOL
    // Suppress dll code.
    #ifdef jdecl
    #undef jdecl
    #endif
    #define jdecl
    // Borland has seen fit to specially-define toString();
    #ifdef toString
    #undef toString
    #endif
    #define toString jToString
    // Define functions and constants per Borland (vs Microsoft).
    #define _chdir chdir
    #define _cwd cwd
    //#define _getcwd getcwd
    #define _getpid getpid
    //#define _stat stat
    #define SHDENYWR SH_DENYWR
    #include "jni.h"
    #endif

  • ERROR - the ProtectKeyWithTPMAndPIN Method failed with the exit code: 8031005B

    Hello
    I am using the EnableBitlocker.vbs script to automatically assign the TPM and start the encryption. I am running it from an elevated command prompt. Here is are the arguments I am running with
    cscript EnableBitLocker.vbs /on:tp
    /l:c:\bitlockerlog.log /promptuser /ro:"MBAM" on
    All is well and it prompts the user for a PIN but then it fails.
    Here is the full log file. I haven't been able to find any info on the error code in the subject.
    Script processing started  02/07/2014       14:43:27
    Proper number of command line arguments passed to the script
    ---------------Executing with the following arguments------------------
    Enable parameters: tp
    Logging location: c:\bitlockerlog.log
    Create recovery key: No recovery key use specified
    Encryption method: 3
    Create SMS status MIF's: No SMS status MIF's will be created
    Reset TPM ownership: 1
    User prompting: 1
    Connection succeeded to MicrosoftTPM
    Successfully retrieved a TPM instance from the Win32_TPM provider class
    TPM found in the following state:
    Enabled - True
    Activated - True
    Owned - True
    Connection succeeded to MicrosoftVolumeEncryption
    TPM is in a ready state to enable BitLocker.
    Change TPM owner password specified on the command line.
    Random TPM owner password is: ;&K:)BU65|c7_v2n
    Completed converting old owner password to owner authorization:  0
    Completed converting owner password to owner authorization:  0
    Starting to change owner authorization process on the TPM
    ERROR - Failed to change owner authorization on the TPM with the following exit code:  80280001
    Successfully connected to WMI StdRegProv
    Checking if Group Policy encryption method is set...
    Found EncryptionMethod with value: 4
    Found EncryptionMethod policy registry key ignoring any /em options on command line
    Found ActiveDirectoryBackup with value: 1
    Found RequireActiveDirectoryBackup with value: 1
    Determined client Group Policy configured to require AD escrow of recovery password
    EncryptableVolumes count is: 1
    The EncryptableVolume(s) found: \\?\Volume{ad6db324-01dd-11e4-8272-806e6f6e6963}\
    EncryptableVolume used for encryption is: C:
    The volume has a protection status of: 0
    BitLocker Protection is Off
    Get conversion status is: 0
    The volume has a status of fully decrypted
    The following user is logged on: MGMT\80151318-sys
    Attempting to enable BitLocker TPM + Pin
    ERROR - the ProtectKeyWithTPMAndPIN Method failed with the exit code:  8031005B
    Script ended  02/07/2014       14:43:51
    Any and all help would be appreciated. This has worked before on a different laptop.
    Thanks

    Hi,
    This error indicates that the group policy isn't set correctly, when configure the group policy at teh server side, you should notice that only one of the additional authentication can be required at start up , otherwise a policy occurs, the notice can be
    found just like below:
    and after test, the error indeed occurs, just like the screen below:
    So, I suggest to check the group policy for bitlocker settings, you can only choose one start up authentication method.
    Regards
    Wade Liu
    TechNet Community Support

  • Error from JNI.ADD_OBJECT_ARG when trying to access web service

    Hi,
    I'm hoping someone can help me with this. I am very new to Java and my lack of experience is probably killing me...
    Trying to be very explicit probably caused me to create a very lengthy post..my apologies...
    My issue:
    I've created a post_database_commit trigger to access my web service (written in C# .NET). I used JDeveloper 10.3.3.1 to create the wrapper code using my WSDL file. I am receiving an error message "Unable to call out to Java, invalid object type for argument 1" when the code line 'rv := UIDItemSvcSoap12Client.addUidItem(my_object, a0);' is executed in the trigger. I do not see the reason for the error.
    Here are code excerpts:
    (Post_database_commit trigger)
    rv varchar2(1000);
    ex ora_java.jobject;
    a0 ora_java.jobject;
    my_object ORA_JAVA.jOBJECT;
    BEGIN
    my_object := UIDItemSvcSoap12Client.new() ;
    ---create args list (Varchar2 in, jobject out)
    a0 := Exception_.new(:uid_table.uid_no);
    UIDItemSvcSoap12Client.main(a0);
    rv := UIDItemSvcSoap12Client.addUidItem(my_object, a0);
    (Package spec)
    -- Method: addUidItem (Luidwebsvcproject/proxy/UIDItem;)Ljava/lang/String;
    FUNCTION addUidItem(
    obj ORA_JAVA.JOBJECT,
    a0 ORA_JAVA.JOBJECT) RETURN VARCHAR2;
    (Entire Package body created by Jdeveloper)
    PACKAGE BODY UIDItemSvcSoap12Client IS
    -- DO NOT EDIT THIS FILE - it is machine generated!
    args JNI.ARGLIST;
    -- Constructor for signature ()V
    FUNCTION new RETURN ORA_JAVA.JOBJECT IS
    BEGIN
    args := NULL;
    RETURN (JNI.NEW_OBJECT('uidwebsvcproject/proxy/UIDItemSvcSoap12Client', '()V', args));
    END;
    -- Method: main ([Ljava/lang/String;)V
    PROCEDURE main(
    a0 ORA_JAVA.JARRAY) IS
    BEGIN
    args := JNI.CREATE_ARG_LIST(1);
    JNI.ADD_OBJECT_ARG(args, a0, '[Ljava/lang/String;');
    JNI.CALL_VOID_METHOD(TRUE, NULL, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'main', '([Ljava/lang/String;)V', args);
      END;
      -- Method: getPort ()Luidwebsvcproject/proxy/UIDItemSvcSoap;
      FUNCTION getPort(
        obj   ORA_JAVA.JOBJECT) RETURN ORA_JAVA.JOBJECT IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_OBJECT_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'getPort', '()Luidwebsvcproject/proxy/UIDItemSvcSoap;', args);
      END;
      -- Method: getClientTransport ()Loracle/webservices/transport/ClientTransport;
      FUNCTION getClientTransport(
        obj   ORA_JAVA.JOBJECT) RETURN ORA_JAVA.JOBJECT IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_OBJECT_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'getClientTransport', '()Loracle/webservices/transport/ClientTransport;', args);
      END;
      -- Method: addUidItem (Luidwebsvcproject/proxy/UIDItem;)Ljava/lang/String;
      FUNCTION addUidItem(
        obj   ORA_JAVA.JOBJECT,
        a0    ORA_JAVA.JOBJECT) RETURN VARCHAR2 IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_OBJECT_ARG(args, a0, 'uidwebsvcproject/proxy/UIDItem');
        RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'addUidItem', '(Luidwebsvcproject/proxy/UIDItem;)Ljava/lang/String;', args);
      END;
      -- Method: getEndpoint ()Ljava/lang/String;
      FUNCTION getEndpoint(
        obj   ORA_JAVA.JOBJECT) RETURN VARCHAR2 IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'getEndpoint', '()Ljava/lang/String;', args);
      END;
      -- Method: getMaintainSession ()Z
      FUNCTION getMaintainSession(
        obj   ORA_JAVA.JOBJECT) RETURN BOOLEAN IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_BOOLEAN_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'getMaintainSession', '()Z', args);
      END;
      -- Method: setMaintainSession (Z)V
      PROCEDURE setMaintainSession(
        obj   ORA_JAVA.JOBJECT,
        a0    BOOLEAN) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_BOOLEAN_ARG(args, a0);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'setMaintainSession', '(Z)V', args);
      END;
      -- Method: setUsername (Ljava/lang/String;)V
      PROCEDURE setUsername(
        obj   ORA_JAVA.JOBJECT,
        a0    VARCHAR2) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_STRING_ARG(args, a0);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'setUsername', '(Ljava/lang/String;)V', args);
      END;
      -- Method: getUsername ()Ljava/lang/String;
      FUNCTION getUsername(
        obj   ORA_JAVA.JOBJECT) RETURN VARCHAR2 IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'getUsername', '()Ljava/lang/String;', args);
      END;
      -- Method: setPassword (Ljava/lang/String;)V
      PROCEDURE setPassword(
        obj   ORA_JAVA.JOBJECT,
        a0    VARCHAR2) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_STRING_ARG(args, a0);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'setPassword', '(Ljava/lang/String;)V', args);
      END;
      -- Method: getPassword ()Ljava/lang/String;
      FUNCTION getPassword(
        obj   ORA_JAVA.JOBJECT) RETURN VARCHAR2 IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'getPassword', '()Ljava/lang/String;', args);
      END;
      -- Method: setEndpoint (Ljava/lang/String;)V
      PROCEDURE setEndpoint(
        obj   ORA_JAVA.JOBJECT,
        a0    VARCHAR2) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_STRING_ARG(args, a0);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'setEndpoint', '(Ljava/lang/String;)V', args);
      END;
      -- Method: hashCode ()I
      FUNCTION hashCode(
        obj   ORA_JAVA.JOBJECT) RETURN NUMBER IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_INT_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'hashCode', '()I', args);
      END;
      -- Method: getClass ()Ljava/lang/Class;
      FUNCTION getClass(
        obj   ORA_JAVA.JOBJECT) RETURN ORA_JAVA.JOBJECT IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_OBJECT_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'getClass', '()Ljava/lang/Class;', args);
      END;
      -- Method: wait (JI)V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT,
        a0    NUMBER,
        a1    NUMBER) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(2);
        JNI.ADD_LONG_ARG(args, a0);
        JNI.ADD_INT_ARG(args, a1);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'wait', '(JI)V', args);
      END;
      -- Method: wait ()V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'wait', '()V', args);
      END;
      -- Method: wait (J)V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT,
        a0    NUMBER) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_LONG_ARG(args, a0);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'wait', '(J)V', args);
      END;
      -- Method: equals (Ljava/lang/Object;)Z
      FUNCTION equals(
        obj   ORA_JAVA.JOBJECT,
        a0    ORA_JAVA.JOBJECT) RETURN BOOLEAN IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_OBJECT_ARG(args, a0, 'java/lang/Object');
        RETURN JNI.CALL_BOOLEAN_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'equals', '(Ljava/lang/Object;)Z', args);
      END;
      -- Method: notify ()V
      PROCEDURE notify(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'notify', '()V', args);
      END;
      -- Method: notifyAll ()V
      PROCEDURE notifyAll(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'notifyAll', '()V', args);
      END;
      -- Method: toString ()Ljava/lang/String;
      FUNCTION toString(
        obj   ORA_JAVA.JOBJECT) RETURN VARCHAR2 IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'uidwebsvcproject/proxy/UIDItemSvcSoap12Client', 'toString', '()Ljava/lang/String;', args);
      END;
    BEGIN
      NULL;
    END;
    (Code from JDeveloper)
        public String addUidItem(UIDItem UIDItem) throws java.rmi.RemoteException {
            return _port.addUidItem(UIDItem);
        }

    That's a network or server issue, not a problem with your Mac.

  • FATAL ERROR in native method: Wrong Method ID

    I have a piece of C code from which I am trying to launch a piece of Java, but I am having severe problems just trying to get a simple integer value returned from any Java function. I keep getting the error message "FATAL ERROR in native method: Wrong method ID used to invode a Java method"
    My C code looks like :
    JNIEnv *env;
    long result;
    jmethodID mid;
    jclass cls;
    jobjectArray args;
    jstring jstr;
    jint res;
    jobject myObj;
    options[0].optionString = "-Djava.class.path=.";
    options[1].optionString = "-Djava.compiler=NONE";
    options[2].optionString = "-verbose:jni";
    vm_args.version = JNI_VERSION_1_2;
    vm_args.options = options;
    vm_args.nOptions = 2;
    vm_args.ignoreUnrecognized = JNI_FALSE;
    // Create the Java VM
    result = JNI_CreateJavaVM(&jvm,(void **)&env, &vm_args);
    if (result == JNI_ERR )
    printf("Can't create Java VM\n");
    exit(1);
    else
    printf("Java VM created successfully\n");
    cls = (*env)->FindClass(env, "Example1");
    if (cls == 0){
    printf("Can't find Class\n");
    exit(1);
    else
    printf("Class Found\n");
    mid = (*env)->GetMethodID(env, cls, "GetIntValue", "()I" );
    if (mid == 0) {
    printf("Can't find function\n");
    exit(1);
    else
    printf("Function Found\n");
    res = (*env)->CallIntMethod(env, cls, mid);
    if (res != 0)
    char pszTempString[256] = {'\0'};
    sprintf (pszJavaString, "Returned from Java the value of %d", res);
    printf("Returned from Java with ");
    printf(pszJavaString);
    My GetMethodID call works correctly and I have checked the signature (using javap -s) and that works fine. I've seen many references on these forums about using NewObject prior to calling CallIntMethod, but if I try to use that I then get the error message "FATAL ERROR in native method: a non-constructor passed to NewObject".
    Any body got any ideas please.
    Thanks

    What I couldn't figure out from your code is where you create the java object that is supposed to return the integer to your C code.
    Alternatives:
    o This is just code snippets, and you really are creating the object.
    o Error - the object should have been created.
    o Error - it is a static method, and you should be finding a static method and calling it on a class object.
    (Other than that, I didn't see anything obviously wrong.

  • UnsatisfiedLinkError while calling a JNI Method

    Hi everyone,
    I have been struggling with this problem for two weeks now. I have a third party SDK that provides JNI library and all i need to do is implement the SDK, load the JNI library they have provided, and call the JNI methods. I was successfully able to load the JNI library and call the JNI methods when i don't put the classes in the package. But when i put the classes in a package then the library gets loaded successfully but an unsatisfiedLinkError occurs when calling the JNI methods. Please help!!! Please remember that the JNI library is provided by the third party vendor and I don't need to write the C/C++ code or call javah to create a .h file and then a c/c++ file.
    This is the error i get:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: ss.tts.JNILayer.InitDFTTSEngineEx3(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I[I)V
         at ss.tts.JNILayer.InitDFTTSEngineEx3(Native Method)
         at ss.tts.Speech.test(Speech.java:854)
         at ss.tts.SSMain.main(SSMain.java:13)
    The three classes are SSMain, Speech, and JNILayer. JNILayer has the jni methods, speech calls the jni method, and SSMain is main class.
    Thank you in advance.

    which ever class which contains the "InitDFTTSEngineEx3" method. should not be altered, even its package should not be altered.[same for other class which has the native method declared in them]
    because in native code jni method signatures will be based on the java class's fully qualified name.
    so when you change the package the FQN will change and no matching method for this
    ss.tts.JNILayer.InitDFTTSEngineEx3(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I[I)V
    will be found in native code.
    i hope u understood.

  • How to link a native library that jni method needs in Linux?

    I'm trying to convert a simple driver using JNI to java in Linux. The driver uses native methods (written in C) that are implemented in a static library eth.a, so I don't have a source code for these methods. Everything works fine when pure C-code program is used, however when I'm trying to use java-program where native methods (which naturally need these driver-functions in eth.a) I got a following error:
    LibPath= /usr/kahvi/ioapi/
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/kahvi/ioapi/libEthDriver.so: /usr/kahvi/ioapi/libEthDriver.so: undefined symbol: DDI_DevOpenNode
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1354)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1278)
    at java.lang.Runtime.loadLibrary0(Runtime.java:466)
    at java.lang.System.loadLibrary(System.java:771)
    at EthernetDriver.<clinit>(EthernetDriver.java:89)
    DDI_DevOpenNode is the first method that program uses from eth.a -library.
    I have tried several different linking option such as:
    gcc -o libEthDriver.so -DLINUX -DETH_UNIX -shared -Wl,-soname,libEthDriver.so -I/usr/jdk1.2.2/include -I/usr/jdk1.2.2/include/linux/ -I/usr/kahvi/ioapi/inc/ EthernetDriver.c -static -lc
    eth.a is located in /inc directory and LD_LOAD_LIBRARY is used properly.
    If I include eth.a directly to compilation options (which I'm not sure how to do), the error message is following:
    LibPath= /usr/kahvi/ioapi/
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/kahvi/ioapi/libEthDriver.so: eth.a: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1354)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1278)
    at java.lang.Runtime.loadLibrary0(Runtime.java:466)
    at java.lang.System.loadLibrary(System.java:771)
    at EthernetDriver.<clinit>(EthernetDriver.java:89)
    So the basic problem is quite simple, how to implement a JNI-method that uses a functions implemented in another library?
    Any help is very much appreciated, because I have tried to solve this a few days and I don't have clues how to move on.
    -ML

    What people are trying to point out is that you can't use that static library to resolve native methods. Native methods resolve to shared libraries. So you need to write a shared library that links with the static library and wraps the functions you want to export from the shared library. Check your compiler/linker documentation on how to build a shared library. (IIRC, something like -shared for gcc).
    God bless,
    -Toby Reyelts
    Check out the free, open-source JNI toolkit, Jace - http://jace.reyelts.com/jace

  • Error(23,19): method getName(java.lang.String) not found in class javax.swi

    Hi , when i try to run my program, i keep getting the error msg:
    Error(23,19): method getName(java.lang.String) not found in class javax.swing.JTextField
    I have checked the java API and it inherits from the awt.Component class and should be accessible via the jtextfield.
    I have tried the following:
    trying to initailise the JTextField at the start.
    Using getName works if i use it within the loop after setting the name.
    Does anybody know what i am doing wrong please?
    public class clsMember extends JPanel implements ActionListener {
        private JButton jbtnLog;
        private String surname;
        private JTextField txtItem;
        public clsMember() {
            super(new SpringLayout());
            makeInterface();
            surname = txtItem.getName("Surname").toString();
    private void makeInterface() {
         //code omitted
               for (int i = 0; i < numpairs; i++) {
                JLabel l = new JLabel(strLabels, JLabel.LEADING);
    this.add(l);
    //if the array item is salutation create a combobox
    if (strLabels[i] == "Salutation") {
    jcomSalutation = new JComboBox(strSalutation);
    jcomSalutation.setSelectedIndex(0);
    this.add(jcomSalutation);
    } else {
    txtItem = new JTextField(10);
    l.setLabelFor(txtItem);
    txtItem.setName(strLabels[i].replaceAll(" ", "")); //this is where the label is set and if i do a system.out it shows fine. getName works here too.
    this.add(txtItem);
    //code omitted

    If i have a loop that creates the jtextfields such as
                    txtItem = new JTextField(10);
                    l.setLabelFor(txtItem);
                    txtItem.setName(strLabels.replaceAll(" ", ""));
    this.add(txtItem);How is it then possible to assign to a string the value of a *specific jtextfield*. Lets say that one of these JTextfields has the name surname.
    How is it possible for me to writeString surname = surnamejtextfield.getText();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Error: "Function or method not supported." when using RF List Mode on NI 5673E

    Hi,
    I am trying to use the RF List Mode in NI RFSG 5673E. I tried running the sample code "RFSG Configuration List Frequency and Power Sweep.vi" but an error would show up:
    "Error: niRFSGCreateConfigurationList.VI <ERR> The LO reported the following error: Function or method not supported." with the error code: BFFA4239. 
    I also tried running other sample codes that contain the Configuration List VI's but the same error appeared. I am using NI RFSG 1.8.5.
    I would really appreciate any help on this. Thanks!

    Hello jdlabrador,
    I setup a 5673E here and tried to run the same example.  I did not encounter an error.
    Other reports I've found pertaining to this error usually involved a large number of steps - there was not enough space on the hardware to accommodate them.  The error text you're seeing is a little different in that it states that the Create Configuration List method isn't supported for the LO.
    Do each of the modules in your 5673E (5450, 5611, 5652) pass a self-test in MAX?  
    Have you associated the 5450 and 5652 with the 5611?
    Could you post a screenshot of the fully-expanded Devices and Interfaces tree from MAX?
    Since RFSG 1.9.5 is available, it may be a good first-step to upgrade to it.  
    Best regards,
    Matthew H.
    Applications Engineer
    National Instruments

  • Error(400,8): method include(java.lang.String, boolean) not found in class

    I have uploaded my Application which was running fine in other IDE to jdev 10.1.3, when i compile the follwing error error in jsp page.
    Error(400,8): method include(java.lang.String, boolean) not found in class javax.servlet.jsp.PageContext
    My jsp code where error is shown is
    <jsp:include page="querySections/generation.jsp" flush="true">
                                            <jsp:param name="TSN" value="<%=strParamValue[1]%>"/>
                                            <jsp:param name="SectionID" value="<%=String.valueOf(lngSectionID)%>"/>
                                       </jsp:include>
    pl help me in solving this its urgent...
    Thanks & Regards
    Lakshmi

    Hi,
    code snippet looks okay and is identical with what JDeveloper generates.
    Frank

Maybe you are looking for

  • System refresh in DB2 for zOS with dual stack

    Has anyone performed system refresh (Abap + J2ee) in DB2 for zOS. We are planning to do it but the homogeneous document outlined the database specific methods and it doesn't cover the j2ee part. Is there any specific methods to follow to bring up the

  • Error in processing inbound Idocs

    Hi, i have a file to idoc scenario. the message gets picked at the sender and in SXMB_MONI the message has success flag but the outbound status tab in SXMB_MONI has red flag. i cheked the transactions sm58, we05 in R3 systems, their are no messages f

  • Can't install updates since installing ios6 just says waiting  ipad 3

    Can;t install updates since installing ios6 3 days ago just says waiting ipad 3

  • Receipt for my app I bought

    How do I get a receipt for an app I bought... It was never emailed to me (Bought it a week ago)

  • How do i search call history by caller ID?

    Hi I am using iphone 5 with the latest ios7. Currently the call history provides details in the descending order of the date time stamp. I want to have the history in descending order of timestamp but for a caller id. Typically this was available in