axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lilantha Darshana <Lilan...@virtusa.com>
Subject RE: Axis / JNI once more
Date Tue, 01 Jul 2003 11:39:43 GMT
now it seems the libJNIDate.so having incorrect export/ or the method has
not implemented correctly in the 
c/c++ file?? probably you need -fPIC flag on compiling. Can't guess without
seeing the JNI impl. you have done.
 

-----Original Message-----
From: Harald Pollak [mailto:h.pollak@pke.at]
Sent: Tuesday, July 01, 2003 3:59 PM
To: Axis-Dev
Subject: RE: Axis / JNI once more


I tried to do this, and i got :

init Class
* Native library 'JNIDate' loaded
Constructor
call method: SMS.JNIDate@17cfd38 : 10.146.3.42:1800
now
/usr/lib/j2sdk1.4.2/jre/lib/i386/client:/usr/lib/j2sdk1.4.2/jre/lib/i386:/us
r/lib/j2sdk1.4.2/jre/../lib/i386
java.lang.UnsatisfiedLinkError: getJNIDate
        at SMS.JNIDate.getJNIDate(Native Method)
        at SMS.JNIDate.getDate(JNIDate.java:31)
        at
SMS.ServicesSoapBindingImpl.getDate(ServicesSoapBindingImpl.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:402
)
        at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:3
09)
        at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:333)
        at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
        at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
        at
org.apache.axis.transport.http.AxisServlet.invokeEndpointFromGet(AxisServlet
.java:544)
        at
org.apache.axis.transport.http.AxisServlet.processMethodRequest(AxisServlet.
java:466)
        at
org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:294)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
        at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:
339)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:286)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:974)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:205)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:974)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:177
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:149)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:149)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:974)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:156)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:562)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:974)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:203)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:637)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:484)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:568)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:631)
        at java.lang.Thread.run(Thread.java:534)


So in my oppinion the WS got the library, but it cannot access the methode.

I think it's where strange, because this class works in a servlet. 

maybe you have an other idea

best regards 
Harry


On Die, 2003-07-01 at 11:04, Lilantha Darshana wrote: 

I guess you have to set LD_LIBRARY_PATH environment variable on your

platform

to pick up the .so from there. and make a call like:



static {

        try {

             System.loadLibrary("JNIDate");

             System.out.println("* Native library 'JNIDate' loaded");

        }

        catch (Throwable e) {

            e.printStackTrace();

        }

    }



in your code.



-Lilantha



-----Original Message-----

From: Sanjiva Weerawarana [mailto:sanjiva@watson.ibm.com]

Sent: Tuesday, July 01, 2003 2:47 PM

To: axis-dev@ws.apache.org

Subject: Re: Axis / JNI once more





Do you mean that libJNIDate.so is on your java.lib.path directly?

Its been a while since I did JNI, but given that you say

loadLibrary ("JNIDate") I'm pretty sure that the path should

have the directory that that library is in only.



Sanjiva.



----- Original Message -----

From: "Harald Pollak" <h.pollak@pke.at>

To: "Axis-Dev" <axis-dev@ws.apache.org>

Sent: Tuesday, July 01, 2003 12:55 PM

Subject: Re: Axis / JNI once more





> Thanks this was a very good hint, now i know that the library isn't

> found.

> (java.lang.UnsatisfiedLinkError: getJNIDate)

>

> But now is stand befor an other problem:

> I tried to print out the java.library.path ( got by

> System.err.println(AxisProperties.getProperty("java.library.path"));

> )

>

> but my libJNIDate.so is in this path.

>

> Is there an other path used by axis?

>

> thanks

> harry

>

>

> On Die, 2003-07-01 at 08:24, Sanjiva Weerawarana wrote:

>

> > Try changing the catch around jd.getDate() to catch (Throwable) ..

> > maybe its throwing something you're not catching.

> >

> > Sanjiva.

> >

> > ----- Original Message -----

> > From: "Harald Pollak" <h.pollak@pke.at>

> > To: <axis-dev@ws.apache.org>

> > Sent: Monday, June 30, 2003 5:06 PM

> > Subject: Axis / JNI once more

