Question

I'm trying to execute maven install on a pom and the result shown is:

Grave: SEC5054: Certificate has expired

This result appears just after test execution begins. I have been googling over this problem but I've only found solutions that are related to a real glassfish application server. They recommend things like deleting the offending certificates from the folder where they are located and so on (the pages I've seen are mostly like this) or 'unjar' the glassfish-embedded to remove the certification and then jar it again.

Notice that I'm executing a maven install, not an actual deployment on an application server. That's why I cannot take the advice given at many blogs

The pom includes the following dependencies:

 <dependencies>
<dependency>
  <groupId>org.glassfish.main.extras</groupId>
  <artifactId>glassfish-embedded-all</artifactId>
  <version>3.1.2.2</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.10</version>
  <scope>test</scope>
  <optional>true</optional>
</dependency>
<dependency>
  <groupId>org.jboss.arquillian.junit</groupId>
  <artifactId>arquillian-junit-container</artifactId>
  <version>1.0.0.Final</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.jboss.arquillian.container</groupId>
  <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
  <version>1.0.0.CR3</version>
  <scope>test</scope>
</dependency>

Was it helpful?

Solution

This is a known issue at least since Glassfish 3.0.1 and still reported as an Open Issue in Glassfish 3.1.2. Oracle provides some workarounds - that all doesn't apply to your situation. But they also say:

If the instance is not configured this way, ignore the warning. The functionality of the instance is unaffected.

So even if this is a lame answer to a SO question: Don't bother for your test-cases. (Personally I spend far to much time trying to solve the issue.) Either a new version of Glassfish will resolve this issue for us or it will not. Let's stop bothering.

Update:

If you have problems that this triggers a failed build, the following pom works for me without a failed build:

<!--snip-->
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.0.3.Final</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.glassfish.main.extras</groupId>
        <artifactId>glassfish-embedded-all</artifactId>
        <version>3.1.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.arquillian.container</groupId>
        <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
        <version>1.0.0.CR4</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.1.1.Final</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derbyclient</artifactId>
        <version>10.7.1.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

OTHER TIPS

You can try this:

  1. Create a custom domain.xml
  2. Change <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options> to <jvm-options>-Djavax.net.ssl.trustStore=insertpathtocacert/cacerts.jks</jvm-options>
  3. Configure arquillian.xml setting configurationXml to be the path to domain.xml: https://docs.jboss.org/author/display/ARQ/GlassFish+3.1+-+Embedded

or this: Arquillian Embedded Glassfish Certificate Expired

I assume that the test phase starts the embedded glassfish server which is responsible for the error. Install phase is after Test phase. If you want to execute any test cases, you have to unjar and remove the conflicting certificates (in .m2 folder). Else you can bypass the test phase by using a flag -DskipTests=true.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top