Hi Frédéric,

Use javac to build .class files that will be used inside the jar
package. You can build it through the jar command line tool as explained
there :

http://docs.oracle.com/javase/tutorial/deployment/jar/build.html

Regards,

Sebastien BAHLOUL
IAM / Security specialist
Ldap Synchronization Connector : http://lsc-project.org
Blog : http://sbahloul.wordpress.com/



2012/11/12 "POISSON Frédéric" <[email protected]>

> Hello all,
>
> I'm reading the documentation
> http://lsc-project.org/wiki/documentation/2.0/configuration/tasks and i
> see that LSC is able to call a class with a method after sync and clean :
>
>    - *syncHook*: fully qualified name of a static method to invoke after
>    the synchronization task
>    - *cleanHook*: fully qualified name of a static method to invoke after
>    the clean task
>
> I'm a beginner with Java code so sorry for this simple question.
>
> I have tested to create a simple HelloWorld java self executing jar file
> (following this tuto
> http://en.newinstance.it/2012/04/17/self-executing-jar-files/) but i
> can't succeed to launch the right method. Here is my simple java code :
>
> # cat fpo/HelloWorld.java
> /*
>  * Comment
>  * Displays "Hello World!" to the standard output.
>  */
>
> package fpo;
>
> public class HelloWorld {
>     private void call()
>     {
>             System.out.println(" World");
>     }
>
>     public static void main(String[] args)
>     {
>             System.out.println("Hello");
>             HelloWorld hello = new HelloWorld();
>             hello.call();
>     }
> }
>
> When i call it from java command :
> # java -cp lib64/hello.jar fpo.HelloWorld
> Hello
>  World
>
> I have update lsc script to append CLASSPATH with my jar file, but i have
> this error :
> Nov 12 15:27:34 - DEBUG - Service Post Hook found: fpo.HelloWorld
> Nov 12 15:27:34 - DEBUG - Hook Class: fpo
> Nov 12 15:27:34 - DEBUG - Hook Method: HelloWorld
> Nov 12 15:27:34 - ERROR - Invalid Hook Class specified fpo for task Users
> Nov 12 15:27:34 - DEBUG - java.lang.ClassNotFoundException: fpo
> java.lang.ClassNotFoundException: fpo
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> ~[na:1.6.0_37]
>         at java.security.AccessController.doPrivileged(Native Method)
> ~[na:1.6.0_37]
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> ~[na:1.6.0_37]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> ~[na:1.6.0_37]
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> ~[na:1.6.0_37]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> ~[na:1.6.0_37]
>         at java.lang.Class.forName0(Native Method) ~[na:1.6.0_37]
>         at java.lang.Class.forName(Class.java:169) ~[na:1.6.0_37]
>         at
> org.lsc.SimpleSynchronize.runPostHook(SimpleSynchronize.java:277)
> [lsc-core-2.0.1.jar:na]
>         at org.lsc.SimpleSynchronize.launch(SimpleSynchronize.java:172)
> [lsc-core-2.0.1.jar:na]
>         at org.lsc.Launcher.run(Launcher.java:224) [lsc-core-2.0.1.jar:na]
>         at org.lsc.Launcher.launch(Launcher.java:159)
> [lsc-core-2.0.1.jar:na]
>         at org.lsc.Launcher.main(Launcher.java:142) [lsc-core-2.0.1.jar:na]
>
> My configuration is just :
> <cleanHook>fpo.HelloWorld</cleanHook>
>
> Do you have any sample of java code which permit to test or check syncHook
> or cleanHook ?
>
> Thanks in advance,
>
> --
>
> *Frederic Poisson*
>
> _______________________________________________________________
> Ldap Synchronization Connector (LSC) - http://lsc-project.org
>
> lsc-users mailing list
> [email protected]
> http://lists.lsc-project.org/listinfo/lsc-users
>
>
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to