Hi., This code has been written in JDK 1.3.0_03 couple of years back and i implemented in JRun 3.1 Now i'm trying to use this same code in Tomcat 4.1 with J2SDK 1.4.2_03. According to your previos mail i understand that i have to rewrite the code using J2SDK 1.4.2 specifications. Is it correct? Can you please give me the steps that i have to do inorder to make my code compatible to 1.4.2..
Thanks.,
MALAI
----- Original Message ----- From: "Wade Chandler" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, April 23, 2004 12:52 AM
Subject: Re: Accessing Dll's
Wade Chandler wrote:
Annamalai Ramasamy wrote:
Hi., Yes,I did see my dll path using this line.
Thanks., MALAI Ryan Lissack <[EMAIL PROTECTED]> wrote: Hi,
Execute the following :
System.out.println(System.getProperty("java.library.path"));
See what directories are there. If the one(s) with your DLL(s) are not listed you can add them as a startup param to the VM using the -D
option
(java -Djava.library.path=.....)
HTH
Regards, Ryan.
-----Original Message----- From: Annamalai Ramasamy [mailto:[EMAIL PROTECTED] Sent: 22 April 2004 16:33 To: Tomcat Users List Subject: RE: Accessing Dll's
Hi., Check my below java code. I do not have native source codes.
I'm sure there is no version conflicts. But i have copied the dll in more than one places..like winnt, system32 and jre/bin like that.
any idea?
public class AddressValidate {
private Address inad; private Address outad; private String usercompany;
public StringBuffer csReturnErrorMsg; public StringBuffer csReturnStreet; public StringBuffer csReturnCityName; public StringBuffer csReturnCounty; public StringBuffer csReturnState; public StringBuffer csReturnZip; //To load DLL AvsWebInrterface static{ try{ System.loadLibrary("AvsWebInterface"); System.out.println("DLL Loaded"); }catch(Exception e){ System.err.println("Could not load DLL \"AvsWebInterface \" : "+e.toString()); System.out.println("Could not load DLL \"AvsWebInterface \" : "+e.toString());
}catch(Throwable e){ System.err.println("Could not load DLL \"AvsWebInterface:\" "+e.toString()); System.out.println("Could not load DLL \"AvsWebInterface:\" "+e.toString()); } } //end of static
//--------------------------------------------------------------------------
-
//Native method implemented in cpp public native String JAVAAVSValidate (String company, String street1, String city, String state, String zip, StringBuffer csReturnStreet, StringBuffer csReturnCityName, StringBuffer csReturnCounty, StringBuffer csReturnState, StringBuffer csReturnZip, StringBuffer csReturnErrorMsg)
;
//--------------------------------------------------------------------------
- public AddressValidate(){ inad=null; outad=null; usercompany=new String("");
}
//--------------------------------------------------------------------------
- public String validate (Address inad,Address outad){ csReturnStreet=new StringBuffer(""); csReturnCityName=new StringBuffer(""); csReturnCounty=new StringBuffer(""); csReturnState=new StringBuffer(""); csReturnZip=new StringBuffer(""); csReturnErrorMsg=new StringBuffer(""); this.inad=inad; this.outad=outad;
try{ // System.out.println("Street1 :"+inad.Street1); // System.out.println("city :"+inad.City); // System.out.println("state :"+inad.State); // System.out.println("postalcode"+inad.PostalCode);
JAVAAVSValidate (usercompany, inad.Street1, inad.City, inad.State, inad.PostalCode, csReturnStreet, csReturnCityName, csReturnCounty, csReturnState, csReturnZip, csReturnErrorMsg); outad.Street1 = csReturnStreet.toString(); outad.City = csReturnCityName.toString(); outad.County = csReturnCounty.toString(); outad.State = csReturnState.toString(); outad.PostalCode = csReturnZip.toString(); // System.out.println("Street1
:"+outad.Street1);
// System.out.println("city :"+outad.City); // System.out.println("state :"+outad.State); // System.out.println("postalcode"+outad.PostalCode);
}catch(Exception e){ System.out.println("Error in Validating Address " + e.toString()); }
return (csReturnErrorMsg.toString()); }
}
Peter Guyatt wrote: Hi There,
Can I see you native code and your class that declares you native methods.
Thanks
Pete
-----Original Message----- From: Mark Schmeets [mailto:[EMAIL PROTECTED] Sent: 22 April 2004 16:13 To: Tomcat Users List Subject: Re: Accessing Dll's
Hi, Is it possible that this dll is being loaded somewhere else in your instance? My experience with this error came from trying to use the Oracle native JDBC drivers. It usually came down to one of three issues, first that the dll couldn't be "found", second that another web-app had already loaded it, third it was a dll versioning problem. Hope it helps.
Mark
Annamalai Ramasamy wrote:
Hi., Again same error. I did put the dll to /jre/bin and winnt/system32. Any other ideas please... Thanks., MALAI
Hans Wichman wrote: sorry, i meant lib\bin\ instead of lib\ext\
grtz Sorv
At 03:43 PM 4/22/2004 +0100, Annamalai Ramasamy wrote:
Hi., Again Same Error.. Actually after the System.loadlibrary..i can able to see my system.out.println values. Then while trying to call my method i'm getting
UnsatishfiedLinkError.
Thanks., MALAI
Hans Wichman wrote: try putting them in the lib/ext folder of your j2sdk1.4.2_03 folder.
grtz Sorv
At 03:24 PM 4/22/2004 +0100, Annamalai Ramasamy wrote:
Hi., I'm using Tomcat4.0.29 with J2SDK 1.4.2_03. I have my native libraries(dll's) in winnt folder. I'm loading the dll thru System.loadlibrary and accessing the
methods.
I'm getting UnsatishfiedLinkError. My class files are in my web-inf classes directory. In forums i searcehed, and i tried out all possibility like setting path and changing my classes to common/classes and all. Please give me your suggestions... Thanks., MALAI
--------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends
today!
Download Messenger Now
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today!
Download Messenger Now
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now
This may sound like a strange question, though I have not seen it asked. Are you using JNI? You have to use JNI to be able to access the methods. The library could load fine, but the DLL still not be found. Also, did you use javah to create your h file? If not this is your problem. You have a special set of entry points so the C code can be used by the java code. C++ name mangling causes issues, and the JNI has a special way it looks for method names. If you are not using JNI you can look it up in the latest java docs.
Wade
I meant the library could load fine and the methods still not be found in the dll. This is because of the naming conventions.
Wade.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
The spec did change, but not enough to cause incompatibilties with old code. There were some new invocation methods created and I think that was basically the gist of the changes. The same exact code should work fine. Did you recompile your lib? Just to make sure something wasn't going on? Also, I think someone else already mentioned this, but if you changed the java classpath then you would get the unsatisfied link error. I hope that helps.
One other thing. Obviously it is loading your library or you would get an exception on the loadLibrary call. So it definitely has to do with it not finding the method inside the library. You don't have multiple copies do you? Maybe it's loading a lib you don't know about? Windows searches the path and then uses the first one it finds.
Wade
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
