[Zoo-discuss] Zoo Java Service example / docs
Fenoy Gerald
gerald.fenoy at geolabs.fr
Fri Mar 13 07:29:12 PDT 2015
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 to the 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 the following 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
More information about the Zoo-discuss
mailing list