Yes.I load the native library.I used System.load().The java code is showed as 
below:


 public class Shellcode {
   static 
    { 
         try 
         { 
           System.load("/root/s4share/shellcode/build/libshellcode.so"); 
       }  catch (Exception e) {
           e.printStackTrace();
       } 
     } 
    public native void checkShellcode(String filename);
    public native int checkShellcode(byte[] payload,int length,int[] array);
    /**
     * @param args
     */
    public static void main(String[] args) {
       Shellcode sc=new Shellcode();
       sc.checkShellcode("/root/test.txt");
    }

}






I tested the class and it works well.
I can't understand.Why it can not work in s4 while it can work well in terminal.
Help!


------------------ ???????? ------------------
??????: "Matthieu Morel"<matth...@yahoo-inc.com>;
????????: 2013??7??8??(??????) ????4:54
??????: "<s4-user@incubator.apache.org>"<s4-user@incubator.apache.org>; 

????: Re: jni error



Hi,

with merely the stacktrace it is difficult to make any diagnostic.

How are you loading/embedding the native library? Is it embedded in the S4R 
archive (you'd probably need some customization here)?

Is this possible to reproduce, and how?

Regards,

Matthieu

On Jul 8, 2013, at 10:42 , ?????? <654125...@qq.com> wrote:

> Hi,it looks like S4 has problem when loading libraries.
> I use JNI in my project.When call the native method,errors come out as below:
> 
> 16:31:52.626 [atos] ERROR org.apache.s4.core.S4Node - Uncaught exception in 
> thread atos
> java.lang.UnsatisfiedLinkError: 
> hello.Shellcode.checkShellcode(Ljava/lang/String;)V
>     at hello.Shellcode.checkShellcode(Native Method) ~[qqApp.jar:unspecified]
>     at hello.ShellcodeCheckPE.onEvent(ShellcodeCheckPE.java:106) 
> ~[qqApp.jar:unspecified]
>     at OverloadDispatcher709.dispatchEvent(Unknown Source) ~[na:na]
>     at 
> org.apache.s4.core.ProcessingElement.handleInputEvent(ProcessingElement.java:461)
>  ~[s4-core-0.6.0-incubating.jar:0.6.0-incubating]
>     at 
> org.apache.s4.core.Stream$StreamEventProcessingTask.run(Stream.java:333) 
> ~[s4-core-0.6.0-incubating.jar:0.6.0-incubating]
>     at 
> org.apache.s4.comm.staging.BlockingThreadPoolExecutorService$RunnableWithPermitRelease.run(BlockingThreadPoolExecutorService.java:178)
>  ~[s4-comm-0.6.0-incubating.jar:0.6.0-incubating]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  ~[na:1.7.0_25]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  ~[na:1.7.0_25]
>     at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
> 
> Could anyone help me?

.

Reply via email to