Installation and Deployment

I get timeouts and/or errors during 'ant deploy' with EJBCA 6+ and JBoss EAP7/Wildfly10 (or later)?

Ensure that the application server has enough cores (more than one), enough CPU (otherwise timeouts will occur) and enough memory (will also slow down the system).

The current installation procedures for JBoss EAP/Wildfly uses the JBoss CLI to configure the application server. The JBoss CLI turns out not to be too well suited for automated deploys, so functions can break. For example if the machine has too few cores CLI connections will mysteriously terminate and report errors.

Contributions to improve the automated installation on JBoss EAP/Wildfly are welcome.

I get an error with "Java heap space" when building EJBCA (during ant deploy)?

This error is because the default maximum allowed memory allocation for JAVA is set too low in your environment.

My installation failed for some reason that is now fixed, how do I proceed?

The best way to recover is usually o start over from scratch:

  • Stop JBoss

  • Make sure the database is clean

  • Run "ant clean"

  • Run "ant deploy"

  • Start JBoss and check that it starts without problems

  • Run "ant install"

  • Stop JBoss and check that it stops without problems

  • Start JBoss and check that it starts without problems

  • Remove the old superadmin.p12 in you browser and import the newly generated one

I get strange errors during 'ant deploy' or 'ant install'.

This is most usually due to a database configuration error. In the server log (JBOSS_HOME/server/default/log/server.log) you will probably see some SQLException errors. You should then:

  • Make sure the settings in conf/database.properties are correct

  • Follow the guidelines from "My installation failed for some reason that is now fixed, how do I proceed?"

See the configuration and troubleshooting section in doc/howto/HOWTO-database.txt for additional database related information.

There was a bug in `ant install` triggered by JBoss EAP 6.14.19 and later. The error message you get during `ant install` if you hit this bug is:

Can't reset to root in the middle of the path

This bug was fixed in EJBCA 6.14. See ECA-7094 for details.

I get an error with "Illegal key length" when using EJBCA?

This is because you have not installed the "Unlimited Strength Crypto Policy Files" in the Oracle JDK. See the prerequisites section in the the installation guide. Even if you think you have installed them, you have not. This error is simple and unique.

It may also be that you are trying to enroll for a certificate passing in a public key with length that is shorter than the required key length specified in the Certificate Profile.

After an upgrade I get a "java.lang.NoSuchMethodError" error accessing the UI.

JBoss is bad at cleaning temporary files, sometimes we have to help. Remove the directories JBOSS_HOME/server/default/tmp and JBOSS_HOME/server/default/work and restart JBoss.

During the build process I get errors like: BUILD FAILED /usr/ejbca/build.xml:789: java.lang.ExceptionInInitializerError

You probably have ant pre-installed as a package from Fedora or Suse. Those pre-installations does not contain all default ant modules. You need the "optional tasks" included in the official ant distribution. Either add modules to the installed ant, or download the latest ant from http://ant.apache.org/.

A simple fix is to change the /etc/ant.conf to point to your user installed ant (in /your/ant/home). Change from:

#
# ant.conf (Ant 1.6.x)
# JPackage Project (http://www.jpackage.org/)
#
 
# Validate --noconfig setting in case being invoked
# from pre Ant 1.6.x environment
if [ -z "$no_config" ] ; then
no_config=true
fi
 
# Setup ant configuration
if $no_config ; then
# Disable RPM layout
rpm_mode=false
else
# Use RPM layout
rpm_mode=true
 
# ANT_HOME for rpm layout
ANT_HOME=/usr/share/ant
fi

to

#
# ant.conf (Ant 1.6.x)
# JPackage Project (http://www.jpackage.org/)
#
 
# Validate --noconfig setting in case being invoked
# from pre Ant 1.6.x environment
if [ -z "$no_config" ] ; then
no_config=true
fi
 
# Setup ant configuration
if $no_config ; then
# Disable RPM layout
rpm_mode=false
else
# Use RPM layout
rpm_mode=false
 
# ANT_HOME for rpm layout
ANT_HOME=/your/ant/home
fi

For Ubuntu things are much easier, just 'sudo apt-get install ant' and 'sudo apt-get install ant-optional'.

How can I run JBoss as a service in Windows?

There is documentation over at JBoss for several different options:
http://community.jboss.org/wiki/RunJBossAsAServiceOnWIndows

In short summary you should download JBoss Native, that has a script for installing JBoss as a windows service.

Where is the log file stored for tracking errors and debug information?

JBOSS_HOME/server/default/log/server.log or where you configured conf/log4j-appserver.xml to store them.

How do I configure log level in JBoss?

See the Installation guide in the JBoss section for instructions.

