1. Error environment description:
Web project upgradehttps
, after configuring the certificate, start the error.
2. Error detection
Cause of the error: The SSL certificate (keystore) is not configured correctly. Modify the path to -store=classpath:keystore.p12, which is normally available.
2.1 Check whether the SSL certificate is correct
keystore.p12
The file detection command is:
keytool -list -v -keystore path/to/keystore.p12 -storetype PKCS12 -storepass 123456
-
-list
: List entries in the keystore. -
-v
: Show details. -
-storetype
: Specify the type of the keystore, that is, the encryption algorithm type. -
-storepass
: Specify the password for the keystore.
2.2 Check whether the SSL certificate is processed and the file content error is caused
For example:
maven configures resource file placeholder replacement, which leads to problems with the binary file (.p12):
<build> <resources> <resource> <directory>src/main/resources</directory> <!-- Placeholder replacement for resource files --> <filtering>true</filtering> </resource> </resources> </build>
Solution:
<resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <excludes> <exclude>**/*.p12</exclude> </excludes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes> <include>**/*.p12</include> </includes> </resource> </resources>
2.3 Check whether the project has a cache and can rebuild the project.
2.4 Check whether the file path is correct
You can first configure an absolute path to detect whether the correct file is found and load it.
For example, my certificate file is/resources-env/dev
Down,
└── resources ├── ├── resources-env │ ├── dev │ │ ├── │ │ └── keystore.p12 │ └── prod └── static └──
The maven configuration is as follows:
<resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <excludes> <exclude>**/*.p12</exclude> </excludes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes> <include>**/*.p12</include> </includes> </resource> <resource> <directory>src/main/resources-env/${env}</directory> <filtering>false</filtering> </resource> </resources>
The configured address is:-store=classpath:/resources-env/dev/keystore.p12
, another exception will be thrown:
Caused by: : class path resource [/resources-env/dev/keystore.p12] cannot be resolved to URL because it does not exist
The correct configuration should be:-store=classpath:keystore.p12
。
Notice: classpath
: means fromsrc/main/resources
Start the search, so you need to specify the full path.
The correct configuration should be:-store=classpath:keystore.p12
。
Notice: classpath
: means fromsrc/main/resources
Start the search, so you need to specify the full path.
This is the article about Caused by: : (): lengthTag=111, too big.. This is all about this article. For more related Caused by: For content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!