0

我收到以下错误;

type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/chh-cw
root cause

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/chh-cw

以下是我的项目结构:

在此处输入图像描述

这是放置外部罐子的正确路径吗?

4

2 回答 2

1

这取决于。谁实际上在创建连接?如果您的应用程序代码是直接的,那么 JAR 属于 WEB-INF/lib。如果您的容器通过 JNDI 资源管理连接,则 JAR 需要位于Glassfish类路径中,而不是 WEB-INF/lib。

在 Glassfish 3.x 中,我将 JARdomain/lib/ext或类似的东西放入其中。

于 2013-10-20T19:53:34.233 回答
0

yes - if you do your Connection in an may LoginServerlet... with Code like this:

this.conn = DriverManager.getConnection(getConnString());

you only have to copy the mysql..connector.jar to the WEB-Inf/lib Folder or your Domain.

于 2017-07-24T22:23:46.647 回答