Can I add my own static pages under http://hostname:8080/ejbca/ ?

Put your files (static HTML is easy) under modules/publicweb-gui/resources/, do a full build and re-deploy.

I get an error message when accessing the CA UI, "Could not establish an encrypted connection because your certificate was rejected ... Error code: -12224"?

  1. Make sure you have imported to correct superadmin.p12 in your browser.

  2. You may have to delete and import the CA certificate in your applicatioon server trust-store:

ant javatruststore

You can also import another CA than the initial ManagementCA (My CA in the example) with the command:

ant -Dca.name="My CA" javatruststore

Make sure you restart JBoss after making changes to the java trust store.

Perhaps the JBoss/Tomcat configuration was not done automatically because you are running another configuration than 'default' in JBoss. the file 'jboss-5.1.0.GA/server/default/deploy/jbossweb.sar/server.xml' holds the Tomcat configuration. The configuration should be like the following, where 'serverpwd' is the 'httpsserver.password' as configured in web.properties.

<!-- HTTPS Connector requiring client cert on port 8443 -->
<Connector port="8443" address="${jboss.bind.address}"
maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
scheme="https" secure="true" clientAuth="true"
keystoreFile="${jboss.server.home.dir}/conf/keystore/keystore.jks"
keystorePass="serverpwd" sslProtocol = "TLS" />

Also the file '$EJBCA_HOME/p12/tomcat.jks' must be copied to '$JBOSS_HOME/server/default/conf/keystore/keystore.jks', where 'default' should be replaced with the JBoss configuration you are using.

I get a blank page on the UI after start?

Either you entered a hostname (in httpsserver.hostname in web.properties) that does not resolve to the machine where EJBCA is running during setup, or you changed the port that JBoss listens to. Make sure the hostname resolves to the machine EJBCA is running on.

When running 'ant install' or creating JKS or PKCS12 files you can't use longer password than 7 characters. Anything longer gives an error?

Note, this is only relevant to OracleJDK. OpenJDK does not have this restriction.

If you want to use strong crypto and/or password longer than 7 characters in keystores you must install the 'Unlimited Strength Jurisdiction Policy Files' for JDK. The policy files can be found at the same place as the JDK download. Further information on this can be found in the Sun documentation on the JCE.

How do I manipulate EJBCA-keystores using JAVA's keytool?

EJBCA supports the PKCS12 format for the keystore because it is a standard, and we like standards. Normally keytool (e.g. Java's) can read PKCS12 file but not write, so the BouncyCastle JCE is needed to handle PKCS12 keystores.

keytool -list -alias privateKey -keystore server.p12 -storetype PKCS12 -storepass foo123 -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath $EJBCA_HOME/lib/bcprov-jdk15on-159.jar

It should be possible to import etc as well using keytool.

How do I make a keystore using keytool with a real certificate from EJBCA?

First generate a new keystore and a keypair:

$ keytool -genkey -alias mykey -keystore myks.jks -keyalg RSA -dname c=SE,O=AnaTom,CN=Test -keypass foo123 -storepass foo123

You SUN keystore is now in the file 'myks.jks'. Next generate a certification request (PKCS10):

$ keytool -certreq -alias mykey -sigalg SHA1WithRSA -file myreq.p10 -keypass foo123 -keystore myks.jks -storepass foo123

You now have the certification request in the file 'myreq.p10'. Open up EJBCA request page in your favorite browser, 'http://127.0.0.1:8080/ejbca', and select the link for NOT having a browser' Download the Root CA certificate by clicking on the link. Save the certificate as 'ca.pem'. Enter the username and password of a valid user with status NEW, see question 'Why do I get the exception/error:' above. Copy and paste the contents of the certification request, 'myreq.p10' into the text field. Save the returned certificate as 'cert.pem'.

Next import the Root CA certificate into the keystore 'myks.jks':

$ keytool -import -alias cacert -file ca.pem -keystore myks.jks -storepass foo123

Import the certificate reply into the keystore:

$ keytool -import -alias mykey -file cert.pem -keystore myks.jks -storepass foo123 -keypass foo123

Now you can take a look at your SUN keystore with:

$ keytool -list -keystore myks.jks

In theory, you can use the same method with a BouncyCastle PKCS12 keystore by adding the following arguments to every command above:

-provider org.bouncycastle.jce.provider.BouncyCastleProvider -storetype PKCS12 -providerpath $EJBCA_HOME/lib/bcprov-jdk15on-161.jar

Unfortunately a bug in keytool prevents this from functioning properly at the moment, therefore we recommend using the 'bin/ejbca.sh ca' to create PKCS12 keystores. It can be used to create keystores generally, not just for CAs.