【发布时间】:2017-08-18 14:55:21
【问题描述】:
首先,我阅读了有关该问题的所有帖子,但我无法解决我的问题。我有一个带有 maven 的 Web 应用程序,我正在使用 glassfish 和 MySQL。当我想从数据库接收信息时,我遇到了这个错误。我会告诉你错误:
这是我的.jsp 页面,我试图从数据库中获取信息:
<%@page import="tr.kasim.cc.app.Application"%>
<%@page import="tr.kasim.cc.model.SignUp"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/index.css"></link>
<title>User Listesi</title>
</head>
<body><center>
<p class="title">User Listesi</p>
<table style="border: black 1px solid">
<tr>
<td>loginName</td>
<td>password</td>
<td>eMail</td>
<td>userName</td>
<td>userDate</td>
<td>userJob</td>
<td>userTelephone</td>
<td>userCity</td>
<td>userGenderId</td>
</tr>
<%
List<SignUp> users = Application.getApp().getMainService().getUsers();
for (SignUp user : users) {
%>
<tr>
<td><%=(user.getUserLoginName())%></td>
<td><%=(user.getUserPassword())%></td>
<td><%=(user.getUserEMail())%></td>
<td><%=(user.getUserName())%></td>
<td><%=(user.getUserDate())%></td>
<td><%=(user.getUserJob())%></td>
<td><%=(user.getUserTelephone())%></td>
<td><%=(user.getUserCity())%></td>
<td><%=(user.getUserGenderId())%></td>
</tr>
<%}
%>
</table>
<br/><br><br>
<a href="index.jsp">Return HomePage</a><br>
</center></body>
</html>
这里是我的 pom.xml 依赖项(我添加了 mysql 连接的依赖项):
<groupId>tr.kasim</groupId>
<artifactId>CourseCenter</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>CourseCenter</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
我还将 mysql 人工制品为依赖项: mysql artifacted。 我不知道我该怎么办。 请帮帮我,谢谢..
【问题讨论】:
-
我解释说我添加了mysql连接。但是它说找不到mysql驱动程序。这与我的问题不同,因为“我添加了”。
-
您为什么使用版本 Connector/J 5.1.6(2008 年发布)?最新版本为 5.1.41(2017 年 2 月发布)。
标签: java mysql maven jdbc netbeans