我使用带有 Glassfish Elastic Beanstalk 的预配置 AWS Linux AMI 来部署我的 Java Web 服务。我已经设法设置了我的 RDS,并且在本地运行连接到 AWS RDS 的 glassfish 时它工作正常。仅当我在 AWS EBS 上运行 Web 服务时才会出现此问题。从我所见,似乎 mysql 连接器在那里,但由于某些原因,应用程序没有检测到。不幸的是,Glassfish 文件夹隐藏在 linux EC2 中。谁能告诉我应该采取什么步骤来解决这个异常?
remote failure: Error occurred during deployment: Exception while deploying the app [current-app] : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Error Code: 0. Please see server.log for more details.
Command deploy failed.
我有 SSH 并运行这个 yum 但它没有解决问题。
sudo yum install mysql-connector-java
谢谢
adding: WEB-INF/lib/aopalliance-repackaged-2.5.0-b32.jar (deflated 34%)
adding: WEB-INF/lib/javassist-3.20.0-GA.jar (deflated 7%)
adding: WEB-INF/lib/javax.ws.rs-api-2.0.1.jar (deflated 14%)
adding: WEB-INF/lib/jersey-container-servlet-2.25.1.jar (deflated 21%)
adding: WEB-INF/lib/validation-api-1.1.0.Final.jar (deflated 25%)
adding: WEB-INF/lib/mysql-connector-java-6.0.6.jar (deflated 6%)
adding: WEB-INF/lib/jersey-common-2.25.1.jar (deflated 12%)
adding: WEB-INF/lib/hk2-utils-2.5.0-b32.jar (deflated 12%)
adding: WEB-INF/lib/javax.inject-2.5.0-b32.jar (deflated 24%)
adding: WEB-INF/lib/osgi-resource-locator-1.0.1.jar (deflated 15%)
adding: WEB-INF/lib/jersey-server-2.25.1.jar (deflated 14%)
adding: WEB-INF/lib/jersey-guava-2.25.1.jar (deflated 15%)
adding: WEB-INF/lib/hk2-api-2.5.0-b32.jar (deflated 13%)
adding: WEB-INF/lib/hk2-locator-2.5.0-b32.jar (deflated 7%)
adding: WEB-INF/lib/jersey-client-2.25.1.jar (deflated 12%)
adding: WEB-INF/lib/jersey-media-jaxb-2.25.1.jar (deflated 14%)
adding: WEB-INF/lib/jersey-container-servlet-core-2.25.1.jar (deflated 16%)