[Zoo-discuss] Zoo Java Service example / docs
Fenoy Gerald
gerald.fenoy at geolabs.fr
Wed Mar 18 04:13:32 PDT 2015
Hi Alex,
the deadline for the GSoC application is the next friday (march 27th).
For the issue about the classpath and library-path we should have a deeper look into this problem.
Nevertheless, your comments make me feel that we should find some automated way to add the dependencies. I suppose that this may be much easier to handle with a compilation system such as maven, extracting dependencies will require that they are defined/detected somewhere.
I am now also thinking about defining the specific classpath and library path at the service level, so somewhere in the ZCFG file of the service. Let me know if you think there is any interest in handling this informations directly at the service level as I suppose it is.
Hope to hear back from you,
Best regards,
> Le 18 mars 2015 à 04:51, Alex Kmoch <alex_kmoch at yahoo.de> a écrit :
>
> Hi Gerald,
>
> thanks for your feedback. Indeed the I used the "main.cfg [env] CLASSPATH" config to list all the single JGrassmodules and their MAven-Dependencies, which is a bit tedious, because it's like 30-40 libs at least. And the classüath/java-library-path config in my Apache config actually behaved differently on my Ubuntu and on the Arch Linux and I am not sure why. I guess I will have to test and document it a bit more in-depth so you can get an idea.
>
> I am starting to prepare the student proposal / application here [1]. I am a little bit on vacation this week, but the proposal deadline is next Friday, if I understood correctly?
>
> Best Regards,
> Alex
>
>
> [1] https://www.google-melange.com/gsoc/proposal/review/student/google/gsoc2015/allixender/5717271485874176
>
> Am 13.03.2015 um 07:29 schrieb Fenoy Gerald:
>> Hi Alex,
>> my comments inline below.
>>
>>> Le 13 mars 2015 à 00:37, Alexander Kmoch <alexander.kmoch at aut.ac.nz> a écrit :
>>>
>>> Hi,
>>>
>>> I am elaborating through the ZOO Java Services example. There are some confusing hints in the docs [1]:
>>>
>>> The Java code shows:
>>>
>>>> public class HelloJava
>>>
>>> but speaks of a HelloWorld.class :-) That doesn't match. So I renamed the the class to
>>>
>>>> public class HelloWorld
>>>
>>> And also it is a bit complicated to figure the right HelloWorld.zcfg -> In fact I realised the ZCFG file should be calles HelloWorldJava.zcfg because it's the method within the HelloWorld.class that get's called by ZOO if I understoo it correctly
>>>
>>> ###snippet start###
>>>
>>> [HelloWorldJava]
>>> Title = Java Demo Hello World
>>> ...
>>> serviceType = Java
>>> serviceProvider = HelloWorld
>>>
>>> <MetaData>
>>> title = Metadata title of your service
>>> </MetaData>
>>> <DataInputs>
>>> ...
>>> </DataInputs>
>>> <DataOutputs>
>>> ...
>>> </DataOutputs>
>>> ###snippet end###
>>>
>>
>> The documentation has been updated in rev. [1] based on your feedbacks.
>>
>>
>>> I finally have to resolve a java.lang.UnsatisfiedLinkError: no ZOO in java.library.path
>>
>> This is strange and it is not the correct behavior. On line 80 [2] we define the first option to pass to the JVM.
>>
>> The documentation for Java support in rev. 613 was updated to present the[javaxx] and [javax] sections [3] which can be added to the main.cfg file.
>>
>>>
>>> This is the JAVA classpath thing I reckon, so I added some Env config tothe Apache2 for the CGI:
>>>
>>> ###snippet start###
>>> SetEnv JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64
>>> SetEnv JAVA_OPTS "-Xmx512m -Djava.library.path=/vol1/www/smart/includes/zoo-cgi-bin"
>>>
>>> SetEnv CLASSPATH /vol1/www/smart/includes/zoo-cgi-bin
>>>
>>> SetEnv LD_LIBRARY_PATH /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server:/vol1/www/smart/includes/zoo-cgi-bin
>>> ###snippet end###
>>>
>>
>> For each environment variables you want to have defined at service runtime, you can use the [env] section. For each map a=b in this section, the environment variable a will be defined as b. For instance you may define thefollowing in your main.cfg file:
>>
>> [env]
>> JAVA_HOME=/usr/local/default
>> LD_LIBRARY_PATH=/usr/local/default/jre/lib/amd64/server
>> CLASSPATH=/usr/lib/cgi-bin/jgrasstools/libs/*.jar
>>
>> Still, the CLASSPATH is not pointing to the ZOO-Kernel directory as it should be defined dynamically. If it is not working without setting the CLASSPATH to the ZOO-Kernel directory, it means something goes wrong in the way we use the -Djava.class.path option.
>>
>>> And it runs now.
>>>
>>> Cheers,
>>> Alex
>>>
>>>
>>> [1] http://zoo-project.org/docs/services/howtos.html#java
>>> _______________________________________________
>>> Zoo-discuss mailing list
>>> Zoo-discuss at lists.osgeo.org
>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss
>>
>>
>> Best regards,
>>
>> [1] http://zoo-project.org/trac/changeset/613
>> [2] http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-kernel/service_internal_java.c#L80
>> [3] http://zoo-project.org/docs/services/howtos.html#java
>>
Gérald Fenoy
http://wiki.osgeo.org/wiki/User:Djay
More information about the Zoo-discuss
mailing list