aspose file tools*
The moose likes Servlets and the fly likes Calling a dll file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling a dll file" Watch "Calling a dll file" New topic
Author

Calling a dll file

aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
HI all,

i was trying to call a dll file which was developed in c++ from a web application. when i call like this from the web application

System.load("dllname");
the file loading is properly. I am not getting any exception. But when i tried to use methods which are there in this dll file i am getting UnsatisfiedLinkError exception.

But this dll is working fine if i use this dll in a stand alone java web application.

Please Help me...


Thanks
AreshBabu
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

How is your standalone Java app locating the DLL?
Is it using the Windows registry or is it just looking in the current working directory for it?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
It is using the windows registry
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 513
    
    6
Hi,

The DLL's exported functions should conform to the JNI function declarations produced by javah tool, should be exported with __stdcall calling convention and should be exported by name not ordinal (check with dependency viewer if you're not sure). Are all these satisfied?
aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
Hi Karthik

We generated the dll file without any compilation error and this dll is working fine when we are using with stand alone java application.

But if we try to use in web application it is not giving any exception while it is loading.

When we try to call a particular method on the dll from a servlet it is showing the message Servlet Threw An Exception. We are not able to call a method which are there in the dll file. What may be the problem??? We are using JBOSS server.

Please help me

Thanks & Regards
Aresh Babu
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calling a dll file