In the sprint boot upgrade I had a problem when running the application, because the SSL certificate was not found (It shows me to make sure that the certificate exists but it is created) and tomcat server could not be started. I already tried adding the location to the tag but it does not work, example: <keyStore id="defaultKeyStore" location="/certs/KeyStore.p12" password="${KEY_STORE_PWD}" type="PKCS12"/>

Would I have to add a new ssl library for this new version?, or the name of the certificate change?

I appreciate any comments, Here I put the information that I am using:

Java 17 'org.springframework.boot' version '3.0.1' Gradle 8.1.1

Issue

Jul 18 12:40:33 us-south1-dev wwcet-calculcation-dev ERROR stderr F [ERROR   ] CWWKS9582E: The [defaultSSLConfig] sslRef attributes required by the orb element with the defaultOrb id have not been resolved within 10 seconds. As a result, the applications will not start. **Ensure that you have included a keyStore element and that Secure Sockets Layer (SSL) is configured correctly. If the sslRef is defaultSSLConfig, then add a keyStore element with the id defaultKeyStore and a password.**
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F 2023-07-18T18:40:35.585Z  INFO 1 --- [ecutor-thread-2] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev ERROR stderr F [ERROR   ] A child container failed during start
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stderr F org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@bad31840]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev ERROR stderr F [ERROR   ] A child container failed during start
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stderr F org.apache.catalina.LifecycleException: A child container failed during start
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F 2023-07-18T18:40:35.725Z  WARN 1 --- [ecutor-thread-2] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F 2023-07-18T18:40:35.764Z  INFO 1 --- [ecutor-thread-2] .s.b.a.l.ConditionEvaluationReportLogger : 
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F 
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev Error stdout F Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F 2023-07-18T18:40:35.855Z ERROR 1 --- [ecutor-thread-2] o.s.boot.SpringApplication               : Application run failed
-------
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@bad31840]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:923) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   ... 38 common frames omitted
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@bad31840]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4829) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4962) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout P   at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) ~[tomcat-embed
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F -core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   ... 38 common frames omitted
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F Caused by: java.lang.Error: factory already defined
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1228) ~[na:na]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:130) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:53) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:77) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:726) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:713) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[tomcat-embed-core-10.1.4.jar:10.1.4]
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev stdout F   ... 48 common frames omitted
Jul 18 12:40:35 us-south1-dev wwcet-calculcation-dev ERROR stderr F [ERROR   ] CWWKZ0002E: An exception occurred while starting the application CostCalculationService-0.0.1. The exception message was: org.springframework.context.ApplicationContextException: Unable to start web server
Jul 18 12:40:36 us-south1-dev wwcet-calculcation-dev stdout F [AUDIT   ] CWWKF1037I: The server added the [jdbc-4.1, jsf-2.2, localConnector-1.0, servlet-3.1, springBoot-2.0] features to the existing feature set.
Jul 18 12:40:36 us-south1-dev wwcet-calculcation-dev stdout F [AUDIT   ] CWWKF0012I: The server installed the following features: [appSecurity-2.0, distributedMap-1.0, ejb-3.2, ejbHome-3.2, ejbLite-3.2, ejbPersistentTimer-3.2, ejbRemote-3.2, el-3.0, j2eeManagement-1.1, jca-1.7, jdbc-4.1, jndi-1.0, jsf-2.2, jsp-2.3, localConnector-1.0, mdb-3.2, servlet-3.1, springBoot-2.0, ssl-1.0].
Jul 18 12:40:36 us-south1-dev wwcet-calculcation-dev stdout F [AUDIT   ] CWWKF0013I: The server removed the following features: [appClientSupport-1.0, appSecurity-3.0, batch-1.0, beanValidation-2.0, cdi-2.0, concurrent-1.0, jacc-1.5, jaspic-1.1, javaMail-1.6, javaee-8.0, jaxb-2.2, jaxrs-2.1, jaxrsClient-2.1, jaxws-2.2, jcaInboundSecurity-1.0, jdbc-4.2, jms-2.0, jpa-2.2, jpaContainer-2.2, jsf-2.3, jsonb-1.0, jsonp-1.1, managedBeans-1.0, servlet-4.0, wasJmsClient-2.0, wasJmsSecurity-1.0, wasJmsServer-1.0, webProfile-8.0, websocket-1.1].
Jul 18 12:40:36 us-south1-dev wwcet-calculcation-dev stdout F [AUDIT   ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 21.670 seconds.
Jul 18 12:40:36 us-south1-dev wwcet-calculcation-dev stdout F [AUDIT   ] CWPKI0803A: SSL certificate created in 14.539 seconds. SSL key file: /opt/ol/wlp/output/defaultServer/resources/security/key.p12
Jul 18 12:40:37 us-south1-dev wwcet-calculcation-dev stdout F [AUDIT   ] CWWKI0001I: The CORBA name 

Server.xml

<server description="new server">
    <featureManager>
      <feature>localConnector-1.0</feature>
      <feature>springBoot-2.0</feature>
      <!--<feature>springBoot-3.0</feature>-->
      <feature>servlet-3.1</feature>
      <!-- <feature>jndi-1.0</feature> -->
      <feature>j2eeManagement-1.1</feature>
      <feature>jsf-2.2</feature>
      <feature>ejb-3.2</feature>
      <feature>appSecurity-2.0</feature>
      <feature>jdbc-4.1</feature>
    </featureManager>

    <springBootApplication location="project-0.0.1.jar"/>
    <httpEndpoint host="*" httpPort="8080" httpsPort="9440" id="defaultHttpEndpoint"/>
    <classloading useJarUrls="true"></classloading>
    <applicationManager autoExpand="false" />
    <variable name="dolphin.development_mode" value="false" />

    <basicRegistry id="basic" realm="BasicRealm">
        <!-- <user name="yourUserName" password="" />  -->
        <user password="${KEY_STORE_PWD}" name="admin"></user>
    </basicRegistry>

     <library id="DB2">
        <fileset dir="/liberty/usr/servers/defaultServer/resources/driver_db" caseSensitive="true" includes="db2.jar, db.jar"></fileset>
    </library>

    <keyStore id="defaultKeystore" password="${KEY_STORE_PWD}"></keyStore>

    <dataSource id="database" jndiName="jdbc" type="DataSource" >
        <jdbcDriver id="DB2JCC4Driver" libraryRef="DB2JCC4"></jdbcDriver>
        <connectionManager maxPoolSize="${DB_CONNECTION_POOL_SIZE}" minPoolSize="2" connectionTimeout="${DB_CONNECTION_TIMEOUT}" maxIdleTime="${DBCONNECTION_MAX_IDLE_TIME}"/>
        <properties.db2.jcc databaseName="${NAMEDB}" serverName="${HOSTDB}" portNumber="${PORTDB}" user="${USERDB}" password="${PWD_DB}" sslConnection="true" sslTrustStoreLocation="/liberty/usr/servers/defaultServer/resources/security/${CERTIFICATE_DB_NAME}" sslTrustStorePassword="${SSL_TRUSTSTORE_PASS}"></properties.db2.jcc>
    </dataSource>

</server>

build.gradle

plugins {
    id 'org.springframework.boot' version '3.0.1'
    id 'io.spring.dependency-management' version '1.1.0'
    id 'java'
    id "jacoco"
    id "org.sonarqube" version "3.4.0.2513"
}

jacoco {
    toolVersion = "0.8.7"
}

group = 'com.tools.project'
version = '0.0.1'
sourceCompatibility = '17'

repositories {
    mavenCentral()
    flatDir {
       dirs 'libs'
   }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    implementation name: 'commons-jexl-1.1'
    implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
    implementation group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
    implementation group: 'javax.mail', name: 'mail', version: '1.4'
    implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.1'
    implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1'
    implementation group: 'org.freemarker', name: 'freemarker', version: '2.3.20'
    runtimeOnly 'com.db2:jcc'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

jacocoTestReport {
    reports {
        xml.required = true
    }
}

apply plugin: 'checkstyle'
checkstyle {
    toolVersion '7.8.1'
    configFile file("config/checkstyle/checkstyle.xml")
}
checkstyleMain {
    source ='src/main/java'
}
checkstyleTest {
    source ='src/test/java'
}

Comment From: wilkinsona

I don't think the failure is related to SSL.

Caused by: java.lang.Error: factory already defined
    at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1228) ~[na:na]
    at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:130) ~[tomcat-embed-core-10.1.4.jar:10.1.4]

This indicates that something has already registered a URL stream handler factory which prevents Tomcat from doing so. Unfortunately, it's impossible for us to tell what that is with the information that you've provided. I would recommend running your application with a debugger attached and a breakpoint on java.net.URL.setURLStreamHandlerFactory. That should allow you to identify the other component that's registering a factory.

If this does not help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.