You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by jose luis sanchez <jo...@m-centric.com> on 2009/08/17 12:19:02 UTC

T5.1 and JNI

Hi guys.
I'm using a JNI library directly inside a service i have binded into 
T5.1, but i can't get it to run because of a UnsatiesfiedLinkError.

I'll show you how my setup is :

( System is ubuntu 9.04 )

Library in  /etc/lib/mylib.so

AppModule.java
  public static void bind(ServiceBinder binder)
    {
        binder.bind(LicenseCheck.class,LicenseCheckImpl.class);
    }


LicenseCheckImpl.java {

    /** JNI Interface */
    public static native String licenseVerify(String file, String feature);
   
   
    static {
        System.load("/etc/lib/liblicense_verify.so");
    }
   
    public LicenseCheckImpl() {
               
    }
   
    public String check() {
       return licenseVerify("","");
    }
}

License.tml
@Inject
private LicenseCheck theLicenseCheck;

public void checkLicense() {
    String license =   theLicenseCheck.check();  
}


[DEBUG] AppModule.LicenseCheck Invoking constructor 
hsiAdministrationConsole.services.LicenseCheckImpl() (at 
LicenseCheckImpl.java:25) via 
hsiAdministrationConsole.services.AppModule.bind(ServiceBinder) (at 
AppModule.java:28).
[ERROR] TapestryModule.RequestExceptionHandler Processing of request 
failed with uncaught exception: 
com.mcentric.glo.hsiAdministrationConsole.services.LicenseCheckImpl.licenseVerify(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
java.lang.UnsatisfiedLinkError: 
hsiAdministrationConsole.services.LicenseCheckImpl.licenseVerify(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    at 
hsiAdministrationConsole.services.LicenseCheckImpl.licenseVerify(Native 
Method)
    at 
hsiAdministrationConsole.services.LicenseCheckImpl.checkLicense(LicenseCheckImpl.java:34)
    at 
$LicenseCheck_12327d32a7a.checkLicense($LicenseCheck_12327d32a7a.java)



If i call the library from inside a sample java file, the program works.
public class LicenseVerify {

   public static native String licenseVerify(String file, String feature);

   static {
     System.load("/etc/lib/liblicense_verify.so");
   }

   public static void main (String args[]) {
     String s=licenseVerify(args[0],args[1]);
     System.out.print(s);
   }

}


Is a T5 related problem ?

Btw, running inside a Tomcat 6.0.20 container.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1 and JNI

Posted by jose luis sanchez <jo...@m-centric.com>.
Problem solved .. a javah incorrect creation :(
> Hi guys.
> I'm using a JNI library directly inside a service i have binded into 
> T5.1, but i can't get it to run because of a UnsatiesfiedLinkError.
>
> I'll show you how my setup is :
>
> ( System is ubuntu 9.04 )
>
> Library in  /etc/lib/mylib.so
>
> AppModule.java
>  public static void bind(ServiceBinder binder)
>    {
>        binder.bind(LicenseCheck.class,LicenseCheckImpl.class);
>    }
>
>
> LicenseCheckImpl.java {
>
>    /** JNI Interface */
>    public static native String licenseVerify(String file, String 
> feature);
>        static {
>        System.load("/etc/lib/liblicense_verify.so");
>    }
>      public LicenseCheckImpl() {
>                  }
>      public String check() {
>       return licenseVerify("","");
>    }
> }
>
> License.tml
> @Inject
> private LicenseCheck theLicenseCheck;
>
> public void checkLicense() {
>    String license =   theLicenseCheck.check();  }
>
>
> [DEBUG] AppModule.LicenseCheck Invoking constructor 
> hsiAdministrationConsole.services.LicenseCheckImpl() (at 
> LicenseCheckImpl.java:25) via 
> hsiAdministrationConsole.services.AppModule.bind(ServiceBinder) (at 
> AppModule.java:28).
> [ERROR] TapestryModule.RequestExceptionHandler Processing of request 
> failed with uncaught exception: 
> com.mcentric.glo.hsiAdministrationConsole.services.LicenseCheckImpl.licenseVerify(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; 
>
> java.lang.UnsatisfiedLinkError: 
> hsiAdministrationConsole.services.LicenseCheckImpl.licenseVerify(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; 
>
>    at 
> hsiAdministrationConsole.services.LicenseCheckImpl.licenseVerify(Native 
> Method)
>    at 
> hsiAdministrationConsole.services.LicenseCheckImpl.checkLicense(LicenseCheckImpl.java:34) 
>
>    at 
> $LicenseCheck_12327d32a7a.checkLicense($LicenseCheck_12327d32a7a.java)
>
>
>
> If i call the library from inside a sample java file, the program works.
> public class LicenseVerify {
>
>   public static native String licenseVerify(String file, String feature);
>
>   static {
>     System.load("/etc/lib/liblicense_verify.so");
>   }
>
>   public static void main (String args[]) {
>     String s=licenseVerify(args[0],args[1]);
>     System.out.print(s);
>   }
>
> }
>
>
> Is a T5 related problem ?
>
> Btw, running inside a Tomcat 6.0.20 container.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org