EOSIO / eosio-java

EOSIO SDK for Java - API for integrating with EOSIO-based blockchains
https://eosio.github.io/eosio-java/
MIT License
127 stars 44 forks source link

Having issue Java to EOSIO smart contract #106

Closed saradach closed 3 years ago

saradach commented 4 years ago

Hi All,

I tried to connect to Simple Java Using EOSIO using RCPprovider but it looks eosio-java is tightly coupled with Andriod and can't find eosiojavaandroidabieosserializationprovider & eosiojavarpcprovider as these are aar files not jar files. If I can get simple java to smartcontract like:

 IRPCProvider rpcProvider = new EosioJavaRpcProviderImpl("");
 ISerializationProvider serializationProvider = new AbiEosSerializationProviderImpl();
IABIProvider abiProvider = new ABIProviderImpl(rpcProvider, serializationProvider);
 ISignatureProvider signatureProvider = new SoftKeySignatureProviderImpl();

I get error at initial stage EosioJavaRpcProviderImpl,AbiEosSerializationProviderImpl classes not found. The test contains mock's that not helpful for me for realtime connectivity.

        <dependency>
            <groupId>one.block</groupId>
            <artifactId>eosiojava</artifactId>
            <version>0.1.0</version>
        </dependency>        
      <dependency>
            <groupId>one.block</groupId>
            <artifactId>eosiojavasoftkeysignatureprovider</artifactId>
            <version>0.1.2</version>
        </dependency>
        <dependency>
            <groupId>one.block</groupId>
            <artifactId>eosiojavarpcprovider</artifactId>
            <version>0.1.0</version>
        </dependency>
        <dependency>
            <groupId>one.block</groupId>
            <artifactId>eosiojavaandroidabieosserializationprovider</artifactId>
            <version>0.1.0</version>
        </dependency>
saradach commented 4 years ago

After adding dependencies

        <dependency>
            <groupId>com.squareup.retrofit2</groupId>
            <artifactId>retrofit</artifactId>
            <version>2.7.1</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.retrofit2</groupId>
            <artifactId>converter-gson</artifactId>
            <version>2.7.1</version>
        </dependency>

Now I m getting error : os-mac ava.lang.UnsatisfiedLinkError: no abieos-lib in java.library.path

opi-smccoole commented 4 years ago

Hi saradach, sorry you have having issues. Since the abieos library used by the abieos serialization provider is C++, it has to be built for the architecture and platform that you are going to use it on. If you look at the abieos serialization provider project you will see that it so far is only configured for building/cross compilation for Android, (thus the aar artifacts). At this time, if you need to run on another architecture or platform, you would need to enhance the abieos serialization provider to build for your required platform and architecture or use an alternate serialization provider that conforms to the ISerializationProvider interface.

crosspollinate commented 4 years ago

Hi saradach, sorry you have having issues. Since the abieos library used by the abieos serialization provider is C++, it has to be built for the architecture and platform that you are going to use it on. If you look at the abieos serialization provider project you will see that it so far is only configured for building/cross compilation for Android, (thus the aar artifacts). At this time, if you need to run on another architecture or platform, you would need to enhance the abieos serialization provider to build for your required platform and architecture or use an alternate serialization provider that conforms to the ISerializationProvider interface.

@opi-smccoole what serialization provider would you recommend for running on Java SDK (no android)? Any suggestion greatly appreciated. Thanks.

opi-smccoole commented 4 years ago

@crosspollinate Sorry, as far as I know right now there aren't currently any other providers that conform to the ISerializationProvider interface. The main issue is knowing what platform you are targeting in order to do cross compiling of the C++ modules. The existing JNI bridging code should work mostly as is I would think. It'd largely be a matter of making sure you have a C++ 17 build chain for your target and altering the build/CMake appropriately.

jlamarr22 commented 4 years ago

Just posting an update to anyone wondering about compatibility with server-side java. We're in the process of wrapping both the eosio-java-rpc-provider and eosio-java-android-abieos-serialization-provider to convert them to JARs and should have these released in the next month.

crosspollinate commented 4 years ago

Thanks. Keep us posted.

On Fri, Jul 17, 2020, 5:39 PM Jon La Marr notifications@github.com wrote:

Just posting an update to anyone wondering about compatibility with server-side java. We're in the process of wrapping both the eosio-java-rpc-provider https://github.com/EOSIO/eosio-java-rpc-provider and eosio-java-android-abieos-serialization-provider https://github.com/EOSIO/eosio-java-android-abieos-serialization-provider to convert them to JARs and should have these released in the next month.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EOSIO/eosio-java/issues/106#issuecomment-660176417, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZGHAQVNKIQPRPLQLMPAC3R4BWCTANCNFSM4KW34OSA .

opi-smccoole commented 3 years ago

With the 1.0 releases we now have eosio-java-abieos-serialization-provider and eosio-java-rpc-provider that do not require Android. They, along with eosio-java can now be used for non-Android Java projects.