0

Firstly I read all post about that issue but I could not solve my problem. I have a web application with maven and I'm using glassfish & MySQL. When I want to receive info from database, I took this error. I will show you error:

enter image description here

That's my .jsp page I tried to take info from database:

<%@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>

And here my pom.xml dependency (I added dependency for mysql connection):

<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>

Also I artifacted mysql to dependencies: mysql artifacted. I don't know what should I do. Please help me, thanks..

N00b Pr0grammer
  • 4,503
  • 5
  • 32
  • 46
superior
  • 21
  • 1
  • 9
  • possibly a duplicate of http://stackoverflow.com/questions/6819317/adding-dependencies-in-maven-netbeans – Japu_D_Cret Mar 25 '17 at 18:38
  • I explained that I added mysql connection . But it say mysql driver could not found. This is not same thing with my problem because "I added". – superior Mar 25 '17 at 18:42
  • 1
    Why are you using version Connector/J 5.1.6 (released in 2008)? The latest version is 5.1.41 (released in February 2017). – Mark Rotteveel Mar 26 '17 at 13:01

1 Answers1

0

When you are dealing with Web Applications, you will need to remember one more point that the dependent libraries and jars should be available under WEB-INF/lib folder in order to let your Web/Application Server (Eg: GlassFish in your case, here) recognize them during runtime.

Copy the necessary dependent jars into the folder mentioned and redeploy to sort out your issues.

(OR)

You could do the below as well: Just copy your mysql-connector-java-5.1.x.jar inside JAVA_HOME\jre\lib\ext, even this will ensure that your problem is solved.

N00b Pr0grammer
  • 4,503
  • 5
  • 32
  • 46