It should work and may be a bug. I'll try to reproduce.

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]>

> Already tested, it return that :
>
> Nov 12 18:02:08 - DEBUG - Service Post Hook found: fpo.HelloWorld.main
> Nov 12 18:02:08 - DEBUG - Hook Class: fpo.HelloWorld
> Nov 12 18:02:08 - DEBUG - Hook Method: main
> Nov 12 18:02:08 - ERROR - Invalid hook method main specified for task Users
> Nov 12 18:02:08 - DEBUG - java.lang.NoSuchMethodException:
> fpo.HelloWorld.main()
> java.lang.NoSuchMethodException: fpo.HelloWorld.main()
>         at java.lang.Class.getMethod(Class.java:1605) ~[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]
>
> Regards,
>
> Le 12/11/12, *Sébastien Bahloul * <[email protected]> a écrit :
>
> Try <cleanHook>fpo.HelloWorld.main</cleanHook>
>
> 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]>
>
>> Yes i copy it inside lib64 directory :
>>
>> # ls -l lib64/hello.jar
>> -rw-r--r-- 1 root root 850 Nov 12 15:25 lib64/hello.jar
>>
>> and i updated lsc script like this :
>> # tail -15  bin/lsc
>> CLASSPATH="$CLASSPATH:lib64/hello.jar"
>> "${JAVA_COMMAND}" $JAVA_OPTS -cp "$CLASSPATH" org.lsc.Launcher $PARAMETERS
>> ...
>>
>> But if i read my code HelloWorld is the class and i defined inside
>> lsc.xml :
>> <cleanHook>fpo.HelloWorld</cleanHook>
>>
>> And inside my code i have only a main method ? the call method is a
>> private method. So is my lsc.xml correctly defined ?
>>
>> Regards,
>>
>>
>> Le 12/11/12, *Sébastien Bahloul * <[email protected]> a écrit :
>>
>> Hi Frédéric,
>>
>> Can you confirm that you put the heelo.jar inside the Java classpath ?
>> i.e. in the lib subdirectory of LSC_HOME
>>
>> 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,
>>>
>>>  I succeed to build my .java code and i succeed to create an "hello.jar"
>>> with a manifest file with following command :
>>> # jar -cvmf META-INF/MANIFEST.MF hello.jar fpo/HelloWorld.class
>>>
>>> I succeed also to call my code with java command with my newly created
>>> jar  file.
>>>
>>> my question  is about the code to generate a splendid "Hello World" at
>>> end of clean/sync phase. And in my example i don't succeed to give to LSC
>>> or write a correct class or method :
>>>
>>>
>>> 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
>>>
>>> Do you have an example of code using sync or clean Hook ? O
>>>
>>> Thanks in advance,
>>>
>>>
>>> Le 12/11/12, *Sébastien Bahloul * <[email protected]> a écrit
>>> :
>>>
>>> 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
>>>>
>>>>
>>> --
>>>
>>> *Frederic Poisson*
>>>
>>
>> --
>>
>> *Frederic Poisson*
>>
>
> --
>
> *Frederic Poisson*
>
>
_______________________________________________________________
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