在 WebLogic 14c (14.1.1.0.0)控制台配置MySQL数据源,如果选择的数据库驱动为:
com.mysql.jdbc.Driver
在数据源的 Target 服务运行时,会在服务日志里面打印如下的提示信息:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
<2023-5-29 上午11时56分00,205秒 CST> <Notice> <Security> <BEA-090947> <Security post-initializing using security realm: myrealm>
<2023-5-29 上午11时56分02,358秒 CST> <Notice> <Security> <BEA-090082> <Security initialized using administrative security realm: myrealm>
<2023-5-29 上午11时56分02,835秒 CST> <Notice> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://192.168.223.199:17010/jndi/weblogic.management.mbeanservers.runtime.>
<2023-5-29 上午11时56分04,214秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.>
<2023-5-29 上午11时56分04,215秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
<2023-5-29 上午11时56分04,260秒 CST> <Notice> <Log Management> <BEA-170036> <The Logging monitoring service timer has started to check for logged message counts every 30 seconds.>
<2023-5-29 上午11时56分04,339秒 CST> <Notice> <Security> <BEA-090171> <Loading the identity certificate and private key stored under the alias DemoIdentity from the jks keystore file /app/domains/wls14cdomain/security/DemoIdentity.jks.>
<2023-5-29 上午11时56分04,343秒 CST> <Notice> <Security> <BEA-090169> <Loading trusted certificates from the jks keystore file /weblogic/Oracle/Middleware/Oracle_Home/wlserver/server/lib/DemoTrust.jks.>
<2023-5-29 上午11时56分04,373秒 CST> <Notice> <Security> <BEA-090169> <Loading trusted certificates from the jks keystore file /usr/jdk1.8.0_371/jre/lib/security/cacerts.>
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
<2023-5-29 上午11时56分07,182秒 CST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.>
<2023-5-29 上午11时56分07,478秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.>
<2023-5-29 上午11时56分07,547秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.>
<2023-5-29 上午11时56分07,647秒 CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 192.168.223.199:17010 for protocols iiop, t3, ldap, snmp, http.>
<2023-5-29 上午11时56分07,649秒 CST> <Notice> <WebLogicServer> <BEA-000332> <Started the WebLogic Server Managed Server "appServer1" for domain "wls14cdomain" running in development mode.>
<2023-5-29 上午11时56分07,650秒 CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 192.168.223.199:17010 for protocols iiop, t3, ldap, snmp, http.>
<2023-5-29 上午11时56分07,656秒 CST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>
<2023-5-29 上午11时56分07,678秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
在控制台修改驱动程序类的名称为:com.mysql.cj.jdbc.Driver,保存即可。
在WebLogic安装目录下搜索,可以发现下面的驱动jar包
./Oracle/Middleware/Oracle_Home/oracle_common/modules/mysql-connector-java-commercial-8.0.14/mysql-connector-java-commercial-8.0.14.jar
下载到本地,使用压缩软件打开jar包,可以在com.mysql.cj.jdbc的包路径下,找到Driver.class类文件。
如果本地应用程序项目使用JDK1.8或者JDK11开发,且需要部署在WebLogic 14c服务器上,建议开发人员在本地项目中也采用上面的驱动Jar包和数据库驱动。