Hi Chris,
Thanks for your reply. I recompiled everything and checked method
signature, but still got the same error. I felt it's weird why it worked
for standalone app but not deployed web service... Thanks.
model.java
========
public static void initModel() {
modelJNI.initModel();
}
modelJNI.java
===========
public final static native void initModel();
native code
=========
#include <HEC.h>
#include <vector>
#include <string>
string path="/tmp/model.xml";
HEC *hec_obj;
void initModel() {
hec_obj = new HEC(path);
if (!hec_obj) {
cout << "[ERROR] Cannot instantiate HEC objects.";
}
}
2010/7/3 Christopher Schultz <[email protected]>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Dennis,
>
> On 7/2/2010 3:46 AM, dennis ch wrote:
> > However, when I deploy it as a web service (tomcat 6.0.26 + axis2 1.5.1 +
> > eclipse jee helios) to call the native method, I got the following error
> > (the first line means the .so was successfully loaded):
> >
> > Load library successfully
> >
> > [ERROR] com.model.modelJNI.initModel()V
> > java.lang.reflect.InvocationTargetException
>
> [...]
>
> > Caused by: java.lang.UnsatisfiedLinkError:
> com.model.modelJNI.initModel()V
> > at com.model.modelJNI.initModel(Native Method)
> > at com.model.model.initModel(model.java:13)
> > at com.webservice.run(EvalVita.java:763)
> > ... 25 more
>
> Sounds like a Java-class/native-library mismatch. Are you sure your
> .java file and .c files are sync'd up properly? Try recompiling
> everything, and double-check your JNI method signatures.
>
> What does modelJNI.initModel look like in the Java method declaration?
> What does the same method signature in your native code look like?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkwv82YACgkQ9CaO5/Lv0PABewCeIC0qjqJdNm80GMByJBJn4VEs
> KzsAoKDPzdgXUJKMq/S4xruHd0RlNJCv
> =VA0U
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>