私の問題は、ローカルマシンではなく、Jelasticクラウドサーバーノードでのみ発生します。
私はこれらを行いました:
- mysqljarドライバーを
lib
glassfishのフォルダーにアップロードしました - 接続プールを作成しましたが、pingは成功しました
- データソースを作成しました
しかし、次のJSPを実行すると:
<%@page import="java.io.Writer"%>
<%@page import="javax.sql.DataSource"%>
<%@page import="java.sql.Connection"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.naming.Context"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<%
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/rook-server");
Connection conn = ds.getConnection();
%>
</body>
</html>
次のエラーが発生します。
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: 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
root cause
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
root cause
javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
root cause
com.sun.appserv.connectors.internal.api.PoolingException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
root cause
com.sun.appserv.connectors.internal.api.PoolingException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
root cause
com.sun.appserv.connectors.internal.api.PoolingException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
root cause
javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.
GlassFish Server Open Source Edition 3.1.1