“Certificate has expired” in log by starting Glassfish 3.1.2

自作多情 提交于 2019-11-29 21:30:34
Matthias B

The certificate of GTE Cybertrust Solutions inc has expired this night.

As stated here: https://forums.oracle.com/thread/2563077 the alias of this certificate is: gtecybertrust5ca

As long as it is a standalone Glassfish you can follow this guide: https://blogs.oracle.com/ramkri/entry/sec5054_certificate_has_expired_error

I have the same problem, but with the embedded Glassfish 3.1.2.2 used by Arquillian. I don't know where the certificates are stored in this embedded setup. Any hints are appreciated.

UPDATE for an embedded setup: To fix the certificate while using an embedded glassfish, just copy a fixed version of the cacerts.jks from the standalone glassfish installation <glassfish_home>/glassfish/domains/<your_domain>/config/cacerts.jks to your resource directory. E.g. when using maven and arquillian, just copy the file to <projectRoot>/src/test/resources/config/cacerts.jks. The embedded glassfish will pick up this configuration!

This is the solution from this post: Arquillian Embedded Glassfish Certificate Expired

BoneGoat

We are also using embedded Glassfish and Arquillian for our integration tests and unfortunately we cannot run any tests before a new release of the embedded Glassfish is released. In the meantime, this is what I did:

  1. Find the embedded Glassfish jar in your local Maven cache. Mine was in \path\to\local\maven\repo\org\glassfish\main\extras\glassfish-embedded-all\3.1.2\glassfish-embedded-all-3.1.2.jar
  2. Open the JAR with some archiving software. I used 7-zip.
  3. Extract config\cacerts.jks to some folder.
  4. Execute \path\to\jdk\bin\keytool -delete -v -alias gtecybertrust5ca -keystore cacerts.jks. When asked for password enter: changeit
  5. Copy cacerts.jks back to the glassfish embedded jar overwriting the old keystore.
  6. Run your tests again.

Just found a similar solution by heather92115 in a linked post (https://stackoverflow.com/a/18343639/1540666) which my be a bit better. Just remember to delete the modified keystore from your project when an updated embedded Glassfish is released.

My OS is windows 2003 system and I solved the problem as follows

  1. i opened the cmd console of windows system in C:\glassfish3\jdk 7\bin, in that folder was the keytool

  2. Find all cacerts.jks in the glassfish directory, in my case i find them all in C:\glassfish3\glassfish\domains\domain1\config and C:\glassfish3\glassfish\lib\templates

  3. list all certificates from cacerts.jks, the keytool from java can do that. I copied the cacerts.jks file in the keytool folder but is optional if keytool is working well : C:\glassfish3\jdk7\bin>keytool -list -v -keystore cacerts.jks -storepass changeit > listaCertificados.txt

  4. in the listaCertificados.txt file created in the previous step, I checked all expired certificates

  5. i deleted the gtecybertrust5ca certified that expired in august 2013. The command is: keytool -delete -alias gtecybertrust5ca -keystore cacerts.jks -storepass changeit

  6. i changed the cacerts.jks's name file that was it in C:\glassfish3\glassfish\domains\domain1\config, then i copied the cacerts.jks file from C:\glassfish3\jdk7\bin to C:\glassfish3\glassfish\domains\domain1\config

  7. i applied the same procedure to C:\glassfish3\glassfish\lib\templates\cacerts.jks

  8. finally i reloaded the glassfish server

Sorry for my english, i don´t speak that language but i want to help

just do

domain=domain1
asadmin stop-domain $domain
cd $(dirname `which asadmin`)/../glassfish/domains/config
cp cacerts.jks{,.bak}
keytool -delete -alias gtecybertrust5ca -keystore cacerts.jks -storepass changeit
cd -
asadmin start-domain $domain
peater

The solution BoneGoat supplied also worked for the glassfish-embedded-web-3.1.2.2.jar. Since I am using Maven, I followed the BoneGoat's steps for the jar and then uploaded to our local Nexus repository with a an updated version name. I then updated my dependencies:

                <groupId>org.glassfish.main.extras</groupId>
                <artifactId>glassfish-embedded-web</artifactId>
                <version>3.1.2.2-fixed-cert</version>
                <scope>test</scope>

Note: I did not have luck using the 4.0 version of the jar. (There may be some incompatibilities with arquillian and the new version.)

You may also find useful information in this question Arquillian Embedded Glassfish Certificate Expired

Solutions in other answers may work....

However, I recommend to not to waste your time messing with certificates, just re-install Glassfish and it would be fixed.

You can now get the certs as part of the OpenJDK package - see https://dzone.com/articles/openjdk-10-now-includes-root-ca-certificates

For a Docker install you can do something like this:

# Set glassfish env
ENV GLASSFISH_HOME /opt/glassfish5/glassfish

# Get latest cacerts from OpenJDK project
RUN wget https://hg.openjdk.java.net/jdk/jdk/raw-file/tip/src/java.base/share/lib/security/cacerts && \
    mv cacerts $GLASSFISH_HOME/domains/domain1/config/cacerts.jks

A manual install would be similar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!