Custom Java method call

I created a new service which should call a java method. It is called from the confirm htm page after check in of a new content item.
Serice Name INVOKE_ESB_CLIENT
DIR - custom/component/classes/invokeESBClient
Class - InvokeESBClient
method - invokeESBclient
ServiceHandlers serviceName - DocService
handler - invokeESBClient.InvokeESBClient
This is all done in a component which has a service handler to point it the proper directory and class. But I get the following error. Your help is appreciated.
Unable to execute service INVOKE_ESB_CLIENT and function invokeESBclient.
(System Error: The service method 'invokeESBclient' is not defined.) The service method 'invokeESBclient' is not defined.
An error has occurred. The stack trace below shows more information.
!csServiceDataException,INVOKE_ESB_CLIENT,invokeESBclient!$!csSystemError,\!csMethodNotDefined\,invokeESBclient!csMethodNotDefined,invokeESBclient
intradoc.common.ServiceException: !csServiceDataException,INVOKE_ESB_CLIENT,invokeESBclient!$!csSystemError,\!csMethodNotDefined\,invokeESBclient
     at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:1742)
     at intradoc.server.Service.buildServiceException(Service.java:1997)
     at intradoc.server.Service.createServiceExceptionEx(Service.java:1991)
     at intradoc.server.Service.createServiceException(Service.java:1986)
     at intradoc.server.ServiceRequestImplementor.handleActionException(ServiceRequestImplementor.java:1453)
     at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1420)
     at intradoc.server.Service.doAction(Service.java:452)
     at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1194)
     at intradoc.server.Service.doActions(Service.java:447)
     at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1114)
     at intradoc.server.Service.executeActions(Service.java:433)
     at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:635)
     at intradoc.server.Service.doRequest(Service.java:1707)
     at intradoc.server.ServiceManager.processCommand(ServiceManager.java:359)
     at intradoc.server.IdcServerThread.run(IdcServerThread.java:197)
Caused by: intradoc.data.DataException: !csMethodNotDefined,invokeESBclient
     at intradoc.server.Service.doCodeEx(Service.java:518)
     at intradoc.server.Service.doCode(Service.java:472)
     at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1353)
     ... 9 more

Answers to your questions:
1. Yes i have compiled the java files, more than once again just to confirm. I unit tested the class by running as a java application before using it in the component.
2. No, but I did do it after you suggested it. I still get the same error.
3. Yes classes directory has been added to y components custom classpath.
4. No, i have not sacified 5.25 in floppy but at this point is I am willing to sacrifice my whole laptop.
Within the component I have directory named classes and directory name invokeESBClient and then
component
..........classes
.................invokeESBClient
.........................InvokeESBClient.class
.........................InvokeESBClient.java
This is the contents of resource table
Resource Tables
Merge To: ServiceHandlers
<@table Java_Method_Call@>
<table border=1><caption><strong>
<tr>
<td>serviceName</td><td>handler</td> <td>searchOrder</td>
</tr>
<tr>
<td>DocService</td> <td>invoiceESBClient.InvokeESBClient</td> <td>5</td>
</tr>
<@end@>
I hope this provides enough information.

