First of all, thanks to both of you for responding promptly.

I am using -Djava.library.path=<path_to_library_files> option for specifying 
the path to the library.

The complete command is:

java -Djava.library.path=/iotivity/out/linux/x86_64/release/java/jni -classpath 
/TestingIoT/iotivity-samples/iotivity/security/server/target/classes/:/iotivity/out/linux/x86_64/release/java/iotivity.jar
 SecureTest.server.App

Also I have a iotivity.jar version that is built without security (SECURED=0). 
When I include that jar by suppling path to it. The server is able to run (the 
ACL is ignored during the operation but that is understandable given that the 
build was done without security in that case)

Best Regards
Suleman


-----Original Message-----
From: Nash, George [mailto:[email protected]] 
Sent: 13 November 2017 11:50 AM
To: Mats Wichmann <[email protected]>; Mahmood, Suleman <[email protected]>; 
[email protected]
Subject: RE: [dev] Java example with security

Also what command are you using to launch the built java program.  It must be 
able to find the native libraries.

On linux this can be done by setting LD_LIBRARY_PATH=<path_to_library_files> or 
depending on the setup of your java application you could add 
-Djava.library.path=<path_to_library_files>

The error to me look like it is not finding the library that it expects.

George

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Mats Wichmann
Sent: Friday, November 10, 2017 8:41 PM
To: Mahmood, Suleman <[email protected]>; [email protected]
Subject: Re: [dev] Java example with security

On 11/10/2017 08:02 PM, Mahmood, Suleman wrote:
> Hi,
> 
> I am new to Iotivity and recently started experimenting with java API.
> 
> I built the Java API using the following command on IoTivity 1.3 release:
> 
> scons WITH_TCP=yes RELEASE=yes TARGET_TRANSPORT=IP SECURED=1
> BUILD_JAVA=1 BUILD_SAMPLES=ON TARGET_ARCH=x86_64 WITH_CLOUD=yes 
> JAVA_HOME=$JAVA_HOME
> 
> I translated the C example using Access Control List to Java and executed the 
> Server. This gave me the following exception:
> 
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no oc_logger in 
> java.library.path
>       at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
>       at java.lang.Runtime.loadLibrary0(Runtime.java:870)
>       at java.lang.System.loadLibrary(System.java:1122)
>       at org.iotivity.base.OcPlatform.<clinit>(OcPlatform.java:39)
>       at test.App.createLEDResource(App.java:63)
>       at test.App.main(App.java:33)
> 
> 
> Is this a known bug or am I doing something wrong?

Known Bugs should be at jira.iotivity.org

oc_logger looks like it should be part of the java build, it's added in
java/jni/SConscript:

jni_env.PrependUnique(LIBS=[
    'resource_directory',
    'oc',
    'octbstack',
    'oc_logger',
    'connectivity_abstraction'
])

and is part of the "ensure" login in java/SConscript.

so it looks like something may have gone askew in the build that blocked the 
normal behavior

(sorry can't be more direct help than that, don't work on the java part) 
_______________________________________________
iotivity-dev mailing list
[email protected]
https://lists.iotivity.org/mailman/listinfo/iotivity-dev
_______________________________________________
iotivity-dev mailing list
[email protected]
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to