Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

NullPointerException #8

Closed
gvitali opened this issue Oct 16, 2018 · 17 comments
Closed

NullPointerException #8

gvitali opened this issue Oct 16, 2018 · 17 comments

Comments

@gvitali
Copy link

gvitali commented Oct 16, 2018

Hi. I always get this exception in console when try to compile any solidity code (e.g. HelloWorld from the tutorial). There are no any reaction in the app after "Compile" pressed.

HelloWorld.sol java.lang.NullPointerException22:42:54.956 ERROR [Thread-89] [DefaultConfig](DefaultConfig.java:28) Uncaught exception Thread[Thread-89,5,main],java.lang.NullPointerException at org.tron.studio.solc.CompilationErrorResult.parse(CompilationErrorResult.java:65) at org.tron.studio.ui.RightTabCompileController.lambda$onClickCompile$10(RightTabCompileController.java:75) at java.lang.Thread.run(Thread.java:748)

Archlinux,
Oracle JDK
$ java -version java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

What could I do to make it working?

@UnforgivenZZZ
Copy link
Contributor

Hi. I always get this exception in console when try to compile any solidity code (e.g. HelloWorld from the tutorial). There are no any reaction in the app after "Compile" pressed.

HelloWorld.sol java.lang.NullPointerException22:42:54.956 ERROR [Thread-89] [DefaultConfig](DefaultConfig.java:28) Uncaught exception Thread[Thread-89,5,main],java.lang.NullPointerException at org.tron.studio.solc.CompilationErrorResult.parse(CompilationErrorResult.java:65) at org.tron.studio.ui.RightTabCompileController.lambda$onClickCompile$10(RightTabCompileController.java:75) at java.lang.Thread.run(Thread.java:748)

Archlinux,
Oracle JDK
$ java -version java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

What could I do to make it working?

thats probably the contract is not in the directory the studio reads from. right now it creates in the /User/username/TronStudio/source/ when creates new file. Also make sure you use the latest version of studio branch to build

@gvitali
Copy link
Author

gvitali commented Oct 17, 2018

Thank you for the prompt response.
That's what I did:

Once Tron Studio is launched, please copy and paste the Hello World smart contract as shown below, and select the Compile button under the Compile tab in the far right window.

I didn't specified any directory because I don't see any button for that.
I use the latest version

@UnforgivenZZZ
Copy link
Contributor

UnforgivenZZZ commented Oct 18, 2018

Thank you for the prompt response.
That's what I did:

Once Tron Studio is launched, please copy and paste the Hello World smart contract as shown below, and select the Compile button under the Compile tab in the far right window.

I didn't specified any directory because I don't see any button for that.
I use the latest version

I tried again from 0 and didnt have any error, this is what my procedure:

download from https://github.com/tronprotocol/tron-studio/archive/1.0.0.zip

unzip it and go to the directory

./gradlew build -x test -x check

java -jar build/libs/TronStudio.jar

@gvitali
Copy link
Author

gvitali commented Oct 18, 2018

Did everything as you described, also from 0 with your zip.

Still get the error in console when press "Compile" button. No any message in UI.

HelloWorld.sol
17:17:50.920 ERROR [Thread-23] [DefaultConfig](DefaultConfig.java:28) Uncaught exception Thread[Thread-23,5,main],java.lang.NullPointerException
java.lang.NullPointerException
at org.tron.studio.solc.CompilationErrorResult.parse(CompilationErrorResult.java:65)
at org.tron.studio.ui.RightTabCompileController.lambda$onClickCompile$10(RightTabCompileController.java:75)
at java.lang.Thread.run(Thread.java:748)

Updated JDK to the latest version in repository:

$ java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

Just FYI, also had errors during building:

[Fatal Error] sonarqube-gradle-plugin-2.6.pom:1:44: Content is not allowed in prolog.
[Fatal Error] protobuf-gradle-plugin-0.8.3.pom:1:44: Content is not allowed in prolog.
[Fatal Error] shadow-2.0.2.pom:1:44: Content is not allowed in prolog.
[Fatal Error] guava-18.0.pom:1:44: Content is not allowed in prolog.
[Fatal Error] osdetector-gradle-plugin-1.4.0.pom:1:44: Content is not allowed in prolog.
[Fatal Error] commons-lang-2.6.pom:1:44: Content is not allowed in prolog.
[Fatal Error] groovy-backports-compat23-2.4.4.pom:1:44: Content is not allowed in prolog.
....
[Fatal Error] aopalliance-1.0.pom:1:44: Content is not allowed in prolog.

But in the end:

BUILD SUCCESSFUL in 1m 55s
13 actionable tasks: 13 executed

System:
Linux 4.18.12-arch1-1-ARCH #1 SMP PREEMPT x86_64 GNU/Linux

@kromulan
Copy link

Hi, I've, been debugging and found that the problem on Ubuntu Linux system 16.04 LTS (xenial) is in fact that libz3.so.4 is not available to solc binary:

solidityCompilerResult.errors = /home/krome/TronStudio/compiler/solc: error while loading shared libraries: libz3.so.4: cannot open shared object file: No such file or directory

Quick fix (but not a reliable one, multiverse does not contain the package so i just used launchpad one):
curl -LO http://launchpadlibrarian.net/229093392/libz3-dev_4.4.0-5_amd64.deb
sudo dpkg -i libz3-dev_4.4.0-5_amd64.deb

Check if you have: /usr/lib/x86_64-linux-gnu/libz3.so.4 shared library in path.

RERUN Application.

It should work, at least it did for me. :)

-Krome Plasma (Kromulan)

@kromulan
Copy link

Hi, I've, been debugging and found that the problem on Ubuntu Linux system 16.04 LTS (xenial) is in fact that libz3.so.4 is not available to solc binary:

solidityCompilerResult.errors = /home/krome/TronStudio/compiler/solc: error while loading shared libraries: libz3.so.4: cannot open shared object file: No such file or directory

Quick fix (but not a reliable one, multiverse does not contain the package so i just used launchpad one):
curl -LO http://launchpadlibrarian.net/229093392/libz3-dev_4.4.0-5_amd64.deb sudo dpkg -i libz3-dev_4.4.0-5_amd64.deb

Check if you have: /usr/lib/x86_64-linux-gnu/libz3.so.4 shared library in path.

RERUN Application.

It should work, at least it did for me. :)

-Krome Plasma (Kromulan)

I am sure different linux, unix distributions have a similar solution (just find libz3 package).

@kromulan
Copy link

To author, this is a dynamically linked binary:

krome:~/Development/tron-studio$ ldd src/main/resources/bin/linux/solc
linux-vdso.so.1 => (0x00007ffc033f2000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2cccc11000)
libz3.so.4 => /usr/lib/x86_64-linux-gnu/libz3.so.4 (0x00007f2ccb9e6000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2ccb664000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2ccb35b000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2ccb145000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2ccad7b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2ccce2e000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f2ccab73000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f2cca951000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2cca74d000)

Perhaps distributing these as statically compiled binaries would be a bit less problematic in this aspect.

@gvitali
Copy link
Author

gvitali commented Oct 19, 2018

kromulan, thank you.

I installed z3 and now have libz3:
libz3.so
libz3.so.4.7
libz3.so.4.7.1.0

Then built everything from beginning.
But it still doesn't work because it wants exactly libz3.so.4 for some reason:
$ ldd src/main/resources/bin/linux/solc
linux-vdso.so.1 (0x00007ffc03857000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f1d4b069000)
libz3.so.4 => not found
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f1d4aeda000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f1d4ad55000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f1d4ad3b000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f1d4ab77000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f1d4b0b1000)

@gvitali
Copy link
Author

gvitali commented Oct 24, 2018

It works with manually created symlink libz3.so.4 to libz3.so.
Thank you kromulan

@gvitali gvitali closed this as completed Oct 24, 2018
@davidboto
Copy link

I was facing the same problem.

The solution presented by @kromulan worked for me.

Thank you.

@h0st1le
Copy link

h0st1le commented Nov 8, 2018

Ran into this issue as well. @kromulan solution also worked for me.

@aker0357
Copy link

Did everything as you described, also from 0 with your zip.

Still get the error in console when press "Compile" button. No any message in UI.

HelloWorld.sol
17:17:50.920 ERROR [Thread-23] [DefaultConfig](DefaultConfig.java:28) Uncaught exception Thread[Thread-23,5,main],java.lang.NullPointerException
java.lang.NullPointerException
at org.tron.studio.solc.CompilationErrorResult.parse(CompilationErrorResult.java:65)
at org.tron.studio.ui.RightTabCompileController.lambda$onClickCompile$10(RightTabCompileController.java:75)
at java.lang.Thread.run(Thread.java:748)

Updated JDK to the latest version in repository:

$ java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

Just FYI, also had errors during building:

[Fatal Error] sonarqube-gradle-plugin-2.6.pom:1:44: Content is not allowed in prolog.
[Fatal Error] protobuf-gradle-plugin-0.8.3.pom:1:44: Content is not allowed in prolog.
[Fatal Error] shadow-2.0.2.pom:1:44: Content is not allowed in prolog.
[Fatal Error] guava-18.0.pom:1:44: Content is not allowed in prolog.
[Fatal Error] osdetector-gradle-plugin-1.4.0.pom:1:44: Content is not allowed in prolog.
[Fatal Error] commons-lang-2.6.pom:1:44: Content is not allowed in prolog.
[Fatal Error] groovy-backports-compat23-2.4.4.pom:1:44: Content is not allowed in prolog.
....
[Fatal Error] aopalliance-1.0.pom:1:44: Content is not allowed in prolog.

But in the end:

BUILD SUCCESSFUL in 1m 55s
13 actionable tasks: 13 executed

System:
Linux 4.18.12-arch1-1-ARCH #1 SMP PREEMPT x86_64 GNU/Linux

got same error at macos, but @kromulan solution cannot work on mac

@kromulan
Copy link

kromulan commented Nov 12, 2018

@aker0357 Open a TronStudio.jar. There is a bin\mac directory, decompress it and use ldd equivalent tool i believe it's otool (http://schumakov.info/howto-osx.php).

Check solc's dynamically linked libraries, see if they are all there on your system. I did not check the osx version as i don't use osx. I'll see if i can get access to an osx machine and check it out tommorow at work.

Anyway the problem on x86/amd64 version for linux was missing dynamically linked compression libz/zlib library. I am not sure with mac but there's no harm to check (the dylib, could also possibly be provided by brew on osx, try and let us know).

Hope this helps until i get more information if i am able to.

@aker0357
Copy link

@kromulan there is something weird that, at first I had errors during building like gvitali and the TronStudio.jar is not executable, then I try some solutions from this thread and other similar problem .

Sadly, most of solution is for linux and did not work on me, after the auto update of Mac OS the compile seems still has error but the jar is executable.

I would try your comment to check what's the problem after working hours, thanks a lot.

@beelzebub520
Copy link

When I used tron studio, I found that importing eth smart contract, click compile to display sha3 function not found

@dream-deepblue
Copy link

when i comile the contract, tips show success, but there have nothing in detail, just empty, anybody know what happend???

@Pharamys
Copy link

Pharamys commented Mar 5, 2019

Same problem... When I compile, empty...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants