使用GlassFish 4.0并获取找不到适用于jdbc:mysql错误的驱动程序 [英] using GlassFish 4.0 and getting No suitable driver found for jdbc:mysql error

查看:91
本文介绍了使用GlassFish 4.0并获取找不到适用于jdbc:mysql错误的驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误;

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

以下是我的项目结构:

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

is this the correct path to put the external jars??

推荐答案

这要视情况而定.谁在实际创建连接?如果您的应用程序代码是直接的,则JAR属于WEB-INF/lib.如果您的容器通过JNDI资源管理连接,则JAR必须位于 Glassfish 类路径中,而不是WEB-INF/lib中.

It depends. Who is actually creating the connection? If your application code is directly, then the JAR belongs in WEB-INF/lib. If your container is managing the connections through a JNDI resource, then the JAR needs to be in the Glassfish classpath, not WEB-INF/lib.

在Glassfish 3.x中,我将JAR放在domain/lib/ext或类似的东西中.

In Glassfish 3.x I put the JARs in domain/lib/ext or something like that.

这篇关于使用GlassFish 4.0并获取找不到适用于jdbc:mysql错误的驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