Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a dll file

 
aresh babu
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
aresh babu
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is using the windows registry
 
Karthik Shiraly
Bartender
Posts: 1208
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic