When you clone the corda or cordapp-template repos, they will default to the master branch. The master branch is being continuously developed upon, and its features may not align with the state of Corda as described in the docs. Additionally, the master branch of the CorDapp template may break in response to changes in the main corda repo.
When developing on Corda, you should always check out the latest milestone (i.e. stable) branch instead. For example, to check out milestone 0, you’d run
git checkout release-M0.
Many users have faced issues when running versions of Java that are either outdated, or are produced by organisations other than Oracle (e.g. OpenJDK). The errors generated by these issues will not always clearly point to the JDK as the cause. If in doubt, check your JDK version by following the instructions here. You can download the latest version of Oracle’s JDK here.
“Unresolved reference: javafx”¶
JavaFX is not bundled with OpenJDK. If you are using OpenJDK and get an ‘Unresolved reference: javafx’ error, this means that you need to install OpenJFX.
If you have APT installed and OpenJFX is part of your Unix distribution’s package list, you can do this by running
sudo apt install openjfx, and possibly
sudo apt install libopenjfx-jav. Other users will want to refer to the guide here, or to the list of Community Builds here.
No source files are present¶
When opening a project in IDEA for the first time, you will need to build the project. You should see “Unlinked Gradle project?” in a pop-up window in the top-right corner or in a popup alert window. It will also appear in the “Event Log” window which can be opened by clicking on “Event Log” at the bottom right of the IDEA window. Find one of these links and click on “Import Gradle Project”.
Wait for it to download the dependencies. You may then see another popup titled “Unindexed remote maven repositories found.” This won’t affect Corda, so you can choose to leave them unindexed.
If still have problems, the JetBrains website has more information on here.
Run configurations are missing¶
If you opened the Corda project by clicking “Import Project” on the IDEA splash screen rather than clicking “Open”, a bug
in IDEA will cause it to wipe and recreate the
.idea directory where the run configurations are stored. The fix is
simple and doesn’t require you to re-import the project: just undelete the files! You can do that by either:
git checkout .idea/runConfigurationsto redownload the files.
- Using the “Version Control” pane in IDEA to undelete the files via the GUI.
IDEA complains about lack of an SDK¶
If IDEA refuses to open a project because an SDK has not been selected, you may need to fix the project structure. Do this by following these instructions. The correct JDK is often found on a path such as
jdk1.8.0_xx…/Contents/Home. Ensure that you have the Project language level set at 8.
If you are having trouble selecting the correct JDK, the JetBrains website provides the following guidelines.
IDEA fails to compile Corda because it refuses to find some dependencies¶
First check that Corda compiles successfully from the command line using
gradlew clean build. If this succeeds then IntelliJ may just have imported the project’s Gradle files incorrectly. Try opening the
pane and clicking the “Refresh all Gradle projects” button. Then retry compiling Corda within IntelliJ. If this still fails then try
File/Invalidate Caches, Restart...
or checking the
Settings/Build,Execution,Deployment/Build Tools/Gradle/Runner/Delegate IDE build-run actions to gradle
checkbox, and then refreshing Gradle again.
IDEA fails to compile in VaultSchemaTest.kt¶
gradlew kaptKotlin to generate the sources IntelliJ is missing.
There are two ways to configure Kotlin in IDEA:
- Via the initial project opening screen, by using the
Configure > Pluginstab.
- From an open IDEA project, by clicking
IDEA -> Preferences ...(on OS X) or
File -> Settings(on Windows). Select the Plugins bar to confirm that Kotlin is installed and up-to-date.
If you are still having trouble installing Kotlin, first try upgrading the Kotlin plugin. At the time of writing, you can identify the latest version of the Kotlin plugin on this page.
Other common issues¶
Slow localhost resolution¶
Out of the box, Apple Mac’s have machine names that end in ”.local”, by default something like “MacBook-Pro.local”. This can cause long delays with starting Corda nodes as every attempt to look up the name of the local computer triggers a five second pause. This is not a bug in Corda but rather a problem with the macOS networking stack.
To fix it, you will need to use the Terminal app and edit your
/etc/hosts file. For instance, you can do this by
sudo nano /etc/hosts
then typing in your own password, assuming you are an administrator user of the computer.
You will need to ensure there are two lines for the name of your machine (which you can find in the Sharing section of System Preferences), which look like this:
127.0.0.1 MacBook-Pro.local fe80::1%lo0 MacBook-Pro.local
If you’ve changed the name of your computer in Sharing or via the
hostname command, obviously ensure you replace
MacBook-Pro.local with the correct name. Then press Ctrl-O to save the file and Ctrl-X to exit.