ubuntu-18.04javacejbca

How can i fix "BUILD FAILED" after trying to "ant -deploy"?


I received this "BUILD FAILED" while trying to install EJBCA on UBUNTU 18.04. The following messages appeared below "BUILD FAILED":

/opt/ejbca_ce_6_15_2_1/build.xml:1323: The following error occurred while executing this line:
/opt/ejbca_ce_6_15_2_1/modules/build.xml:260: The following error occurred while executing this line:
/opt/ejbca_ce_6_15_2_1/modules/cesecore-p11/build.xml:16: Compile failed; see the compiler error output for details.

Above the Build Failed message there were a total of 39 "javac" errors, specifying the problem. Some of those are:

jar: 
[mkdir] Created dir: /opt/ejbca_ce_6_15_2_1/modules/cesecore-p11/build
    [javac] Compiling 1 source file to /opt/ejbca_ce_6_15_2_1/modules/cesecore-p11/build
    [javac] /opt/ejbca_ce_6_15_2_1/modules/cesecore-p11/src/sun/security/pkcs11/CESeCoreUtils.java:15: error: package sun.security.pkcs11.wrapper is not visible
    [javac] import static sun.security.pkcs11.wrapper.PKCS11Constants.CKA_SENSITIVE;
    [javac]                                  ^
    [javac]   (package sun.security.pkcs11.wrapper is declared in module jdk.crypto.cryptoki, which is not in the module graph)

Others are like:

137: error: cannot find symbol
    [javac]             if ( e.getErrorCode()==CKR_ATTRIBUTE_READ_ONLY ) {
    [javac]                                    ^
    [javac]   symbol:   variable CKR_ATTRIBUTE_READ_ONLY
    [javac]   location: class CESeCoreUtils

The complete list of errors in this link https://pastebin.com/LMzDhdKn


Solution

  • Most likely you are not using one of the supported JDK versions. In the beginning of your build log (which you haven't pasted here) it prints what java version is used by your system. Make sure this is a supported one (from the EJBCA documentation). Since you are using Ubuntu, I'd recommend installing the OpenJDK 8 packages, and making sure this is used by configuring Ubuntu to use this, with the 'update-java-alternatives' command. The build log should then print in the beginning that OpenJDK 8 (with some specific build number) is being used.