最近将一个集成了cas sso的web应用部署到weblogic 12c 12.2.1.2.0的时候报如下错误:
Caused By: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
cas启用了https,此错误是由于weblogic没有导入cas服务器的证书导致的。
像往常一样,使用如下命令导入证书到jre默认keystore:
keytool -import -alias cas -keystore /home/biee02/java/jre/lib/security/cacerts -file /home/biee02/java/jre/bin/itebetacom.cer
重启服务,错误依旧。明明已经导入了呀,为撒还是找不到证书呢?
怀疑weblogic使用了不同keystore,查看日志,发现如下:
果然,可以看到此处weblogic使用了KSS keystore,其是OPSS中的一个组件。
注:也可以在console中进行查看
既然如此,那就把证书导入到kss://system/trust中吧。
方法请参见 Importing a Certificate or Trusted Certificate with Fusion Middleware Control
重启之后,错误依旧。仔细查看文档,原来导入之后还需要执行同步操作,才能生效。
如下:
登录weblogic服务器,执行如下命令:
$/home/biee02/oracle/Middleware/Oracle_Home/oracle_common/common/bin/wlst.sh
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline> connect()
Please enter your username :weblogic
weblogic
Please enter your password :
Please enter your server URL [t3://localhost:7001] :t3://localhost:8301
t3://localhost:8301
Connecting to t3://localhost:8301 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "bi".
Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.
wls:/bi/serverConfig/>
wls:/bi/serverConfig/> syncKeyStores(appStripe='system', keystoreFormat='KSS')
Keystore sync successful.
重启服务,ok
注:weblogic 11g仍然是使用的java keystore而非KSS