You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Claire Dugenet <cl...@gmail.com> on 2008/01/18 13:19:00 UTC

Impossible to use multi threading with Tomcat by using a DLL ?

Hello,



I realize a web application using Struts with Tomcat. In this application, I
call a DLL (created with JNI) which call an other DLL (in language C). The
last one is in the directory "system32" of windows et it use several
threads.



There is no error but according to the log files, no thread are called. I
have call the same DLLs without Tomcat, and it works.


Does Tomcat block the multi-threading ? Is there a solution to authorize the
multi-threading ?

Thanks,
Claire.

Re: Impossible to use multi threading with Tomcat by using a DLL ?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Claire,

Claire Dugenet wrote:
| The first DLL, created with JNI, works well. Because : there are several
| fonctions in the second DLL (this one in language C).

I would imagine that they are both written in C, yes?

| The first function
| (which doesn't use threads) works well but when we call the second
| function (which uses multi thread), it doesn't work : the function is
| "block" where there is the call of the thread.

When you say "blocked", what do you mean? Is the code waiting on a mutex
or something? Are you using the standard win32 threading functions? Does
your code produce any debugging output?

What are you able to observe besides "it doesn't work"?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeUsxcACgkQ9CaO5/Lv0PBXfQCgpf+I50StRtqCpwQkleDmCQ29
bPEAn21uLLYlJ6qHqDcNWWl7Eu025H7Q
=MhJD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Impossible to use multi threading with Tomcat by using a DLL ?

Posted by Claire Dugenet <cl...@gmail.com>.
We have signed the applet properly but it changes nothing.

The first DLL, created with JNI, works well. Because : there are several 
fonctions in the second DLL (this one in language C). The first function 
(which doesn't use threads) works well but when we call the second 
function (which uses multi thread), it doesn't work : the function is 
"block" where there is the call of the thread.

In fact, the servor and the client are on the same machine.


david delbecq a écrit :
> You mean in all cases it runs client-side? Then it's not a tomcat 
> related problem. Applet, to be able to run JNI, must be properly 
> signed and run with security authorisation needed. Moreover, the JNI 
> libraries must be installed on client.
> Claire Dugenet a écrit :
>> Hello,
>>
>> In the two case (with or without Tomcat), we call it with a button 
>> because we use the same applet. Normally, the applet is independant 
>> of Tomcat but it makes a difference when we use this applet with 
>> Tomcat (http://localhost:8080 ...) or whithout Tomcat (file:///C:/ ...).
>>
>> We have try to call the DLL with and without the servlet, and it's 
>> the same result : it doesn't work when we use Tomcat.
>>
>> david delbecq a écrit :
>>> If your applet code is called from button actions, all calsl to your 
>>> dll will be made from the same "AWT" thread. If you call it from a 
>>> servlet in tomcat , a random thread from the HttpThread pool will be 
>>> used, that's probably your difference that make it work one side and 
>>> not the other.
>>> Claire Dugenet a écrit :
>>>> In fact, some of the fonctions of the DLL works except the ones 
>>>> which call
>>>> the threads.
>>>>
>>>> To test my DLL, I have created an applet which call the two DLL and 
>>>> it works
>>>> very well when I don't use Tomcat. And when I call exactly the same 
>>>> applet
>>>> with Tomcat, that doesn't work : there is no error but the thread are
>>>> "blocked".
>>>>
>>>>
>>>> 2008/1/18, david delbecq <de...@oma.be>:
>>>>  
>>>>> Tomcat does not "block" multi threading. There is not such thing i 
>>>>> think
>>>>> in the JVM anyway, so i don't see how it could prevent your native 
>>>>> code
>>>>> from creating threads. When you say you are having same call without
>>>>> tomcat, you mean in a spearate jvm, using the same jni libraries? 
>>>>> Maybe
>>>>> you are just misuing your system library? Or not calling it at all?
>>>>> There is not restriction in JNI that rpevent multiple thread to call
>>>>> native code, nor is it restriction as to what thread natvie code 
>>>>> create.
>>>>> It can even create java threads as far a i know!
>>>>>
>>>>> Claire Dugenet a écrit :
>>>>>  
>>>>>> Hello,
>>>>>>
>>>>>>
>>>>>>
>>>>>> I realize a web application using Struts with Tomcat. In this
>>>>>>       
>>>>> application, I
>>>>>  
>>>>>> call a DLL (created with JNI) which call an other DLL (in 
>>>>>> language C).
>>>>>>       
>>>>> The
>>>>>  
>>>>>> last one is in the directory "system32" of windows et it use several
>>>>>> threads.
>>>>>>
>>>>>>
>>>>>>
>>>>>> There is no error but according to the log files, no thread are 
>>>>>> called.
>>>>>>       
>>>>> I
>>>>>  
>>>>>> have call the same DLLs without Tomcat, and it works.
>>>>>>
>>>>>>
>>>>>> Does Tomcat block the multi-threading ? Is there a solution to 
>>>>>> authorize
>>>>>>       
>>>>> the
>>>>>  
>>>>>> multi-threading ?
>>>>>>
>>>>>> Thanks,
>>>>>> Claire.
>>>>>>
>>>>>>
>>>>>>       
>>>>> ---------------------------------------------------------------------
>>>>> To start a new topic, e-mail: users@tomcat.apache.org
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>>
>>>>>     
>>>>
>>>>   
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Impossible to use multi threading with Tomcat by using a DLL ?

Posted by david delbecq <de...@oma.be>.
You mean in all cases it runs client-side? Then it's not a tomcat 
related problem. Applet, to be able to run JNI, must be properly signed 
and run with security authorisation needed. Moreover, the JNI libraries 
must be installed on client.
Claire Dugenet a écrit :
> Hello,
>
> In the two case (with or without Tomcat), we call it with a button 
> because we use the same applet. Normally, the applet is independant of 
> Tomcat but it makes a difference when we use this applet with Tomcat 
> (http://localhost:8080 ...) or whithout Tomcat (file:///C:/ ...).
>
> We have try to call the DLL with and without the servlet, and it's the 
> same result : it doesn't work when we use Tomcat.
>
> david delbecq a écrit :
>> If your applet code is called from button actions, all calsl to your 
>> dll will be made from the same "AWT" thread. If you call it from a 
>> servlet in tomcat , a random thread from the HttpThread pool will be 
>> used, that's probably your difference that make it work one side and 
>> not the other.
>> Claire Dugenet a écrit :
>>> In fact, some of the fonctions of the DLL works except the ones 
>>> which call
>>> the threads.
>>>
>>> To test my DLL, I have created an applet which call the two DLL and 
>>> it works
>>> very well when I don't use Tomcat. And when I call exactly the same 
>>> applet
>>> with Tomcat, that doesn't work : there is no error but the thread are
>>> "blocked".
>>>
>>>
>>> 2008/1/18, david delbecq <de...@oma.be>:
>>>  
>>>> Tomcat does not "block" multi threading. There is not such thing i 
>>>> think
>>>> in the JVM anyway, so i don't see how it could prevent your native 
>>>> code
>>>> from creating threads. When you say you are having same call without
>>>> tomcat, you mean in a spearate jvm, using the same jni libraries? 
>>>> Maybe
>>>> you are just misuing your system library? Or not calling it at all?
>>>> There is not restriction in JNI that rpevent multiple thread to call
>>>> native code, nor is it restriction as to what thread natvie code 
>>>> create.
>>>> It can even create java threads as far a i know!
>>>>
>>>> Claire Dugenet a écrit :
>>>>   
>>>>> Hello,
>>>>>
>>>>>
>>>>>
>>>>> I realize a web application using Struts with Tomcat. In this
>>>>>       
>>>> application, I
>>>>   
>>>>> call a DLL (created with JNI) which call an other DLL (in language 
>>>>> C).
>>>>>       
>>>> The
>>>>   
>>>>> last one is in the directory "system32" of windows et it use several
>>>>> threads.
>>>>>
>>>>>
>>>>>
>>>>> There is no error but according to the log files, no thread are 
>>>>> called.
>>>>>       
>>>> I
>>>>   
>>>>> have call the same DLLs without Tomcat, and it works.
>>>>>
>>>>>
>>>>> Does Tomcat block the multi-threading ? Is there a solution to 
>>>>> authorize
>>>>>       
>>>> the
>>>>   
>>>>> multi-threading ?
>>>>>
>>>>> Thanks,
>>>>> Claire.
>>>>>
>>>>>
>>>>>       
>>>> ---------------------------------------------------------------------
>>>> To start a new topic, e-mail: users@tomcat.apache.org
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>>     
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Impossible to use multi threading with Tomcat by using a DLL ?

Posted by Claire Dugenet <cl...@gmail.com>.
Hello,

In the two case (with or without Tomcat), we call it with a button 
because we use the same applet. Normally, the applet is independant of 
Tomcat but it makes a difference when we use this applet with Tomcat 
(http://localhost:8080 ...) or whithout Tomcat (file:///C:/ ...).

We have try to call the DLL with and without the servlet, and it's the 
same result : it doesn't work when we use Tomcat.

david delbecq a écrit :
> If your applet code is called from button actions, all calsl to your 
> dll will be made from the same "AWT" thread. If you call it from a 
> servlet in tomcat , a random thread from the HttpThread pool will be 
> used, that's probably your difference that make it work one side and 
> not the other.
> Claire Dugenet a écrit :
>> In fact, some of the fonctions of the DLL works except the ones which 
>> call
>> the threads.
>>
>> To test my DLL, I have created an applet which call the two DLL and 
>> it works
>> very well when I don't use Tomcat. And when I call exactly the same 
>> applet
>> with Tomcat, that doesn't work : there is no error but the thread are
>> "blocked".
>>
>>
>> 2008/1/18, david delbecq <de...@oma.be>:
>>  
>>> Tomcat does not "block" multi threading. There is not such thing i 
>>> think
>>> in the JVM anyway, so i don't see how it could prevent your native code
>>> from creating threads. When you say you are having same call without
>>> tomcat, you mean in a spearate jvm, using the same jni libraries? Maybe
>>> you are just misuing your system library? Or not calling it at all?
>>> There is not restriction in JNI that rpevent multiple thread to call
>>> native code, nor is it restriction as to what thread natvie code 
>>> create.
>>> It can even create java threads as far a i know!
>>>
>>> Claire Dugenet a écrit :
>>>    
>>>> Hello,
>>>>
>>>>
>>>>
>>>> I realize a web application using Struts with Tomcat. In this
>>>>       
>>> application, I
>>>    
>>>> call a DLL (created with JNI) which call an other DLL (in language C).
>>>>       
>>> The
>>>    
>>>> last one is in the directory "system32" of windows et it use several
>>>> threads.
>>>>
>>>>
>>>>
>>>> There is no error but according to the log files, no thread are 
>>>> called.
>>>>       
>>> I
>>>    
>>>> have call the same DLLs without Tomcat, and it works.
>>>>
>>>>
>>>> Does Tomcat block the multi-threading ? Is there a solution to 
>>>> authorize
>>>>       
>>> the
>>>    
>>>> multi-threading ?
>>>>
>>>> Thanks,
>>>> Claire.
>>>>
>>>>
>>>>       
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>     
>>
>>   
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Impossible to use multi threading with Tomcat by using a DLL ?

Posted by david delbecq <de...@oma.be>.
If your applet code is called from button actions, all calsl to your dll 
will be made from the same "AWT" thread. If you call it from a servlet 
in tomcat , a random thread from the HttpThread pool will be used, 
that's probably your difference that make it work one side and not the 
other.
Claire Dugenet a écrit :
> In fact, some of the fonctions of the DLL works except the ones which call
> the threads.
>
> To test my DLL, I have created an applet which call the two DLL and it works
> very well when I don't use Tomcat. And when I call exactly the same applet
> with Tomcat, that doesn't work : there is no error but the thread are
> "blocked".
>
>
> 2008/1/18, david delbecq <de...@oma.be>:
>   
>> Tomcat does not "block" multi threading. There is not such thing i think
>> in the JVM anyway, so i don't see how it could prevent your native code
>> from creating threads. When you say you are having same call without
>> tomcat, you mean in a spearate jvm, using the same jni libraries? Maybe
>> you are just misuing your system library? Or not calling it at all?
>> There is not restriction in JNI that rpevent multiple thread to call
>> native code, nor is it restriction as to what thread natvie code create.
>> It can even create java threads as far a i know!
>>
>> Claire Dugenet a écrit :
>>     
>>> Hello,
>>>
>>>
>>>
>>> I realize a web application using Struts with Tomcat. In this
>>>       
>> application, I
>>     
>>> call a DLL (created with JNI) which call an other DLL (in language C).
>>>       
>> The
>>     
>>> last one is in the directory "system32" of windows et it use several
>>> threads.
>>>
>>>
>>>
>>> There is no error but according to the log files, no thread are called.
>>>       
>> I
>>     
>>> have call the same DLLs without Tomcat, and it works.
>>>
>>>
>>> Does Tomcat block the multi-threading ? Is there a solution to authorize
>>>       
>> the
>>     
>>> multi-threading ?
>>>
>>> Thanks,
>>> Claire.
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Impossible to use multi threading with Tomcat by using a DLL ?

Posted by Claire Dugenet <cl...@gmail.com>.
In fact, some of the fonctions of the DLL works except the ones which call
the threads.

To test my DLL, I have created an applet which call the two DLL and it works
very well when I don't use Tomcat. And when I call exactly the same applet
with Tomcat, that doesn't work : there is no error but the thread are
"blocked".


2008/1/18, david delbecq <de...@oma.be>:
>
> Tomcat does not "block" multi threading. There is not such thing i think
> in the JVM anyway, so i don't see how it could prevent your native code
> from creating threads. When you say you are having same call without
> tomcat, you mean in a spearate jvm, using the same jni libraries? Maybe
> you are just misuing your system library? Or not calling it at all?
> There is not restriction in JNI that rpevent multiple thread to call
> native code, nor is it restriction as to what thread natvie code create.
> It can even create java threads as far a i know!
>
> Claire Dugenet a écrit :
> > Hello,
> >
> >
> >
> > I realize a web application using Struts with Tomcat. In this
> application, I
> > call a DLL (created with JNI) which call an other DLL (in language C).
> The
> > last one is in the directory "system32" of windows et it use several
> > threads.
> >
> >
> >
> > There is no error but according to the log files, no thread are called.
> I
> > have call the same DLLs without Tomcat, and it works.
> >
> >
> > Does Tomcat block the multi-threading ? Is there a solution to authorize
> the
> > multi-threading ?
> >
> > Thanks,
> > Claire.
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Impossible to use multi threading with Tomcat by using a DLL ?

Posted by david delbecq <de...@oma.be>.
Tomcat does not "block" multi threading. There is not such thing i think 
in the JVM anyway, so i don't see how it could prevent your native code 
from creating threads. When you say you are having same call without 
tomcat, you mean in a spearate jvm, using the same jni libraries? Maybe 
you are just misuing your system library? Or not calling it at all? 
There is not restriction in JNI that rpevent multiple thread to call 
native code, nor is it restriction as to what thread natvie code create. 
It can even create java threads as far a i know!

Claire Dugenet a écrit :
> Hello,
>
>
>
> I realize a web application using Struts with Tomcat. In this application, I
> call a DLL (created with JNI) which call an other DLL (in language C). The
> last one is in the directory "system32" of windows et it use several
> threads.
>
>
>
> There is no error but according to the log files, no thread are called. I
> have call the same DLLs without Tomcat, and it works.
>
>
> Does Tomcat block the multi-threading ? Is there a solution to authorize the
> multi-threading ?
>
> Thanks,
> Claire.
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org