Similar Messages

  • Creation of Data Control for custom java method  which will return records

    Hi Guys,
    I have a requirement of creating a a custom java method in App module which will return a record set taking an id as input.In case of single return type it works fine but in case of returning record set it is not working.In my case i have to combine two tables and return it as a single entity as a view in Data Control.
    Warm Regards,
    Srinivas.

    Why don't you just create a custom view object? There's even an example or 2 in the docs:
    http://docs.oracle.com/cd/E16162_01/web.1112/e16182/intro_tour.htm#CHDGDIEC (check out "View object on refcursor" example)
    Edit: you are aware that you can create a View Object based on more than one table?
    John

  • 10.1.3.4 - How to access custom java methods in worklist ?

    We want to invoke a custom java method inside of worklist, when the file attachments are added to the worklist. We are planning to modify the auto-generated jsp page to do the same. We have created the custom jar files, but am not sure where to deploy this jar file ? We are not able to compile the jsp /jar. Does anybody have any idea where the custom jar file goes ?

    The bpel\samples\hw\worklistapp\readme will explain you about how to do this.

  • Custom Java class called from RTF template generates error

    We are running a report in BI Publisher and the report calls a custom developed Java class that is used to bind PDFs together and sent the result to another application.
    On the RTF template we have some XSLT that reads the input XML and sets a variable which is then passed to the Java class. We are however getting the following error when the report is called simultaneously 2 or more times:
    XML-22044: (Error) Extension function error: Error invoking 'JavaClassName': 'java.lang.Error: Cannot interweave overlay template with pdf input, combined number of pages is odd!
    I read this as the real cause of the error is the Java code but I'm not 100% sure. Also I don't understand what the error message means.
    Could someone help out please?
    Many thanks

    Since our this requirement is in Quotes module, its not using OAF. It is using plain JSPs and java classes.
    What i was thinking is, create the Option values as flex fields, and write a custom java class to fetch these data from the flex tables and use it in the JSP.
    The main problem we are facing now is,
    "...we wrote a simple java class, which establishes database connection, executes a simple insert & select query to our custom table. compiled & placed the class file under our new pkg structure under $JAVA_TOP eg. oracle.apps.xxx.quot.tmpl , bounced the apache."
    But when we tried to import this class in the jsp (which is being customized), the app just throwed Internal Server Error and we couldnt find any info in the Log file.
    Couldnt guess, why is this simple thing failing. Any idea ?

  • DB Call from Oracle Business Rule +Java Method call from OBR

    Hi,
    1.We have a requirement in project where we need to make DB Call from Business rule.
    We are using ORACLE SOA11g.
    Is this possible.Any pointers on this will be helpfull.
    2.Can we call java method from Oracle Business Rule.If so pls suggest how it can be done.
    Thanks In Advance,
    Oracle SOA User

    You can implement java class to make database updates using JDBC. You can add Java class as fact in business rules and invoke methods as actions of the business rules.
    Hope this will help.
    Jayesh Patel
    http://jayesh-patel.blogspot.com/
    http://www.yagnasys.com/

  • Java method call from c passing string more info

    I am trying to call a java method from c passing a String as an argument.
    my C code is as follows.
    //Initalise jstring and class (to recieve String)
    jstring textp;
    jclass texts = (*env)->GetObjectClass(env, obj);
    jmethodID text = (*env)->GetMethodID(env, texts, "texture", "([Ljava/lang/String;)V");
    //Create a new jstring from the char* texturePath (in textures)
    //call the java method with the jstring
    textp = (*env)->NewStringUTF(env,ret.textures->texturePath);
    (*env)->CallVoidMethod(env, obj, text,textp);
    //java code
    // texture which recieves a string
    public void texture(String texturePath){
    The error I get is as follows:
    SIGSEGV 11 segmentation violation
    si_signo [11]: SEGV
    si_errno [0]:
    si_code [1]: SEGV_MAPERR [addr: 0xc]
    stackpointer=FFBED790
    "Screen Updater" (TID:0x4f9060, sys_thread_t:0x4f8f98, state:CW, thread_t: t@11, threadID:0xf2d31d78, stack_bottom:0xf2d32000, stack_size:0x20000) prio=4
    [1] java.lang.Object.wait(Object.java:424)
    [2] sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:78)
    [3] sun.awt.ScreenUpdater.run(ScreenUpdater.java:98)
    "AWT-Motif" (TID:0x40be50, sys_thread_t:0x40bd88, state:R, thread_t: t@10, threadID:0xf2d71d78, stack_bottom:0xf2d72000, stack_size:0x20000) prio=5
    [1] sun.awt.motif.MToolkit.run(Native Method)
    [2] java.lang.Thread.run(Thread.java:479)
    "SunToolkit.PostEventQueue-0" (TID:0x431950, sys_thread_t:0x431888, state:CW, thread_t: t@9, threadID:0xf2e71d78, stack_bottom:0xf2e72000, stack_size:0x20000) prio=5
    [1] java.lang.Object.wait(Object.java:424)
    [2] sun.awt.PostEventQueue.run(SunToolkit.java:407)
    "AWT-EventQueue-0" (TID:0x430ea8, sys_thread_t:0x430de0, state:CW, thread_t: t@8, threadID:0xf3071d78, stack_bottom:0xf3072000, stack_size:0x20000) prio=6
    [1] java.lang.Object.wait(Object.java:424)
    [2] java.awt.EventQueue.getNextEvent(EventQueue.java:212)
    [3] java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:100)
    [4] java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:91)
    [5] java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
    Exiting Thread (sys_thread_t:0xff343db0) : no stack
    "Finalizer" (TID:0x154e98, sys_thread_t:0x154dd0, state:CW, thread_t: t@6, threadID:0xfe391d78, stack_bottom:0xfe392000, stack_size:0x20000) prio=8
    [1] java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:146)
    [2] java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:168)
    [3] java.lang.ref.Finalizer$FinalizerWorker$FinalizerThread.run(Finalizer.java:124)
    "Reference Handler" (TID:0x1506a0, sys_thread_t:0x1505d8, state:CW, thread_t: t@5, threadID:0xfe3c1d78, stack_bottom:0xfe3c2000, stack_size:0x20000) prio=10
    [1] java.lang.Object.wait(Object.java:424)
    [2] java.lang.ref.Reference$ReferenceHandler.run(Reference.java:130)
    "Signal dispatcher" (TID:0x13d180, sys_thread_t:0x13d0b8, state:MW, thread_t: t@4, threadID:0xfe3f1d78, stack_bottom:0xfe3f2000, stack_size:0x20000) prio=10
    "main" (TID:0x38918, sys_thread_t:0x38850, state:R, thread_t: t@1, threadID:0x25228, stack_bottom:0xffbf0000, stack_size:0x800000) prio=5 *current thread*
    [1] loader.Callbacks.nativeMethod(Native Method)
    [2] loader.Callbacks.main(Callbacks.java:184)
    [3] graphics.GR_MakeTrack.init(GR_MakeTrack.java:60)
    [4] graphics.GR_MakeTrack.main2(GR_MakeTrack.java:49)
    [5] graphics.GR_MakeTrack.main(GR_MakeTrack.java:41)
    [6] control.GE_main.GE_main1(GE_main.java:87)
    [7] control.GE_main.main(GE_main.java:66)
    gmake: *** [run] Abort (core dumped)

    I am trying to call a java method from c passing a
    String as an argument.
    my C code is as follows.
    //Initalise jstring and class (to recieve String)
    jstring textp;
    jclass texts = (*env)->GetObjectClass(env, obj);
    jmethodID text = (*env)->GetMethodID(env, texts,
    "texture", "([Ljava/lang/String;)V");
    Hi Pete,
    your problem is that the method texture you are trying to find does not exist. If you look carefully at your declaration of the method signature in the GetMethodID call you will see "([Ljava/lang/String;)V" which is trying to find a method that accepts a String array as its parameter. Remove the [ from the method signature and it should work ok. You might want to test text (jmethodID) for NULL or 0 before trying to call it as well.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Native - Java Method Call problem - "Wrong Method ID..."

    I am writing a 3d game engine using c++, with all the game logic code in Java, for the purpose of making the thing extendible, easily modifyable, etc...
    I am using J2SE JDK 1.2.2.
    Most things work fine (engine-wise), but i have a few questions about problems i am having getting the JNI to work correctly with calls to Java Methods.
    1. If I use FindClass() to get a jclass reference to a named class, I get one number back. If I then instantiate this class, and then call GetObjectClass() with the instance, I get another number, **which doesnt appear to work for anything**. What is going on here? Can the JVM give different jclass numbers for the same class? Is GetObjectClass() supposed to work?
    2. Is AllocObject() alright for instantiating Java objects? It does seem to allocate memory, and method calls work to the new object. I am aware that it doesn't call a constructor, but I like that, seeing as the initialization is handled through a different [network-synchronized] means.
    3. Using a jclass retrieved using FindClass(), which I store in a global variable, I am able to call methods on an instance that I created in a certain function. I then make sure (?) that the GC can't reclaim the class or object memory by getting a NewGlobalReference to both of them [just to be safe]. However, in a later function, I am unable to call methods using my stored method IDs, ["Wrong Method ID....JVM has been asked to shut down this application in an unusual manner..."]. I am also unable to acquire new methodIDs, as the system returns 0xCCCCCCCC for all method ID queries. Obviously, attempting to use those bogus method IDs results in a JVM crash, in a segment called [2 deep in the untraceable depths of JVM.dll] from the JNI CallVoidMethodV() function. Why is this happening? Is the GC getting in there despite my best efforts? Is it illegal to cache methodIDs, jclass references or jobject references? aaarrggh! :)
    Thanks
    Chris Forbes
    Lead Programmer
    Sprocket Interactive
    [email protected]

    Hi Chris,
    I hit the same sort of problem, when writing a JVMDI ( VM debugger hook ), in C++.
    My question remained unanswered too
    http://forum.java.sun.com/thread.jsp?forum=47&thread=461503&tstart=30&trange=30
    I didn't try a call to NewGlobalRef, as you did... but it sounds like it could be what I was missing.
    I've a couple of ideas, but nothing definite for you.
    1) maybe there's more than one classloader, so that multiple copies of the class are loaded
    2) ensure you're compiling your DLL with "quad-word" ( 8 byte ) alignment.
    Otherwise all your JNI references will be misaligned !
    Since the JNI reference maps to a C++ pointer, it's possible that you can't cache any JNI references.
    That's my vague feeling on the subject.
    As a workaround, you may have to keep requesting any JNI references, eg. jclass & jmethod's, as you need them.
    regards,
    Owen

  • Java method call from c passing string

    I have a c program which gets a char* myVar and I want to pass it to a java method which takes in a string but what ever I try I just get errors. This seems like a simple thing to do but I keep getting stuck so any help would be much appreciated. Thanks

    I think you need to expalin your problem in more detail, or better still, post some code. Then we'll be able to help.

  • Aborting Java Method Call

    Hi,
    I am 2 classes Class 1 and Class2
    from Class1.getData() method I am calling Class2.checkDetails() method
    My problem is that sometimes due to some backend down or some connection issues checkDetails() call takes several minutes to complete.
    In this scenario I want to abort the call altogether and show error details.
    Also I cant change checkDetails() as that module is not under my control, so that handling has to be done in Class1 itself.

    I believe he wants to know how to unblock a blocking method call after X amount of time elapses.
    The best I can suggest is to call checkDetails() in a new thread. Use a timer that sets a "cancel" flag (in the new thread) after X time elapses. When the method call unblocks, (i.e., checkDetails() returns) It should check to see if the canceled variable has been set. If its been canceled, then the thread just disposes, otherwise it keeps on working.

  • Java method call from Oracle?

    is it possible to calll on a running java Class's method from Oracle Stored procedure or something?
    here is the real problem...
    let's take a example of a simple ChatServer...
    let 's say we have two or more chatserver running on the same machine and users are connected to both server. Now one user from one machine send some message to another user whois on machine two. let's for a moment assume that all message have to go through the oracle database. We know at the databse level who is connect on what server. So server1 inserts the message into the databse and trigger should send message to server1 some kind of method, which then looks up the user's thread and send the message to the user.
    any clue?

    Oracle does support Java stored procs. You could have an Oracle java proc put a message on a network connection to do this. Honestly, however, it sounds to me like you need to revisit your design. A database really isn't the place to do this. If you need to keep the two servers in synch, consider a messaging solution like JMS

  • Aborting an JAVA method Call

    Hi
    please clarify my doubt.
    public class P1
    public static void main(String args[])
         P2 obj = new P2();
         obj.doSomething(input);
         System.out.println("continue");
    class P2
    public void doSomething(input)
         //validate
         //update
         //write to disk
    In the above program, the doSomething method should take less than 1 sec.
    if it takes more i need to abort the call and
    continue printing the SOP. I mean it should return to main program. but the updation
    and writing to disk should take place. how can i do that? can i do that or not?
    thanks in advance

    In the above program, the doSomething method should take less than 1 sec.
    if it takes more i need to abort the call and continue printing the SOP. Have a thread which calls the SOP every second whether the write completes in time or not.
    I mean it should return to main program. but the updation and writing to disk should take place. If you abort the operation it will not still happen correctly. In fact you could corrupt the file. Stopping the thread prematurely can result in a memory leak. How important is to you that you abort after 1 sec.

  • ADF test appmodule generates illegal java method call for Oracle binds

    I'm on the latest (likely) release of JDeveloper 10.1.3.
    ADF Business Components     10.1.3.36.73
    Java™ Platform     1.5.0_06
    Oracle IDE     10.1.3.36.73
    Struts Modeler Version     10.1.3.36.73
    UML Modelers Version     10.1.3.37.32
    Versioning Support     10.1.3.36.73
    Using ADF wizards, I've created a readonly view and modified the sql with a named bind variable.
    The sql is
    SELECT RaDocumentation.RA_DOC_ID,
    RaDocumentation.RA_DOC,
    RaDocumentation.MIME_TYPE
    ,dbms_lob.getlength(RaDocumentation.RA_DOC) bloblength
    FROM RA_DOCUMENTATION RaDocumentation
    where ra_doc_id = :blobKey
    Then I defined blobKey in the bind variables section to be type integer with default value of 0. When I run TEST on the appmodule, which only has this view defined in it, a prompt screen appears to ask for a new value for blobKey. When I press enter, an error screen appears saying
    Business Component Browser - java.lang.NoSuchMethodError
    oracle.jdbc.OraclePreparedStatement.setObjectAtName(Ljava/lang/String;Ljava/lang/Object;)V
    This JDeveloper application is generated "out-of-the-box", in that I did not change any defaults, etc from that which comes defaulted in standard JDeveloper 10.1.3. I did apply the most recent JDeveloper patches from Oracle's download site.
    Any suggestions as to the problem?

    I appreciate your help, but the problem is not yet solved.
    Below is the JDev log generated upon execution of the Browser. I do not see anything unusual.
    The log is the execution of JDev 10.1.3 after what I think is complete removal of all incarnations of anything relating to JDeveloper. All versions of JDev were deleted, all jdevhome directories. I found a OpenBaseJDBC.jar in the java extensions subdirectory and removed it.
    I then downloaded again the production JDev 10.1.3, executed it (it created its jdevhome directory in my home directory), and I updated with the required patch only (patch 5?), and restarted. Created application with a readonly view using a bind variable. Same error appeared. I did not find any suspect .jar files in the java directory.
    ----- JDev log output --
    /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java -classpath /Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/jlib/bc4jtester.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/jdev-cm.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/lib/xmlparserv2.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/help4.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/share.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/jewt4.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/oracle_ice.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/ojmisc.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ui.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/laf.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/sunrsasign.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/charsets.jar:/MyDeveloper/JDeveloperApplications/Model/classes:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/lib/adfshare.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/lib/bc4jmt.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/lib/collections.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/lib/bc4jct.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/commons-el.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/jsp-el-api.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jlib/oracle-el.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/lib/adfm.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/jlib/adfui.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/lib/adfbinding.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jdbc/lib/ojdbc14dms.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jdbc/lib/orai18n.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/jdbc/lib/ocrs12.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/diagnostics/lib/ojdl.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/lib/dms.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/lib/bc4jdomorcl.jar:/Applications/JDeveloper.app/Contents/Resources/jdev/BC4J/jlib/bc4jdatum.jar: oracle.jbo.jbotester.MainFrame -X 10E38CE209A -H jar:file:/Applications/JDeveloper.app/Contents/Resources/jdev/jdev/doc/studio_doc/ohj/bc4j_f1.jar!/bc4j_f1.hs
    2006-10-11 14:16:44.546 java[717] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x13703, name = 'java.ServiceProvider'
    See /usr/include/servers/bootstrap_defs.h for the error codes.
    2006-10-11 14:16:44.547 java[717] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider)
    BC4J Tester exit code(0)
    -- JDev log output end --

  • Using wildcards in custom find methods with CMP beans

    Hi,
    I'd like to create a custom find method called findByName which accepts a string. I'd typically want to use the string in a '%<name>%' scenario, where the user needn't type in the whole name. Does anybody know what the partial query should look like? I'm not sure how to concatenate the '%' symbol to the string taken in.
    Thanks in advance
    Gillian

    Gillian-
    Bind variables are of the form $1, $2, etc., so try using a query stmt like this:
    select * from YOURTABLE where name like '%$1%'
    Regards,
    -Jon

  • Cannot find java methods when AttachCurrentThread is used.

    Hi all,
    I'm new to JNI and was trying to make a Java method call from C.
    This call has to be done from RPC server on client requests.
    Since JVM has to be loaded only once, I made jvm as global variable
    and used (*jvm)->AttachCurrentThread method. But the problem i'm
    facing now is that after using AttachCurrentThread call, the piece of code
    is not finding the method with objects as arguments. The same works
    well if the jvm is made a local variable.
    Can anyone please help me out?
    Thanks in advance,
    anil
    //test.c
    #include <stdlib.h>
    #include <stdio.h>
    #include <ctype.h>
    #include <jni.h>
    static JavaVM *globalJVM;
    static JavaVMInitArgs global_vm_args;
    static int startedJVM = 0;
    void shutdownJVM() {
         (*globalJVM)->DestroyJavaVM(globalJVM);
    void startupJVM() {
         JavaVMOption javaVmOptions[1];
         JNIEnv *env;
         long status;
         javaVmOptions[0].optionString
              = "-Djava.class.path=D:\\Anil\\RPC\\ics";
         memset(&global_vm_args,
              0, sizeof(global_vm_args));
         global_vm_args.version = JNI_VERSION_1_4;
         global_vm_args.nOptions = 1;
         global_vm_args.options = javaVmOptions;
         status = JNI_CreateJavaVM(
              &globalJVM,(void**)&env,
              &global_vm_args);
         if (status == JNI_ERR) {
              printf("\n Could not start the JVM properly \n");
              exit(1);
         startedJVM = 1;
         printf("\n Created JVM");
    void rpc_call(char *message) {
         JNIEnv *env;
        jclass cls;
        jmethodID mid;
        jstring jstr;
        int square;
         //Starting the JVM only once.
         //If JVM is started and destroyed on each rpc call,
         //a hotspot error is thrown
         if (!startedJVM)
              startupJVM();
         if ((*globalJVM)->AttachCurrentThread(
              globalJVM, (void **)&env,
              &global_vm_args) == 0) {
              printf("\nAttached Current Thread");
              cls = (*env)->FindClass(env,
                   "com/cms/listener/CMSMessageProcessor");
              if (cls != JNI_OK) {
                   printf("\n Found the class com/cms/listener/CMSMessageProcessor");
                   mid = (*env)->GetStaticMethodID(env,cls,
                        "getIntegerValue","(I)I");
                   //This method is resolved and output is printed.
                   if ( mid != 0 ) {
                        printf("\n found getIntegerValue");
                        square = (*env)->CallStaticIntMethod(
                             env,cls,mid,5);
                        printf("Result of getIntegerValue() : %d\n",square);
                   //This method is not resolved with String[] as args
                   mid = (*env)->GetStaticMethodID(env, cls, "main", "([Ljava/lang/String;)V");
                   if (mid != JNI_OK) {
                        fprintf(stderr, "\n Can't find method main([Ljava/lang/String;)V ");
                   } else {
                        printf("\n Found main method");
                   //This method is not resolved with String as args
                   mid = (*env)->GetStaticMethodID(
                        env, cls, "processMessage",
                        "(Ljava/lang/String;)V");
                   if (mid != JNI_OK) {
                        fprintf(stderr, "\n Can't find method processMessage (Ljava/lang/String;)V ");
                        exit(1);
                   } else {
                        jstr = (*env)->NewStringUTF(
                             env, message);
                        (*env)->CallStaticVoidMethod(
                             env, cls, mid, jstr);
                        printf("\n After calling the java method");
              (*globalJVM)->DetachCurrentThread(globalJVM);
         } else {
              printf("\n could not attach the current thread to the jvm");
    void main(int argc, char *argv[]) {
         rpc_call(argv[0]);
    //CMSMessageProcessor.java
    package com.cms.listener;
    public class CMSMessageProcessor {
         public static void processMessage(String message) {
              System.out.println("processMessage");
         public static void main(String ar[]) {
              System.out.println("Inside main");
         public static int getIntegerValue(int integer) {
              return integer*integer;
    OUTPUT
    D:\Anil\RPC\ics\cpp>test ok
    Created JVM
    Attached Current Thread
    Found the class com/cms/listener/CMSMessageProcessor
    found getIntegerValueResult of getIntegerValue() : 25
    Can't find method main([Ljava/lang/String;)V
    Can't find method processMessage (Ljava/lang/String;)V
    D:\Anil\RPC\ics\cpp>

    The Sun VM is only loaded once and can not be unloaded once it is loaded.
    There is method that returns instances of loaded VMs (look it up.) For the Sun VM it will only return one instance.

  • Calling Web Service Proxy with Custom java Object as parameter

    I created a web service proxy from WSDL URL using JDeveloper 11g(.5 version)
    I need to call a webservice method which takes custom Java Object( Ex: ABC.java) as Input parameter. It creates the XSD java (ABC.java) file for that.
    @XmlElementRef(name = "abc", namespace = "http://impl.service.ns.test", type = JAXBElement.class)
    protected JAXBElement<ABC> abc;
    ABC.java has a property of type java.util.Set of a custom Java Object (Set<XYZ.class>)
    It doesn't create xsd file for XYZ.java.
    @XmlElementRef(name = "XYZ", namespace = "http://model.ns.test/xsd", type = JAXBElement.class)
    protected JAXBElement<Set> xyz;
    Please help me.

    The passing of Java objects in and out of a web service is NOT supported. variables must be xml documents defined by a XML schema. In my opinion, missing Java object and WSDL is not a good idea. -Edwin

Maybe you are looking for