目前我正在关注 此链接
解决
Caused by: javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.cj.jdbc.MysqlDataSource
因此,我将 mysql-connector-java-5.1.46.jar 添加到我的 glassfish 安装中,如下面的屏幕截图所示:
重新启动 Glassfish 后,我的 .war 仍然没有部署并显示相同的错误消息(下面的堆栈跟踪)
Caused by: javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.cj.jdbc.MysqlDataSource
at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:278)
at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:117)
at com.sun.gjc.spi.ManagedConnectionFactoryImpl.getDataSource(ManagedConnectionFactoryImpl.java:1383)
at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163)
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102)
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
有谁知道如何解决这个问题?谢谢你。
我通过将此依赖项添加到我的 pom.xml 来解决它
而不是将 mysql-connector-java-8.0.14.jar 放入 /payara5/glassfish/domains/domain1/lib。