hyperledger-archives / iroha

Iroha - A simple, decentralized ledger
http://iroha.tech
Apache License 2.0
988 stars 297 forks source link

some java binding classes have no package name #1301

Closed walkero closed 6 years ago

walkero commented 6 years ago

hi

I tested java client example iroha/example/javaTransactionExample.java it is OK, can be luanched at console window. javaTransactionExample.java file has none package name, can find some none package name classes in iroha-bindings-example.jar :

Transaction.class
Query.class
ByteVector.class
PublicKey.class
......

but when I want to access irohad from a java web application, not a console base application, my java spring web framework couldn't find those none package classes (default package class) in iroha-bindings-example.jar classes which have package name couldn't find none package name classes in java.

it is possible to add package name to those none package name java classes ? package iroha.xxxx;

thanks

luckychess commented 6 years ago

That's possible but unfortunately that will be not enough. Actually all class names, method names etc should contain package prefix inside shared library (libirohajava,so or libirohajava.jni). That means that shared library should also be recompiled for every package name. Any non-empty package name will be fine for you, right? Please correct me if I'm wrong.

walkero commented 6 years ago

hi, @luckychess thank you. Yes,that is what i want, you are right, i added package name to those none package name classes in iroha-bindings-example.jar, but that does not work. How to add package name and recompile the libirohajava.so ? Do you have any instructive document for my reference?

thanks

walkero commented 6 years ago

I found a file for reference: iroha/shared_model/packages/android/android-build.sh and modified the CMakeLists.txt file

    diff CMakeLists.txt CMakeLists.txt.bak 
        68c68
        <     SET(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -package sun)
        ---
        >     find_package(JNI REQUIRED)

thanks

laSinteZ commented 6 years ago

@walkero thank you for your great job! Could you please open a PR with those changes, maybe it makes sense to add them directly to Iroha? (Don't forget to sign your commits with DCO though github.com/apps/dco and describe changes)

walkero commented 6 years ago

@laSinteZ thank you I will try to do it. It will be my first time to open a PR, I'll learn how to do it first.

laSinteZ commented 6 years ago

@walkero if you have any problems with it – we are glad to help. To make things faster, you can use https://gitter.im/hyperledger-iroha/Lobby or in https://chat.hyperledger.org/channel/iroha :)

walkero commented 6 years ago

hi, @laSinteZ I opened a PR. thanks