ClassDefNotFound error when calling Java from C++

Hi all,
I have a problem with calling my java from C++ through JNI.
I have set my CLASSPATH environment varible that include path to every libary that I need. My source is as follows:
#include <jni.h>
#include <stdio.h>
int main()     
     JNIEnv               *env;
     JavaVM               *jvm;
     JavaVMInitArgs     vm_args;
     jint               res;
     jclass               cls;
     jmethodID          mid;
IMPORTANT: specify vm_args version # if you use JDK 1.1.2 and beyond
     vm_args.version = JNI_VERSION_1_4;
     vm_args.ignoreUnrecognized = JNI_TRUE;
     JNI_GetDefaultJavaVMInitArgs(&vm_args);
     /* Create the Java VM */
     res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
     if (res < 0) {
          printf("Can't create JVM\n");
          return 1;
     cls = (env)->FindClass ("dds/test/comm/listeners/NACKListenerFrame");
     if (cls == 0)     {
          printf("Can't find NACKListenerFrame Class\n");
          return 1;
mid = (env)->GetStaticMethodID(cls, "start", "()V");
     if (mid == 0)     {
          printf("Can't find NackListnerFrame.start \n");
          return 1;
     (env)->CallStaticVoidMethod((_jclass*)cls, (_jmethodID*)mid, NULL);
     jthrowable e = (env)->ExceptionOccurred();
     if (e)     {
          env->ExceptionDescribe();
          env->ExceptionClear();
     if ((jvm)->DestroyJavaVM() < 0)     {
          printf("Cannot destroy JVM./n");     
     return 0;
I deliberately left out the codebelow because I want the JVM I created to load Classes from the system's CLASSPATH variable as I have set path to every classes that I need, in that CLASSPATH variable.
JavaVMOption     options[1];
options[0].optionString=
"-Djava.class.path=.;E:/DDSproject/DDSImplementation/classes";
vm_args.options = options;
vm_args.nOptions = 1;
But it seems like unless I specify CLASSPATH in my C++ source code the JVM could not find any classes.
I tried to put the "jvm.dll" path to the first one in the System's PATH variable. It does not work either...
Gurus Pls help!!!.. I don't know what to do... I don't wanna code my CLASSPATH in my c++ source code as above.
Thanks in advance,
chancellor

I was thinking JVM should the classpath when it is invoked. But obviously it is not and we need to assign the classpath ourselves when invoking from native side. Thanks for pointing that out. For other people's benefit the following is the code piece I for initializing JVM.
char* str1;
          char* str2;
          char* classpath;
          str1 = "-Djava.class.path=";
          str2 = std::getenv("CLASSPATH");
          classpath = (char*)malloc(strlen(str1) + strlen(str2) + 1);
          strcpy(classpath, str1);
          strcat(classpath, str2);
          if (str2 == NULL)     {
               printf("CLASSPATH environment variable is not defined.");
               exit(1);
          m_VmArgs.version = JNI_VERSION_1_4;
          m_options[0].optionString= classpath;
          m_VmArgs.options = m_options;
          m_VmArgs.nOptions = 1;
          m_VmArgs.ignoreUnrecognized = JNI_TRUE;
          JNI_GetDefaultJavaVMInitArgs(&m_VmArgs);
          /* Create the Java VM */
          m_Res = JNI_CreateJavaVM(&m_Jvm, (void**)&m_Env, &m_VmArgs);
          if (m_Res < 0) {
               printf("Can't create JVM\n");
               exit(1);
thanks,
chancellor

Similar Messages

  • ResourceBundle throws MissingResourceException when calling Java from C

    All,
    Our code calls Java from C application.
    The C code create JVM using JNI_CreateJavaVM. Due to internal design issues we don't
    create the JVM with a "-classpath" option.
    After creating the JVM, we create a ClassLoader (URLClassLoader), with a URL list as it's classpath.
    The last step in the C code is to load a Java class using the C reference to URLClassLoader.loadClass
    (I will refer to this class as classA), and than call one of it's static methods.
    Please notice that classA is not instantiated, we call a static method.
    At this point we are moving to the Java code...
    In the Java static method we call ResourceBundle.getBundle("resources.messages"),
    the result is ResourceBundle throws MissingResourceException.
    - The JAR hosting "resources/messeges.properties" (refer as jarA) is include in the
    ClassLoader URL paths we used for loading the Java class.
    - Using a debugger we can see that ClassLoader.getSystemClassLoader() don't contain
    jarA in it's URL list.
    - Using the debugger we see that classA.class.getClassLoader() does contain
    jarA in it's URL list.
    After some investigation we see that ResourceBundle.getBundle calles to ResourceBundle.getLoader:
    private static ClassLoader getLoader() {
            Class[] stack = getClassContext();
            /* Magic number 2 identifies our caller's caller */
            Class c = stack[2];
            ClassLoader cl = (c == null) ? null : c.getClassLoader();
            if (cl == null) {
                cl = ClassLoader.getSystemClassLoader();
            return cl;
        } getClassContext() - native method, this can explain the why the above work fine for Windows.
    I suspect the problem raised in the above code. Since I couldn't get a debug
    version of rt.jar for Solaris, I need some help.
    Our environment is Solaris 8, Java 1.5.
    Please note that the same code works fine on WindowsXP with the same Java version!
    Thanks,
    Avi

    I was thinking JVM should the classpath when it is invoked. But obviously it is not and we need to assign the classpath ourselves when invoking from native side. Thanks for pointing that out. For other people's benefit the following is the code piece I for initializing JVM.
    char* str1;
              char* str2;
              char* classpath;
              str1 = "-Djava.class.path=";
              str2 = std::getenv("CLASSPATH");
              classpath = (char*)malloc(strlen(str1) + strlen(str2) + 1);
              strcpy(classpath, str1);
              strcat(classpath, str2);
              if (str2 == NULL)     {
                   printf("CLASSPATH environment variable is not defined.");
                   exit(1);
              m_VmArgs.version = JNI_VERSION_1_4;
              m_options[0].optionString= classpath;
              m_VmArgs.options = m_options;
              m_VmArgs.nOptions = 1;
              m_VmArgs.ignoreUnrecognized = JNI_TRUE;
              JNI_GetDefaultJavaVMInitArgs(&m_VmArgs);
              /* Create the Java VM */
              m_Res = JNI_CreateJavaVM(&m_Jvm, (void**)&m_Env, &m_VmArgs);
              if (m_Res < 0) {
                   printf("Can't create JVM\n");
                   exit(1);
    thanks,
    chancellor

  • An error when calling DAQmx from TestStand

    Hi,
    I get very mystic error when calling DAQmx Create Channel (Digital input) and DAQmx Read (Digital Bool 1Line 1Point) vis. Difficulty is that it does not occur every time. It is random. Any ideas what might cause this error? I uninstalled Traditional DAQ drives because they are not in use but it does not help.
    Please, see attachment.
    BR,
    Jick
    Attachments:
    daqerror.PNG ‏80 KB

    Here is some additional information. See attachments.
    I can not get that error using MAX or looping it only. There is something else outside which causes the error. It can not be Traditional DAQ because I uninstalled it. These vis are running in a loop during the test in the batchmodel.
    BR,
    Jick
    Attachments:
    daqerror2.PNG ‏33 KB
    daqerror3.PNG ‏15 KB

  • Error when calling Java Web Services from ABAP.

    Hello experts:
        In my project, I will call Java Web Services with ABAP coding. With WSDL, I generated a proxy class and created a HTTP connection (t-code: SM59) and a logical port (t-code:lpconfig) for this proxy class. But when running, I would receive the folllowing errors:
       SOAP:1.023 SRT: Processing error in Internet Communication Framework: ("ICF Error when receiving the response: HTTP COMMUNICATION FAILURE")
       If I used HTTPS, there is no problem.
    Regards
    Bob

    Hi Bob,
    It might be the possibility that your java web server is configured to listen only on HTTPS.
    If your HTTPS is working fine, then first check with your JAVA server for HTTP connectivity, then try it calling through ABAP.
    Regards,
    Piyush

  • BEx Web: Java Error when calling query from Query Designer

    When designing a query in the designer and executing it via the portal,
    I get the following error:
    com.sap.ip.bi.base.application.variableprocessor.IVariableProcessor.synchronizeStateVariables()V
    The complete exception is:
    com.sap.ip.bi.webapplications.runtime.controller.MessageException: Error while calling the method "processDialogCommand"     at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2366)     at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:841)     at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:775)     at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:412)     at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:21)     at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)     at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)     at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)     at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)     at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)     at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)     at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)     at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)     at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)     at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)     at java.security.AccessController.doPrivileged(Native Method)     at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)     at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)     at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)     at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)     at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)     at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)     at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)     at java.security.AccessController.doPrivileged(Native Method)     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)Caused by: com.sap.ip.bi.base.exception.BIBaseRuntimeException: Error while calling the method "processDialogCommand"     at com.sap.ip.bi.util.MethodInvoker.callMethod(MethodInvoker.java:116)     at com.sap.ip.bi.webapplications.runtime.command.CommandProcessorHelper.processCommand(CommandProcessorHelper.java:439)     at com.sap.ip.bi.webapplications.runtime.command.CommandProcessorHelper.processCommand(CommandProcessorHelper.java:325)     at com.sap.ip.bi.webapplications.runtime.base.CommunicationProcessor.processCommand(CommunicationProcessor.java:144)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandSuper(Page.java:1451)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandInternal(Page.java:1439)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandSequence(Page.java:2022)     at com.sap.ip.bi.webapplications.runtime.impl.Page.displayVariableScreen(Page.java:1845)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processCommandSequence(Page.java:2069)     at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:2755)     at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2288)     ... 36 moreCaused by: java.lang.NoSuchMethodError: com.sap.ip.bi.base.application.variableprocessor.IVariableProcessor.synchronizeStateVariables()V     at com.sap.ip.bi.webapplications.ui.dialogs.variablescreen.DlgVariable.doUiDialogInit(DlgVariable.java:259)     at com.sap.ip.bi.webapplications.ui.dialogs.framework.UiDialog.doInit(UiDialog.java:164)     at com.sap.ip.bi.webapplications.runtime.base.PageObject.init(PageObject.java:244)     at com.sap.ip.bi.webapplications.runtime.base.Dialog.init(Dialog.java:72)     at com.sap.ip.bi.webapplications.runtime.base.Dialog.processCommand(Dialog.java:168)     at com.sap.ip.bi.webapplications.runtime.base.CommunicationProcessor.processDialogCommand(CommunicationProcessor.java:99)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     at java.lang.reflect.Method.invoke(Method.java:324)     at com.sap.ip.bi.util.MethodInvoker.callMethod(MethodInvoker.java:101)     ... 46 more
    The HP LEvel on the Java Stack is 10, on Te ABAP Stack it is 11.
    Any ideas?
    Thanks in advance, Thom

    Did you check these posts:
    Unable to publish in IE with BEx Query Designer
    Web Analyzer Execute failed- System received an expired SSO ticket
    null

  • XML Deserialization Error when calling WebService from WebDynrpo

    Hi all,
    when calling a WebService-method from my WebDynpro-application, I get the following error message:
    "Deserializing fails. Nested message: XML Deserialization Error. Can not create instance of class [com.karmann.ApplMan.dto.SoftwareKomponenteDTO] when deserializing XML type [urn:com.karmann.ApplMan.dto][SoftwareKomponenteDTO].."
    SoftwareKomponenteDTO is a class that I have implemented. It implements Serializable and overwrites the methods "equals()" and "hashcode()". It contains members of types long, String and java.sql.Date.
    The method I call needs an argument of type SoftwareKomponenteDTO. Other methods which return something of type SoftwareKomponenteDTO do not make any problems.
    The same error message appears when I test the WebService-method in the WebService-navigator. So I assume that the problem is not the way I call the method from WebDynpro.
    Thanks for help,
    Christoph

    Thanks for this hint, Amar. But this points directly to my next problem: How can I set this parameter. I know how to set flat parameters (e.g. of type long, boolean, etc.). But how can I set a parameter of a complex type?
    For example I can call
        wdContext.currentSaveElement().setIdFather(long id)
    in order to set the parameter idFather of type long for the WebService-method save(). But there is no method
         wdContext.currentSaveElement().setIdFather(SoftwareKomponenteDTO aKomp)
    Could you please help me on more time?
    Kind regards,
    Christoph

  • Error when call javabean from form6i

    I try to call javabean from Form6i. I have downlaoded four excample from Oracle Sample Code. But I can't run the example whenever from Form Builder or browser. When I run the html in IE or Natscape browser, I meet a eorror message :
    java.lang.NoClassDefFound Error: sun/applet/AppletViewer
    I have copy all example classes into e:\orant\forms60\java\oracle\forms\demos\ directory and the jar file copy into e:\orant\forms60\java directory.
    Inside the html I set the codebase to e:\orant\forms60\java.
    Is there any error or I still need to set some anothers settings?
    Help please?
    null

    Hi Adnan
    I have configured my apps similary the example in
    \orant\tools\devdem60\web then it rans fine.
    Thanks,
    Ruy Chicaco.
    Adnan Imtiaz (guest) wrote:
    : Hi there,
    : I'm facing the same problem myself...but mine goes into doing
    : something & returns an "Internal Error" message in the
    : browser....
    : Try running the static HTML file from its directory & see
    whether
    : that even runs or not....
    : Any helpp would be greatly appreciated.....
    : Thanks.
    : Ruy chicaco (guest) wrote:
    : : I have used OAS 4.0.7 with yt40.dll upgraded, NT 4.0
    : : SP4 and Developer 6.
    : : I have configured application cartridge according Developer6
    : : Server doc instructions.
    : : When I call fmx from browser Netscape 4.6
    : : (http://hostname/webforms?module=fmx_name) the error "Applet
    : : oracle.forms.engine.Main class oracle.forms.engine.Main could
    : not
    : : be loaded".
    : : OAS inserts in file \orant\ows\website40\log the message
    : : "Parameter module is missing from URL and cartridge settings"
    : : Can anybody help me please?.
    : : Ruy Chicaco
    null

  • Error when call fmx from browser

    I have used OAS 4.0.7 with yt40.dll upgraded, NT 4.0
    SP4 and Developer 6.
    I have configured application cartridge according Developer6
    Server doc instructions.
    When I call fmx from browser Netscape 4.6
    (http://hostname/webforms?module=fmx_name) the error "Applet
    oracle.forms.engine.Main class oracle.forms.engine.Main could not
    be loaded".
    OAS inserts in file \orant\ows\website40\log the message
    "Parameter module is missing from URL and cartridge settings"
    Can anybody help me please?.
    Ruy Chicaco
    null

    Hi Adnan
    I have configured my apps similary the example in
    \orant\tools\devdem60\web then it rans fine.
    Thanks,
    Ruy Chicaco.
    Adnan Imtiaz (guest) wrote:
    : Hi there,
    : I'm facing the same problem myself...but mine goes into doing
    : something & returns an "Internal Error" message in the
    : browser....
    : Try running the static HTML file from its directory & see
    whether
    : that even runs or not....
    : Any helpp would be greatly appreciated.....
    : Thanks.
    : Ruy chicaco (guest) wrote:
    : : I have used OAS 4.0.7 with yt40.dll upgraded, NT 4.0
    : : SP4 and Developer 6.
    : : I have configured application cartridge according Developer6
    : : Server doc instructions.
    : : When I call fmx from browser Netscape 4.6
    : : (http://hostname/webforms?module=fmx_name) the error "Applet
    : : oracle.forms.engine.Main class oracle.forms.engine.Main could
    : not
    : : be loaded".
    : : OAS inserts in file \orant\ows\website40\log the message
    : : "Parameter module is missing from URL and cartridge settings"
    : : Can anybody help me please?.
    : : Ruy Chicaco
    null

  • Getting ie error when calling event from code.

    Hi all!
    I've got an application (running on 6.40 sp8, ep6 sp2) that is pretty basic by all means. Since I want to implement some way to tell the user when he/she has made an error or just to inform him/her about something, I decided to use the ConfirmationDialog.
    I've created an action called onActionShowErrorMessage in my view. This action is tied to my controller and an event defined in the controller.
    Hence, when I want to show the ConfirmationDialog to show the user an error message, I call the controller method and in the method I fire the event that my view method is looking for.
    So far so good..
    When I call my controller method from a button action in the view everything works nicely, but when I try to call it from the wdInit method it fails?! I do get the ConfirmationDialog up but I also get an IE error window telling me that IE is trying to open a page it cannot find. I have no idea why it tries to open any page at all, since there is no navigation defined for this action.
    Anyone got an idea? I couldn't find any good stuff in the system logs either
    Best regards,
    Andreas

    Hello Sam!
    Thanks for your answer! I would like to use something more of a pop thing, since i want to make sure the user sees it. The MessageManager does not work as good as it used to anymore, since it puts all messages in the bottom of the page. This page needs to be scrolled in order to see the error message..
    Anyone got an idea of a workaround? I'm reading a propsfile, and in case I'm not able to read it I want to display this to the user.
    B.R
    Andreas

  • Getting 500 Error when calling XI from Siebel

    Hi,
      We have generated a WSDL file from XI and gave it to Siebel team. They are getting a 500 Error when they try to call us using that WSDL file. Below is the error message they are getting.
    "[1] Error Invoking service 'MI_SIEBEL_WS_ORDER_TOXI_OUT', method 'MI_SIEBEL_WS_ORDER_TOXI_OUT' at step 'Call Web Service'. (SBL-BPR-00162).
    [2] HTTP Request error during 'Submitting Data Send HTTP request': 'Status code -500'(SBL-EAI-04117)"
    Thanks in advance for the help.
    Thanks
    Kumar

    Hi,
    Are you sure your Sender SOAP adapter is configured properly. Also ensure that the SIEBEL team is using the right URL to communicate to the SOAP adapter.
    First try using SOAP Client and see if the scenario is working fine. If so then the problem lies in SIEBEL.
    Check this link for confiuring SOAP sender
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/5ad93f130f9215e10000000a155106/content.htm
    Thanks,
    Pakash

  • Error when calling webservice from oracle function.

    Hi,
    I am getting following error when i am trying to call webserivce from oracle function. Please can anyone suggest the required solution. Below is the error obtained.
    Thanks.
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00225: end-element tag "UL" does not match start-element tag "P"
    Error at line 15
    ORA-06512: at "SYS.XMLTYPE", line 54
    ORA-06512: at "SCOTT.DEMO_SOAP", line 87
    ORA-06512: at "SCOTT.WEB_SERVICE", line 17

    The error message implies that the web service is returning something that is not well formed xml. Can you verify what is being returned by the web service call

  • Possible thread issues when calling java from C++/Delphi/C#

    Hi,
    We have a java API for one of our applications. This API has wrapper API's in C++, Delphi and C#. There are two main top level classes in te API - Client and Receiver. Both haave a receive() method.
    We used to ship JRE1.3 with the API installation - this was needed to suport the user applications. Recently we haev moved to java 1.4 as the least suported version.
    We have two ways of using the java API in our wrapper API's.
    Method one, we instantiate the client, and call client.receive(). There are no threads etc involved here. This is working fine.
    In the second method, we set a callback on the client, which starts a thread (in C++/Delphi or C#) which calls receiver.receive() and tries to get the message. This is failing.
    It fails at a line which simply says "DocumentBuilderFactory.newInstance()".
    This call has already been made when connecting the client and it is successful because we can see the client connected.
    Whether we do client.receive() or receiver.receive() in a thread, the code passes through this line.But is throwing the exception only when we come to it through a thread.
    Any ideas on what I need to watch out for when calling methods on a JVM from a thread in C++/Delphi or C#?
    Thanks
    Hari
    PS: I know we are using some really old versions, but thats needed and out of my control.

    Hi,
    I managed to solve this - finally!
    This is what was the cause in our case - should apply to all situations though.
    We had the Xerces classes packaged in a custom jar file along with other XML stuff we have. And this mega-jar was on the class path.
    We were running everything on Java 1.3 and it worked fine.
    But Java 1.4 wrecked all havoc.
    So here is what I did:
    1. I tried explicitly doing Class.forName() with the name of the Xerces class that was not found. I did this at the same point in the code where the exception was being thrown.
    2. The class was successfully loaded indicating that it was on the class path somewhere.
    3. Java 1.4 made some changes in terms of class loaders - so suspecting that, I tried printing out the System and the Context class loaders at the point where the exception was being thrown - the system class loader was a valid object, but context class loader was null
    4. We have another point in the code base where the exact same lines were used, and these are getting successfully executed even in the multi threaded situation - this is the start up sequence.
    5. I printed the two class loaders at this point - they are both valid objects, no nulls.
    With this, I narrowed down the scope and was convinced that the class loaders are the cause.
    A search on Google and after looking the the source code for Xerces, we realized that the Xerces API uses the Context Class Loader to resolve and load the DocumentFactoryImpl class - this change is from Java 1.4 onwards.
    In our case, the JNI AttachCurrentThread method called from C++/C# and Delphi was attaching the thread to the JVM, but each time the context class loader was null.
    We could not find anything on how we could make the method to put a non null context classloader.
    So, we changed all our JNI interfaces to do the following
    //attach the current thred
    jvm->AttachCurrentThread(...)
    //now get the system class loader and set it as the context class loader on the current thread
    //get things from the Thread class
    jclass thread = get the thread class
    jmethod currentThread = get the static method currentThread()
    jobject thread_object = get the current thread object into this
    jmethod setContextClassLoader = get the setContextClassLoader() method on the thread
    //get the SystemClassLoader
    jclass clsLoader = get the class for ClassLoader
    jmethodid getSysClsLoader = get the method ID for the getSystemClassLoader() method
    jobect sysClsLoader = get the system class loader by calling the above method
    //set the context class loader on the thread by calling set context class loader with the sys class loader as the argumentUnfortunately I don't have the code with me right now,otherwise would have shared the same.

  • Error When Call WebService from WebDynpro

    Hi,
    I´m with this error when i execute* the web service that i created on my WebAS:
    Request_CalculatorWSViDocument_add req = new Request_CalculatorWSViDocument_add();
    wdContext.nodeRequest_CalculatorWSViDocument_add().bind(req);
    wdContext.currentRequest_CalculatorWSViDocument_addElement().modelObject().setX(x);
    wdContext.currentRequest_CalculatorWSViDocument_addElement().modelObject().setY(y);
    wdContext.currentRequest_CalculatorWSViDocument_addElement().modelObject().execute();
    java.lang.NoSuchMethodError: com.sap.engine.services.webservices.jaxrpc.wsdl2java.BaseGeneratedStub._initParameter(Lcom/sap/engine/services/webservices/jaxrpc/wsdl2java/ServiceParam;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
         at br.com.softtek.model.proxies.Config1BindingStub.add(Config1BindingStub.java:58)
         at br.com.softtek.model.proxies.Config1BindingStub.add(Config1BindingStub.java:101)
         at br.com.softtek.model.Request_CalculatorWSViDocument_add.execute(Request_CalculatorWSViDocument_add.java:91)
         at br.com.softtek.comp.CalculatorComp.executeOperation(CalculatorComp.java:217)
         at br.com.softtek.comp.wdp.InternalCalculatorComp.executeOperation(InternalCalculatorComp.java:214)
         at br.com.softtek.comp.CalculatorCompView.onActionAdd(CalculatorCompView.java:143)
         at br.com.softtek.comp.wdp.InternalCalculatorCompView.wdInvokeEventHandler(InternalCalculatorCompView.java:173)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:711)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:665)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:232)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:152)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Any idea?
    Regards,
    Bruno

    Hi tulasi,
    My WebService uses "Simple SOAP".
    Naga Raju Meesala,
    The WebService type is "WebService Mode"l.
    Any idea?
    Regards,
    Bruno

  • Getting error when calling Java program from JSP page.

    Hi All,
    I'm getting below error msg, previously the page use to display and also java program use to run properly, but suddenly today i came across this error. May be some settings have been changed on my server, since number of developers uses this common webserver here.
    Any help would be much appreciated. Pls let me know if if anyone requires much info regarding this one.
    javax.servlet.ServletException: sun/tools/javac/Main
         at java.lang.Throwable.fillInStackTrace(Native Method)
         at java.lang.Throwable.fillInStackTrace(Compiled Code)
         at java.lang.Throwable.(Compiled Code)
         at java.lang.Exception.(Compiled Code)
         at javax.servlet.ServletException.(Compiled Code)
         at org.apache.jasper.servlet.JspServlet.service(Compiled Code)
         at javax.servlet.http.HttpServlet.service(Compiled Code)
         at org.apache.tomcat.core.ServletWrapper.doService(Compiled Code)
         at org.apache.tomcat.core.Handler.service(Compiled Code)
         at org.apache.tomcat.core.ServletWrapper.service(Compiled Code)
         at org.apache.tomcat.facade.RequestDispatcherImpl.doForward
    Root cause:
    java.lang.NoClassDefFoundError: sun/tools/javac/Main
         at org.apache.jasper.compiler.SunJavaCompiler.compile(Compiled Code)
         at org.apache.jasper.compiler.Compiler.compile(Compiled Code)
         at org.apache.jasper.servlet.JspServlet.doLoadJSP(Compiled Code)
         at org.apache.jasper.servlet.JasperLoader12.loadJSP(Compiled Code)
         at org.apache.jasper.servlet.JspServlet.loadJSP(Compiled Code)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(Compiled Code)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Compiled Code)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(Compiled Code)
         at org.apache.jasper.servlet.JspServlet.service(Compiled Code)
    Message was edited by:
    shukla_arvind

    did u happen to upgrade ur jdk?????

  • Getting an error when calling Java System Report from Moniroring in NWA

    Here is the deatils error message. Not quite sure what is referring to .
    The initial exception that caused the request to fail, was:
       java.lang.NullPointerException
        at com.sap.engine.admin.model.performance._gen.HistoryData$Impl.getHistoryGranularities(HistoryData.java:103)
        at com.sap.webadmin.performance.viewer.comp.wdp.IPublicDataController$IHistoryGranularitiesTNode.doSupplyElements(IPublicDataController.java:1488)
        at com.sap.tc.webdynpro.progmodel.context.Node.supplyElements(Node.java:406)
        at com.sap.tc.webdynpro.progmodel.context.Node.getElementList(Node.java:345)
        at com.sap.tc.webdynpro.progmodel.context.Node.createMappedElementList(Node.java:498)
    Thanks
    Bani

    Hi - Were you able to resolve the above error. I am also having a similar problem and I would like to know your resolution on this.
    Thanks in advance.

Maybe you are looking for

  • Removing warning for "Default CSS file not found."

    I am getting this warning in Flash Builder: "Default CSS file not found." I can not for the life of me figure out how to get rid of it. Any suggestions?

  • Moving car at Time/Date for 11 hours

    Hi, I'm making a timeline with a moving car. It has to go from left to right in about 11 hours. I got this code and the car is moving from left to right: import fl.transitions.Tween; import fl.transitions.easing.*; import fl.transitions.TweenEvent; b

  • Org Unit with more than one Chief Position

    Hi, we have implemented MSS via the portal using a one-to-one relationship between Org Units and Chief Positions, and we would now like to have multiple Chief positions attached to one Org Unit. As far as I can tell from the SAP documentation, this s

  • Custom tag problem (parent/child tag)

    I have a table tag and a column tag that I'm using in my application to display records. The first time through it sets up headers and keeps a coun't of the columns. The second time through it starts putting data in the fields. The problem I'm having

  • Signed Applet not loading.

    Hi all, Im currently using an applet that is signed. It works on java 1.4 but not on 1.6. Im not sure on hwo to make it work with 1.6 i tried the java control panel stuffs and the clearing my browser history stuffs too. I get this error from the cons