Re: Problem with JNI and Tomcat



Elvandar wrote:

The java method sometimes seems to be correctly called (no exceptions
thrown), but the data it retrieves is absolutely incorrect. The problem
is that most of times it is not called, but if I open a serial terminal
all data arrived and bufferized is correctly shown on screen...and if I
run the same DLL in a java standalone app all works correctly, the
problem only happens if I load the DLL under tomcat...

The only possibilities I can think of (that you haven't already ruled out) are
that either the machine is running under a higher load with Tomcat (and so may
be missing asynchronous notifications somewhere), or that the threading
environment is different.

I'm a little bit suspicious of the calls to AttachCurrentThread() and
DetachCurrentThread() in your NotifyEvent(). If that is being called at
serial port speeds, and if I'm right in thinking that AttachCurrentThread() is
a relatively heavyweight operation when the thread is not already attached[*],
then that /might/ a source of problems.

-- chris

[*] AFAIK it involves messing around with the target thread's stack.



.



Relevant Pages

  • Re: LoadLibrary question
    ... from one LIB with the other. ... the DLL in question is fixed-up and loaded into ... Also, since the DLL is not using the same threading model, it's probably ... the dll to be loaded be also statically linked to C runtime libraries ...
    (microsoft.public.dotnet.languages.vc)
  • Re: using a COM in web application
    ... threading model of STA (single threaded apartment), ... Though the dll is using non-static member variables which are being ... >PowerPoint classes and opening a ppt file. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Thanks Pat and David and quick question.
    ... Our code is not handling threads in any specific manner we allow Visual Basic 6.0 and the OS to handle threading issues. ... The dll that I compile is a Project Type ActiveX DLL ... AspScriptErrorSentToBrowser: (BOOLEAN) True ...
    (microsoft.public.inetserver.iis)
  • Re: COM aus DLL
    ... Jetzt soll es über eine DLL passieren, ... AfxOleInit(); //need for COM ... COM Objekt implementiert ist. ... Das Threading ...
    (microsoft.public.de.vc)