I get EXCEPTION_ACCESS_VIOLATION by calling JNI function.

Hello Everyone.
I need someone's help that I have a problem with JNI.
I got an error as below when a Java program calls JNI function that I created with VC++.
JNI functions are called not once and got an error not first call.
First of all, The JNI function is called at Main function.
then, Main function create another thread.
and next JNI function is called in another thread.
when the JNI function is called first time is suceeded.
but, second time is always failed.
I wrote down some of detail in source code's comment.
// ErrorLog is from here ------------------------------------------------------
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d7c7c5f, pid=2460, tid=3144
# Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode)
# Problematic frame:
# V [jvm.dll+0x87c5f]
--------------- T H R E A D ---------------
Current thread (0x00843650): JavaThread "Thread-0" [_thread_in_vm, id=3144]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000009
Registers:
EAX=0x00000001, EBX=0x06d77d40, ECX=0x00000008, EDX=0x00843710
ESP=0x0afaf4a8, EBP=0x0afaf4d8, ESI=0x0afaf4ec, EDI=0x0afaf53c
EIP=0x6d7c7c5f, EFLAGS=0x00010246
Top of Stack: (sp=0x0afaf4a8)
0x0afaf4a8: 0afaf4ec 06d77d40 6d7cfa7e 00000001
0x0afaf4b8: 0afaf53c 0afaf4ec 06d77d40 00843070
0x0afaf4c8: 00841a10 00841a18 00841e04 00843650
0x0afaf4d8: 0afaf53c 100020a6 00843710 0082f3d0
0x0afaf4e8: 0afaf5a0 0afaf5a4 06d77d40 06d77d40
0x0afaf4f8: cccccccc cccccccc cccccccc cccccccc
0x0afaf508: cccccccc cccccccc cccccccc cccccccc
0x0afaf518: cccccccc cccccccc cccccccc cccccccc
Instructions: (pc=0x6d7c7c5f)
0x6d7c7c4f: 5f 5e 5b c3 8b 44 24 04 8b 0d 14 e2 8b 6d 53 56
0x6d7c7c5f: 8b 34 01 8b 0d 10 e2 8b 6d 57 8b 3c 01 8b 0d 0c
Stack: [0x0af70000,0x0afb0000), sp=0x0afaf4a8, free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x87c5f]
C [FilterDriver.dll+0x20a6]
C [FilterDriver.dll+0x16c7]
C [FilterDriver.dll+0x1c59]
C [FilterDriver.dll+0x22b3]
j xx.xx.xx.xx.xx.TestClass.get(Ljava/lang/String;)Z+0
j xx.xx.xx.xx.xx.ClassExtendedThread.run()V+24
v ~StubRoutines::call_stub
V [jvm.dll+0x875dd]
V [jvm.dll+0xdfd96]
V [jvm.dll+0x874ae]
V [jvm.dll+0x8720b]
V [jvm.dll+0xa2089]
V [jvm.dll+0x1112e8]
V [jvm.dll+0x1112b6]
C [MSVCRT.dll+0x2a3b0]
C [kernel32.dll+0xb683]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j xx.xx.xx.xx.xx.TestClass.get(Ljava/lang/String;)Z+0
j xx.xx.xx.xx.xx.ClassExtendedThread.run()V+24
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x008433b0 JavaThread "DestroyJavaVM" [_thread_blocked, id=2676]
=>0x00843650 JavaThread "Thread-0" [_thread_in_vm, id=3144]
0x0083d5f0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2024]
0x0083c730 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3444]
0x0083b560 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2784]
0x00839970 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=2876]
0x00838c60 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=2980]
0x00836250 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=536]
0x0082e410 JavaThread "Finalizer" daemon [_thread_blocked, id=2100]
0x0082d190 JavaThread "Reference Handler" daemon [_thread_blocked, id=1968]
Other Threads:
0x0082c470 VMThread [id=296]
0x0083fd50 WatcherThread [id=464]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 300K [0x02bd0000, 0x02c70000, 0x030b0000)
eden space 512K, 58% used [0x02bd0000, 0x02c1b200, 0x02c50000)
from space 64K, 0% used [0x02c50000, 0x02c50000, 0x02c60000)
to space 64K, 0% used [0x02c60000, 0x02c60000, 0x02c70000)
tenured generation total 1408K, used 0K [0x030b0000, 0x03210000, 0x06bd0000)
the space 1408K, 0% used [0x030b0000, 0x030b0000, 0x030b0200, 0x03210000)
compacting perm gen total 8192K, used 1711K [0x06bd0000, 0x073d0000, 0x0abd0000)
the space 8192K, 20% used [0x06bd0000, 0x06d7bf00, 0x06d7c000, 0x073d0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040d000      C:\Program Files\Java\jdk1.5.0_14\bin\javaw.exe
0x7c940000 - 0x7c9dd000      C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c932000      C:\WINDOWS\system32\kernel32.dll
0x77d80000 - 0x77e29000      C:\WINDOWS\system32\ADVAPI32.dll
0x77e30000 - 0x77ec1000      C:\WINDOWS\system32\RPCRT4.dll
0x77cf0000 - 0x77d7f000      C:\WINDOWS\system32\USER32.dll
0x77ed0000 - 0x77f17000      C:\WINDOWS\system32\GDI32.dll
0x77bc0000 - 0x77c18000      C:\WINDOWS\system32\MSVCRT.dll
0x762e0000 - 0x762fd000      C:\WINDOWS\system32\IMM32.DLL
0x60740000 - 0x60749000      C:\WINDOWS\system32\LPK.DLL
0x73f80000 - 0x73feb000      C:\WINDOWS\system32\USP10.dll
0x6d740000 - 0x6d8de000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\client\jvm.dll
0x76af0000 - 0x76b1b000      C:\WINDOWS\system32\WINMM.dll
0x6d300000 - 0x6d308000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\hpi.dll
0x76ba0000 - 0x76bab000      C:\WINDOWS\system32\PSAPI.DLL
0x6d400000 - 0x6d435000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\jdwp.dll
0x6d710000 - 0x6d71c000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\verify.dll
0x6d380000 - 0x6d39d000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\java.dll
0x6d730000 - 0x6d73f000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\zip.dll
0x6d290000 - 0x6d297000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\dt_socket.dll
0x719e0000 - 0x719f7000      C:\WINDOWS\system32\WS2_32.dll
0x719d0000 - 0x719d8000      C:\WINDOWS\system32\WS2HELP.dll
0x71980000 - 0x719bf000      C:\WINDOWS\System32\mswsock.dll
0x76ed0000 - 0x76ef7000      C:\WINDOWS\system32\DNSAPI.dll
0x76f60000 - 0x76f68000      C:\WINDOWS\System32\winrnr.dll
0x76f10000 - 0x76f3c000      C:\WINDOWS\system32\WLDAP32.dll
0x76f70000 - 0x76f76000      C:\WINDOWS\system32\rasadhlp.dll
0x607c0000 - 0x60816000      C:\WINDOWS\system32\hnetcfg.dll
0x719c0000 - 0x719c8000      C:\WINDOWS\System32\wshtcpip.dll
0x10000000 - 0x10076000      C:\xx\whaticreated.dll
0x71a50000 - 0x71a62000      C:\WINDOWS\system32\MPR.dll
VM Arguments:
jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:1759
java_command: xx.xx.xx.xx.xx.Sample start
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.5.0_14
PATH=C:\WINDOWS\system32;C:\WINDOWS;D:\tools\apache-ant-1.7.0\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;D:\PROGRA~1\ATT\Graphviz\bin;D:\Program Files\doxygen\bin;D:\Program Files\Microsoft SDK\Bin\.;D:\Program Files\Microsoft SDK\Bin\WinNT\.;C:\Program Files\Java\jdk1.5.0_14\bin;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;D:\Program Files\Microsoft SDK\Bin\.;D:\Program Files\Microsoft SDK\Bin\WinNT\.
USERNAME=xxx
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 2, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 (cores per cpu 2, threads per core 1) family 6 model 15 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2
Memory: 4k page, physical 1038124k(270512k free), swap 1711740k(953716k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0
// The end of ErrorLog --------------------------------------------------------
and the codes are below.
// TestClass.java
public class TestClass {
     // Load native library
     static{
          System.loadLibrary("DLLName");
     public native int start(String str, int count);
     public native int end();
     public native boolean get(String str);
// ClassExtendedThread.java
public class ClassExtendedThread extends Thread {
     private TestClass tc;
     // Constructor
     public ClassExtendedThread(TestClass in_tc)
          ts = in_tc;
     // This will be executing in another thread
     public void run()
          while( true )
               if( !false )
                    String str = new String();
                    // get function returns false means nothing to catch event.
                    if( false == ts.get( str ) ) // calling first time is suceed. but, I got an error second time.
                      // Set Interval for loop.
// Sample.java
public class Sample {
     public static void main(String[] args) {
          TestClass tc = null;
          ClassExtendedThread cet = null;
          tc = new TestClass();
          // Init something
          if(0 != TestClass.start(xxx, xxx)) // First JNI function suceeds.
               System.out.println("start error.");
               return;
          // Starting Thread
          cet = new ClassExtendedThread(tc);
          cet.start();
}Have anyone got any idea to resolve this problem?
Edited by: fc3srx7m on Apr 25, 2008 3:56 AM

Hi Martin.
Thank you for your advice.
I thought the problem is in the FilterDriver.dll as well.
I tried DebugBreak() into native code.
but, I still can't find where the problem is.
I'm trying to convert C structure to Java class like using structConverter which is tool of book for JNI.
Here's some code including native code.
// Java source codes //////////////////////////////////////////////////////////////////////////////////
// Event.java ----------------------------------------------------------------------------------------------
// This class for C structure Convert
public class Event {
     private int     aaa;
     private long     bbb;
     private String     ccc;
        // Getter/Setter
     public int getAaa() {
          return aaa;
     public void setAaa(int aa) {
          aaa = aa;
     public long getBbb() {
          return bbb;
     public void setBbb(long cc) {
          bbb = bb;
     public String getCcc() {
          return ccc;
     public void setCcc(String cc) {
          ccc = cc;
        // Field Initialize
     private native static void initFIDs();
     static {
          initFIDs();
// EventStruct,java --------------------------------------------------------------------------------------
public class EventStruct extends Event {
     private void _init()
          setAaa(0);
          setBbb(0);
          setCcc(new String());
     // Constructor
     public LogEventStruct()
          _init();
          System.loadLibrary("FilterDriver");
// EndOfJavaSource ////////////////////////////////////////////////////////////////////////////////////
// Native source code /////////////////////////////////////////////////////////////////////////////////
// Event.cpp ----------------------------------------------------------------------------------------------
// FieldIDs
static jfieldID Event_Aaa_FID;
static jfieldID     Event_Bbb_FID;
static jfieldID     Event_Ccc_FID;
// Initialize Adapter
static void initEventFieldIDs(JNIEnv* env, jclass clazz)
          Event_Aaa_FID     = env->GetFieldID(clazz, "aaa",     "I");
          Event_Bbb_FID     = env->GetFieldID(clazz, "bbb",      "J");
          Event_SFlNm_FID = env->GetFieldID(clazz, "ccc",      "Ljava/lang/String;");
// Call from Java
JNIEXPORT void JNICALL Java_Event_initFIDs(JNIEnv *env, jclass clazz)
          initEventFieldIDs(env, clazz);
// Setter
void jni_SetAaa_in_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisaaa)
          env->SetIntField(thisaaa, Event_Aaa_FID, (jint)__EVENT_->aaa);
// Getter
void jni_GetAaa_from_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisaaa)
          __EVENT_->aaa = (int)env->GetIntField(thisaaa, Event_Aaa_FID);
// Setter
void jni_SetBbb_in_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisbbb)
          env->SetLongField(thisbbb, Event_Bbb_FID, __EVENT_->bbb);
// Getter
void jni_GetBbb_from_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisbbb)
          __EVENT_->bbb = (unsigned int)env->GetLongField(thisbbb, Event_Bbb_FID);
// Setter
void jni_SetCcc_in_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisccc)
          env->SetObjectField(thisccc, Event_Ccc_FID, env->NewStringUTF(__EVENT_->ccc));
// Getter
void jni_GetCcc_from_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisccc)
          jboolean isCopy;
          const char *str = __EVENT_->ccc;
          jstring jstr = (jstring)env->GetObjectField(thisccc, Event_Ccc_FID);
          str = env->GetStringUTFChars(jstr, &isCopy);
          if(JNI_TRUE == isCopy)
                    env->ReleaseStringUTFChars(jstr, str);
// Getting (Java Object to C Structure)
void jni_SetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent)
          jni_SetAaa_in_Event(__EVENT_, env, thisEvent);
          jni_SetBbb_in_Event(__EVENT_, env, thisEvent);
          jni_SetCcc_in_Event(__EVENT_, env, thisEvent);
// Setting (C structure to Java Object)
void jni_GetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent)
          jni_GetAaa_from_Event(__EVENT_, env, thisEvent);
          jni_GetBbb_from_Event(__EVENT_, env, thisEvent);
          jni_GetCcc_from_Event(__EVENT_, env, thisEvent);
// AnotherLib.h ------------------------------------------------------------------------------------
// C Structure which I want to convert.
typedef struct EVT {
     int                  aaa;
     unsigned int    bbb;
     char               ccc[256];
} EVENT;
// prototype
BOOL GetEvent( EVENT* buf, char *name );
// test.h -----------------------------------------------------------------------------------------------------
#if !defined(AFX_TEST_H__F9A4A432_24D3_4DE4_89D7_A2009B8EC2AA__INCLUDED_)
#define AFX_TEST_H__F9A4A432_24D3_4DE4_89D7_A2009B8EC2AA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <windows.h>
#include "AnotherLib.h"
#include "Event.h" // output by javah command
extern void jni_GetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent);
extern void jni_SetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent);
#endif // !defined(AFX_TEST_H__F9A4A432_24D3_4DE4_89D7_A2009B8EC2AA__INCLUDED_)
// test.cpp --------------------------------------------------------------------------------------------------
JNIEXPORT jboolean JNICALL Java_get(JNIEnv *env, jobject obj, jstring name)
          EVENT s_Event;
          char strName[_MAX_PATH];
//DebugBreak();
          memset(&s_Event, 0x00, sizeof(EVENT));
          memset(strName, 0x00, _MAX_PATH);
          jni_SetAll_in_Event(&s_Event, env, obj);
          BOOL ret = GetEvent(&s_Event, strName);
          if(TRUE == ret)
                    jni_GetAll_in_Event(&s_Event, env, obj);
                    // convert char array to jstring
                    name = env->NewStringUTF(strName);
          return ret;
// EndOfNativeSource ////////////////////////////////////////////////////////////////////////////////Edited by: fc3srx7m on Apr 27, 2008 10:05 PM

Similar Messages

  • Getting "museJSAssert: Error calling selector function: Reference Error: Web Pro is not defined".

    First off, I am not a coding person. I decided to use Muse becuse I am good with Illustrator and Photoshop.
    The sight I built: www.speedcinch.com is now getting a bunch of errors when it initially was working fine. I am using godaddy for a host and using their ftp.
    This is the error I am getting now: museJSAssert: Error calling selector function: Reference Error: Web Pro is not defined
    You can see how my sight is supposed to work at http://speedcinchcom.businesscatalyst.com/index.html
    I have no idea what to do. Please help.

    Well, if nothing else I've ascertained that it's not GoDaddy's connectivity issue, as the issue continues late into today, and it does vary a bit per the other error reports. Using FileZilla there are just a few timeouts in the log, enough to give some pause but not necessarily (according to GD) disruptive. I've checked the list of uploaded files against the Muse Export folder contents and everything is there. In fact, the site looks good, buttons work, rollovers, etc, but there are no images. Like everyone else, this has cost me time and money in the last 24 hours.
    Let's see what the good people at Adobe live chat have to say, and I'll share it with you.

  • Getting Error while calling Flex function from JavaScript

    Hi,
    I have an aspx page, which shows charts as per dropdown selection,
    I am using flex charts for flex.In aspx page, i am calling an mxml function using javascript.below is the code for javascript in aspx.
    Javascript  code in aspx page:
    <script type="text/javascript">     
    function callApp(formid) {
        try {
                var objectChart = document.getElementById("statisticsChart");
                alert(objectChart.id);               
                objectChart.myFlexFunction(formid,get('<%=HiddenDashboardWS.ClientID %>').value);
        catch (e) {
            alert(e.message);
    function getDropDownListvalue() {
        var IndexValue = $get('<%=FormDropDownList.ClientID %>').selectedIndex;
        var SelectedVal = $get('<%=FormDropDownList.ClientID %>').options[IndexValue].value;
        //  alert(SelectedVal);
        callApp(SelectedVal);
    </script>
    Html code where dropdown control is placed
    <asp:DropDownList CssClass="combo" ID="FormDropDownList" runat="server" AutoPostBack="false"></asp:DropDownList>
    <object id="statisticsChart" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
    height="220" width="680">
        <param name="src" value="../swf/DashboardStatisticChart.swf" />
        <param name="flashVars" value="" />
        <embed name="statisticsChart" src="../swf/DashboardStatisticChart.swf" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" height="220" width="680" flashvars=""></embed>
    </object>
    Mxml code:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"  backgroundColor="white" creationComplete="initApp();" >
    <mx:script>
      public function initApp():void {
    ExternalInterface.addCallback("myFlexFunction",myFunc);
      public function myFunc(s:String,wsurl:String):void {
         Formid.text = s;
         webService.wsdl = wsurl;
         Alert.show("webservice");
    //Getdata calls webservice and gets xml data    
    GetData();
    //showchart() will draw chart
                     ShowChart();
    </mx:script>
    </mx:Application>
    Above code works perfect in ie, but in firefox, it gives An error saying “chartObject.MyFlexFunction is not a function”.
    I am getting the object in javascript in all the browsers, but not the functions!
    Does anyone has worked with this?
    Any help will be highly appreciated.
    Regards,
    Nirav Patel

    Found the solution from here... http://74.125.153.132/search?q=cache:4BC9BY04B5EJ:livedocs.adobe.com/flash/8/main/00002201 .html+externalinterface.addcallback+not+working&cd=1&hl=en&ct=clnk&gl=in
    Hope it will help others...
    Regards,

  • Calling JNI function

    I do have a question:
    there are two possibilities to make a JNI call,
    i.e. in C:
    jsting jstr = (*env)->NewStringUTF(env, "");
    or in C++:
    jsting jstr = env->NewStringUTF("");
    when i compile using (gcc, g++ respectively) the first line produces an
    base operand of `->' has non-pointer type `JNIEnv_'
    error while the compilation with the second line works without any problem.
    there are many example programs that use the syntax of the first line, but how does one get these things to work?

    env is defined as follows:
    JNIEnv *env;
    sure, i could use the other syntax but as the most examples in the web use the syntax as denoted in the first line i thought that it should work too. otherwise i would have to replace the syntax in these programs.

  • Help calling JNI function from a java thread

    I am using the following code to call a JNI fuction from a java thread:
    public class CMSMessageHandler extends MessageHandler{
    static{
    System.loadLibrary("jastb");
    public native int cmsReadIt(ByteBuffer buff);
    private ByteBuffer dirbuf = null;
    /** Creates a new instance of CMSMessageHandler */
    public CMSMessageHandler() {
    // allocate to max size datagram
    dirbuf = ByteBuffer.allocateDirect(65536);
    public void readMessages(){
    /*Thread worker = new Thread(){
    public void run(){*/
    int count;
    while (true){
    try{
    count = cmsReadIt(dirbuf);
    } catch (Exception e){
    e.printStackTrace();
    worker.start();*/
    public static void main(String[] args) {
    CMSMessageHandler handler = new CMSMessageHandler();
    handler.readMessages();
    When I run this main method with the thread commented out, it works great. When I run the main method with the thread, it works great for a while, and then funny things start happening with the native library I am using. My native library uses shared memory, signals, and semaphores. It feels a bit like my java program is stomping on the resources that my native library is using, when a run the java program with a thread.
    Is there something I don't know about calling native code from a thread? Should I be doing something explicitly to protect my native library's shared memory, signals, or semaphores?
    Thanks,
    Lisa.

    Does the library do any initialization when loaded? Does it make a dangerous assumption that the thead calling cmdReadIt will always be the same thread that initially loaded it? Try loading the library in the worker thread instead of in the main thread via the static initializer.Yes. There is a call to another native method cmsOpenIt that does CMS initialization. I put cmsOpenIt as well as the System.loadLibrary("jastb") in the worker thread and I'm still experiencing the same problems.
    Incidently, the mere presence of another Thread in this program does not seem to cause problems. It's only when I run calls to cmsReadIt in a thread that I get into trouble.
    For example, this works fine:
    public class CMSMessageHandler extends MessageHandler{
        public native int cmsReadIt(ByteBuffer buff);
        public ByteBuffer dirbuf = null;
        static {
            System.loadLibrary("jastb");
        public CMSMessageHandler() {
            // allocate to max size datagram
            dirbuf = ByteBuffer.allocateDirect(65536);
        public void readMessages(){
            try{
                int count = 0;
                while (true){
                    count = cmsReadIt(dirbuf);
            } catch (Exception e){
        public static void main(String[] args) {
            CMSMessageHandler handler = new CMSMessageHandler();
            Thread worker = new Thread(){
                public void run(){
                    while (true){
                        try{
                            Thread.currentThread().sleep(1000);
                            System.out.println("sleep thread.");
                        } catch (Exception e){
                            e.printStackTrace();
            worker.start();
            handler.readMessages();  
        }Are there JVM flags that I should experiment with that might help mitigate/diagnose this problem?

  • Temp table gets deleted when calling another function

    Hello Everyone
    I am using temporary tables which gets deleted on commit to workaround a multiset union (which doesnt work on Oracle 9). Now, this table somehow gets deleted (the content) during execution of my stored procedure but there is no delete or commit statement.
    Here is what I am doing
    start
    delete temp table (just to be sure)
    prepare array
    loop array {
    output count of temp table
    a = some other function(...)
    output count of temp table
    insert stuff I need to temp table
    output count of temp table
    end
    The output is giving me (example). The correct result would be 140 at the end
    0
    0
    100
    0
    40
    I checked all further function calls, there is no delete or commit, just some objects are created (and collections) which are then processed and returned.
    Could it be that there is a automatic commit or something like that?
    Thanks
    Edited by: maschlegel on Jan 26, 2009 6:36 AM
    Edited by: maschlegel on Jan 26, 2009 6:37 AM
    Edited by: maschlegel on Jan 26, 2009 6:38 AM

    just some objects are created (and collections) which are then processed and returneAll DDL statements issue COMMITs implicitly - once before the statement is processed and once after. (so any data changes are committed even if the DDL statement fails).
    This is just one reason why it is such a bad idea to stick DDL statements in the middle of transactions.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • How to call external functions without a .DLL (just using a .H and .LIB file)?

    Hello everyone,
    actually I'm facing little difficulties on how to get an external function getting called from within CVI (Version 2009).
    I was supplied with a .H file and a .LIB file to call an external function from within my CVI project. The .H file looks like this:
    void exportedFunction(double *parameter);
    As far as I know, the external function was written with MS Visual C++ 6.
    So I tried to statically link to the extern al function like this:
    - Add the .H file and the .LIB file to the CVI project
    - #include the .H file where I needed to call the external function
    - do the external function call
    When building I get an unresolved external function call error from CVI so this seems not to be working.
    I made some searches around and got up with two possible issues. Maybe one of you can help me get a bit further and get things working.
    1) The "real" function code is located in the DLL file which was not delivered to me. Or is there a way to get things done (call external functions) just with a .H and a .LIB file (without any .DLL file included)?
    2) The external function does not export according to "C-Style" rules. The function signature in the .H file shows no things like
    extern "C" __declspec(dllexport) void __stdcall ...
     Or maybe it's a combination of both issues (missing .DLL + wrong export style of function)?
    I guess I could get around the wrong export style of the function when I manage to write a wrapper around the original function that actually uses C-Style exporting. But I guess I need the .DLL file for this try as well.
    Thank you for your answers.
    Best regards,
    Bernd
    Solved!
    Go to Solution.

    There is no need  for the dllexport stuff. There is also the option for a static library without any DLL.  But the 'extern "C"' is essential, because it forces the C++  compiler, which was probably used to compile the library , to use C calling convention.
    If you can't ask the provider of the library to provide a version which was compiled using C calling convention the way to go is to write a wrapper with VC++6 around that library which reexports the functions using C calling convertion. Something like
    extern "C" type0 myfunc1(type1 arg1, ...) {
           return func1( arg1,...);
    for every function , you need to use.
    BTW. "unresolved symbol" is the linker error message, you can expect if you try to link C code against a library build with C++ calling convention.

  • Calling a function in an external actionscript

    Hi. First of all I'd like to put my hands up and say that what I know about Flash is antiquated (I used to work with Flash 4 / 5), and have now been thrown into the deep end, as it were.
    I have an application that has a button component. In an external actionscript file there's an event listener that calls a function when this button is pressed. I want to replace the button with a graphic that switches according to whether the button is 'on' or 'off'. I've created a movie clip that cycles back and forth between the on and off states when clicked, but the trouble I'm having is getting it to call the function. I have no idea how to do it, other than to just include function_name(); (or call.function_name();) in the onRelease handler (which doesn't work). Is it possible to use event listners for movie clips (rather than components?) Or else how can I call this function? It should be really simple and I'm tearing my hair out trying to get it to work! The function is declared 'public', by the way...
    Oh yes, this is ActionScript 1 (I think...)
    Eternal thanks and gratitude to anyone who can help me...

    Do you mean to copy it here, or copy it into the fla? I've already tried doing the latter, which doesn't work - the script imports other external as files and I think that that's messing things up. The function only seems to work when it's located in this external file. The function I'm trying to call is
    public function toggleAudio() {
           //if (btnAudio.label == "Sound Off") {
           if (_root.audio == "mute" or btnAudio2.label == "Sound Off") {
               trace("toggleAudio AUDIO: Off");
               //btnAudio.label = "Sound On";
               _root.audio = "unmute";
                         // stop recieving audio from in stream
               ServiceLocator.getInstance().getService("nsService").returnInStream().receiveAudio(false) ;
               // stop sending audio on out stream
               ServiceLocator.getInstance().getService("nsService").returnOutStream().attachAudio(null);
                     } else {
               trace("toggleAudio AUDIO: On");
               btnAudio2.label = "Sound Off";
               _root.audio = "mute";
                         // start recieving audio from in stream
               ServiceLocator.getInstance().getService("nsService").returnInStream().receiveAudio(true);
               // start sending audio on out stream
               ServiceLocator.getInstance().getService("nsService").returnOutStream().attachAudio(Servic eLocator.getInstance().getService("camService").returnMic());
    The bit at the beginning where I've commented some stuff out is where I've been trying out different things to get it to work.
    For all intents and purposes though the function could be
    public function please_work() {
    trace("I work!");
    All I need is for a way to call this from the main flash movie

  • Parameters into Call Library Function Node not being passed

    I am trying to configure an instrument using IVI Instrument drivers. In the first vi that does this, the instrument (a sig gen) is being set correctly to the desired frequency and power. In a second vi I try to change the frequency and power, the sig gen does not change.
    If I run the second vi stand-alone with the original settings, again there is no change. But if I change the value of frequency or power by any amount, that parameter is now set properly on the sig gen.
    When I look at the IVI vi, I can see that the parameters I send in are getting to the Call Library Function Node.
    Any idea what the problem is.
    Thanks.
    p.s., Are there instructions on how to paste a picture or link to a vi into my post. This question would have been a lot easier and clearer to ask.

    Hi cgantz,
          While it sounds, possibly, like a "state-caching"-related bug in the IVI driver, it certainly would be good to have a look at your code.   Look a the bottom-left area of the "Message Body" when replying - there's an "Attachment" tool for this purpose!
    Cheers.
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • Getting Return values from RFC function call with visual basic

    Hi,
    I am creating a sample app to connect to a SAP system which call its RFC functions created with ABAP. It was known that the function will return more than 1 return values.
       SAP Function name ==> "ZFMTP_RFC_GET_RESULT"
            Export parameters (to SAP):
                    - Student Name [char 10]         ==> "STUNAME"
                    - Student ID         [char 20]        ==> "STUID"
           Return values (From SAP):
                    - Results [char 10]        ==> "RESULT"
                    - Remarks [char 200]        ==> "REMARKS"
    i have managed to get sample codes for connecting and call a RFC function with vb but they only get a return value. How do i retrieve multiple return values like the above function "RESULT" and "REMARKS"?
    Here's my vb code to accessing the function
            Dim R3 As Object
            Dim FBFunc As Object
            Dim returnFunc As Boolean
            Dim connected As Boolean
            R3 = CreateObject("SAP.Functions")
            R3.Connection.Client = "000"
            R3.Connection.User = "BCUSER"
            R3.Connection.Password = "minisap"
            R3.Connection.Language = "DE"
            R3.Connection.System = "dtsystem"
            R3.Connection.Applicationserver = "xxx.xxx.xxx.xxx" 
            connected = R3.Connection.Logon(0, True)
            If connected <> True Then
                MsgBox("Unable to connect to SAP")
            End If
            FBFunc = R3.add("ZFMTP_RFC_GET_RESULT")
            FBFunc.exports("STUNAME") = "Jonny"
            FBFunc.exports("STUID") = "12345"
            returnFunc = FBFunc.Call() <<== How do i get the return value? or RESULT and REMARKS of the RFC Function?
    thanks alot.
    Edited by: Eugene Tan on Mar 4, 2008 7:17 AM

    Hi Gregor,
    Thanks for the link....i am having some doubts with the codes, hope you can clarify them for me if you know the codes..
    Below is the code snippet.
    Set impReturn = CHPASS_FN.Imports("RETURN")  <<=== is RETURN the standard keyword to get a                                                                                return object?
      expPassword.Value = currpass
      expNewPass.Value = newpass
      expFillRet.Value = "1"
    ''' Call change password function
      If CHPASS_FN.Call = True Then
        outFile.Write (", Called Function")
        Message = impReturn("MESSAGE") <<==== So if i have 3 return values..i just replace with the return                                                               value variable names?
        outFile.WriteLine " : " & Message
      Else
        outFile.Write (", Call to function failed")
      End If
    thanks alot...all your help is very appreciated.

  • Characters getting lost while calling a remote function

    Hi there,
    I've got a problem concerning a remote function call.
    Situation: System A has a function module ZFM_X with one importing parameter ("text" type string).
    System B calls this function module ZFM_X through a remote function call.
    It passes a string (containing 521 characters) variable to the importing parameter "text".
    Unfortunately, only fragments of the imported text arrive in System A.
    The text arriving in System A has the following pattern: The first 256 are correct, following 256 white spaces(blanks) following the last 9 characters of the imported text.
    Example:
    This is sent by System B to System A through a String variable.
    http://xxx.xx.xx.xx:xxxx/servlet/ContentServer?get&pVersion=0046&contRep=PG&docId=4BB4C36F5A0200B9E1008000AC101219&accessMode=r&authId=CN%3DP60&expiration=20100420112054&secKey=MIH3BgkqhkiG9w0BBwKggekwgeYCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHATGBxjCBwwIBATAZMA4xDDAKBgNVBAMTA1A2MAIHIAgIKARFNDAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTAwNDIwMDkyMDU0WjAjBgkqhkiG9w0BCQQxFgQUItgHQiYkW9BkScWnoMPkZiuCGSMwCQYHKoZIzjgEAwQuMCwCFGPGseHQSPV2%2F75OVMF2yMFzwfTLAhQgPRMvivyuii4gZ%2BJSKonPRsF1XA%3D%3D
    At System A the following text arrives
    http://xxx.xx.xx.xx:xxxx/servlet/ContentServer?get&pVersion=0046&contRep=PG&docId=4BB4C36F5A0200B9E1008000AC101219&accessMode=r&authId=CN%3DP60&expiration=20100420112054&secKey=MIH3BgkqhkiG9w0BBwKggekwgeYCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHATGBxjCBwwIBATA                                                                                1XA%3D%3D
    It definitely looks like a unicode problem. Oddly, we have another system constellation which is exactly the same as System A/B where we are doing this, and its working perfectly fine.
    I hope you are not stunned by this wall of text, but any help is totally appreciated!
    Edited by: Erik Nagler on Apr 20, 2010 11:54 AM

    Hi,
    I tried it with String type and Character type (CHAR1024).
    Both dont work.
    As far as the unicode test is concerned:
    Sysem A is a unicode System whereas System B is a non-unicode system.
    I tried to change the Radiobutton to "unicode" in sm59, but I can't.
    It is uneditable, even though I am in change mode.
    [>>Picture<<|http://img90.imageshack.us/img90/2006/unicode.png]

  • Getting error in calling Java Script function in HTMLB page

    Hi
      I am having a button in HTMLB page which calls the Java Script function for click event.I have included the Java Script in the script folder of the application.
    I am calling the function present in JS like this,
    <SCRIPT src="portalsdc.js"></SCRIPT>
    function buttonClick() {
    someFunc()
    <hbj:button
    onClientClick="JavaScript:buttonClick();"
    disabled="false"
    design="STANDARD"
    />
    The Error i am getting in calling someFunc()is "Object Expected " ..
    Any suggestion how to make it work.
    Thanks in advance
    Saravanan

    Hi,
    My code in page is
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <hbj:content id="myContext" >
    <hbj:page title="Epcf iView" >
    <SCRIPT src="portalsdc.js"></SCRIPT>
    <script language="JavaScript">
    function buttonClick() {
         someFunc()
    </script>
    <hbj:form>
    <hbj:button
    id="sendEvent"
    text="Send event"
    width="125px"
    tooltip="This button raises an event ..."
    onClientClick="JavaScript:buttonClick();"
    disabled="false"
    design="STANDARD"
    />
    </hbj:form>
    </hbj:page>
    </hbj:content>
    The code in Java script portalsdc.js is :
    function someFunc()
         alert ("HI");
    Even i have set and tried jsObjectNeeded = TRUE for button.
    Thanks and Regards,
    Saravanan

  • Getting Fatal error: Call to undefined function mysql_connect() error.

    ok, so before I had my mysql_connect php script and it ran fine, no errors, but once I changed my php.ini file to give ERROR_REPORTING E_ALL I now get Fatal error: Call to undefined function mysql_connect(). I am just wondering how I can fix this?
    I followed the arch linux LAMP wiki and I can't figure out why I am getting this error after turnning on error_reporting.
    Thanks
    this is my php code
    <?php
    $connection = mysql_connect('localhost', 'root', 'password');
    if(!$connection){
    echo mysql_error();
    } else {
    echo 'connected';
    if (!mysql_select_db('my_first_db')){
    echo 'uh';
    } else {
    echo 'selected database';
    ?>
    <?php phpinfo(); ?>
    Last edited by clandest (2012-03-22 04:36:43)

    aking9 wrote:grabbing into the back of the back of my memory here but don't you need to specify a port to connect to?
    Only if you change the port from the default 3306. But even then, a different error message will output, in this case the mysql modules have not loaded for some reason.
    There is a syntax error in your php.ini file, at line 510. Comment out this line as it's a line giving information rather than an option. Then uncomment the error_reporting option.
    So this:
    Default Value: E_ALL & ~E_NOTICE
    ; Development Value: E_ALL | E_STRICT
    ; Production Value: E_ALL & ~E_DEPRECATED
    ; http://php.net/error-reporting
    ;error_reporting = E_ALL & ~E_DEPRECATED
    Should be changed to this:
    ; Default Value: E_ALL & ~E_NOTICE
    ; Development Value: E_ALL | E_STRICT
    ; Production Value: E_ALL & ~E_DEPRECATED
    ; http://php.net/error-reporting
    error_reporting = E_ALL & ~E_DEPRECATED
    After this try "sudo /etc/rc.d/httpd restart" then see if you have any better luck connecting to mysql.
    Last edited by astiak (2012-03-22 23:24:40)

  • Java Webservice calling C function through JNI

    I have a java class that is using the JNI to call native interface written in C. The called C function has dependencies in vendor supplied c function library in .lib (CAUEVT.LIB) format. I compiled the C function as .DLL file and put the .DLL file in the -Djava.library.path and same thing I put in the opmn.xml file for the Java option.
    Now, when I run the Java class from command line it works fine and makes call to the external system everything works fine.
    However, when I deploy the same as web service and try to test the web service, Java expects the external library also in .DLL format (The error message is "This application has failed to start because CAUEVT.dll was not found. Re-installing the application may fix this problem")
    If I look the application log file, I see the following error.
    java.lang.UnsatisfiedLinkError: D:\lib\CAEventLoggerImp.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
    I am wondering if the java class can run without any problem, why is the webservice execution fails....?

    The problem was that when Java loads the shared DLL we create from the java.library.path setting, but if the loaded DLL refers to any other DLL, it expects it from the System path. And for some reason, OC4J, doesn't expose all the system path unless entered in the Evnironment Variable explicitly in the Administration tab in OEM., server properties in the OEM. (opmn.xml)
    IT works fine after these changes.

  • I am getting error Error in calling up function 'BAPI_APOATP_CHECK' in APO server The current application triggered a termination

    I am getting error Error in calling up function 'BAPI_APOATP_CHECK' in APO server The current application triggered a termination
    when triggering for gatp.

    Hi Virender,
    This error can be experienced due to many reasons. based on my experience below reasons can cause this issue.
    1) If you are using allocation check if allocation is correctly set.
    2) In case you are using custom enhancements / user exits (in SD / GATP / CIF) check if any of them, causing this issue.
    In my case correction of allocation setup could resolve this issue, so check what is the reason in your case.
    Rgds
    Sourabh

Maybe you are looking for

  • How do I create a new calendar for the current year, using last years calendar's birthday's/photos and comments from the lower pages?

    Each year for the past 5 years I make a family calendar and send copies to all he family members around the globe.  I hate that I have to recreate all the birthdays and special occasions from scratch, and re-drag all the photos onto these dates, in t

  • Exchange 2013 SP1 Not Receiving e-mail

    Hello, Mail flow between Exchange 2010 sp3 & Exchange 2013 SP1 (update Cu5) not working. Exchange 2013 setup is Exchange 2013 sp1 DVD Exchange 2010 when sending mail to external it's ok. Exchange 2010 when sending mail to exchange 2010 users it's ok.

  • Text in tables in Pages

    I am using the table function in Pages to create an alphabeticized glossary. All good. Except, in one series ("D" words), every time I try to add a new row and write in the new word, it defaults to the same 2 letters "dé". I cannot add the new word.

  • Data source Infocubes for standard reports

    Hello Everybody, Can you please assist - how to understand which data source will feed - which info-cube - which standard reports? I am planning to activate standard reports in various module. How do I decide corresponding data source and info-cube r

  • How to control yaskawa varispeed F7 VFD using labview ??

    I want to control the frequency of VFD (Yaskawa varispeed F7) using labview.  The vi should be like I can know the current freqency and able to change it. What are the possibilities??? Please reply..... Thanks & regards Naren