> >

> >

> > > Hy everybody!

> > >

> > > I try to use JNI within a Axis-Service. I try since weeks to bring it

to

> > > work, but my result is every time the same:

> > >

> > > <soapenv:Envelope>

> > >     <soapenv:Body>

> > >         <soapenv:Fault>

> > >             <faultcode>soapenv:Server.userException</faultcode>

> > >

> > > <faultstring>java.lang.reflect.InvocationTargetException</faultstring>

> > >             <detail/>

> > >         </soapenv:Fault>

> > >     </soapenv:Body>

> > > </soapenv:Envelope>

> > >

> > > my enviroment:

> > > Linux: SuSE 8.2

> > > Tomcat 5 ( 5.0.3 Alpha ) ( allso tried with Tomcat 4.1.24 )

> > > Axis 1.1 ( final ) ( allso tried with 1.1rc2 )

> > > Client: Mozzila 1.4

> > >

> > > Invocation:

> > > I call the function getDate with 2 Parameters via:

> > >

> > >

> >

 
<http://localhost:8080/axis/services/services?method=getDate&in0=10.146.3.42
&>
http://localhost:8080/axis/services/services?method=getDate&in0=10.146.3.42&

> > in1=1800

> > >

> > > The Code:

> > > -----------

> > >

> > > The Implementation:

> > >

> > > public class ServicesSoapBindingImpl implements SMS.JNIWS{

> > >

> > >     public java.lang.String getDate(java.lang.String in0, int in1)

> > > throws java.rmi.RemoteException {

> > >         String s = new String();

> > >         System.err.println(LibPath);

> > >

> > >         try {

> > >             System.err.println("init Class");

> > >

> > >          JNIDate jd = new JNIDate();

> > >             System.err.println("call methode: ");

> > >             s = jd.getDate(in0, in1);

> > >             System.err.println("finnished: " + s);

> > >         } catch (Exception ex) {

> > >             System.err.println(ex.getStackTrace().toString());

> > >          ex.printStackTrace();

> > >       }

> > >

> > >         return s;

> > >     }

> > >

> > >     public java.lang.String getVersion() throws

java.rmi.RemoteException

> > > {

> > >         return "1.0";

> > >     }

> > >

> > >     public java.lang.String getEnv() throws java.rmi.RemoteException {

> > > //        return System.getProperty("java.library.path");

> > >         return AxisProperties.getProperty("java.library.path");

> > >     }

> > >

> > > }

> > >

> > > the Class-JNIDate:

> > >

> > > class JNIDate {

> > >

> > >     static { System.loadLibrary("JNIDate"); }

> > >

> > >     public native String getJNIDate(String Server, int Port );

> > >

> > >     public String getDate(String Server, int Port) {

> > >         String s;

> > >         try {

> > >            System.err.println("call");

> > >            s= getJNIDate(Server,Port);

> > >             System.err.println(s);

> > >             return s;

> > >         } catch (Exception e) {

> > >           System.err.println("Exeption!!!!");

> > >               e.printStackTrace();

> > >             return (String)(e.getMessage() + "\n :

> > > "+e.getCause().toString());

> > >         }

> > >     }

> > > }

> > >

> > >

> > > the output on Tomcat-console:

> > >     init class

> > >     call methode

> > >     call

> > >

> > > there is no  exception in logs or on console

> > >

> > >

> > > when i call the getEnv - Methode:

> > >     The path with my library-dir is shown.

> > >

> > > What i allso tried:

> > >     To outcommend the Nativecall and return a simpel string from

> > > JNIDate.getJNIDate -> works fine.

> > >

> > >     To write a servlet using the JNIDate.class and call it. -> works

> > > fine!

> > >

> > > So my questions:

> > >

> > > 1.) has anybody allready written a Axis-Service using his own

JNI-Class?

> > > 2.) has anybody seen a misstake in the upper code ( maybe i'm

> > > "codeblinde" - and it's a simple error, so I read over it many

times )?

> > > 3.) Has anyone a sample - I can try in my enviroment?

> > >

> > > Thanks

> > > Harry

> > >

> >

>




Mime
View raw message