Hello,

First of all, I am kind of new with this Wicket, actually, I am using
it for only a couple of days.
Secondly, I don't even know if I post this in the right place, so I
appologize if I had made such a mistake.

Now, the problem that made write this post:

I am working on a small JAVA + MySQL project, and by chance, when
browsing through Apache Software, I have discovered Wicket. I kind of
got the feeling with it thanks to the tutorials, but now I try to
integrate something related to MySQL in it:

I have a class Catalog, :

public class Catalog
{
        private ArrayList<Product> products;
        
        public Catalog()
        {
                this.products = new ArrayList<Product>();
                this.populateCatalog();
        }
        private void populateCatalog()
        {
            Connection connection = null;
                Statement statement = null;
                ResultSet result_set = null;
                
                String url = "jdbc:mysql://localhost:3306/proiect";
                String user = "root";
                String password = "";
                
            try
            {
                Class.forName("com.mysql.jdbc.Driver");
                
                connection      = (Connection) DriverManager.getConnection(url,
user, password);
                statement       = (Statement)
connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
                result_set      = statement.executeQuery("SELECT * from produse
ORDER BY id_produs");

                while(result_set.next())
                {                               
                        this.products.add(new Product(
result_set.getInt("id_produs"),  result_set.getString("nume_poza") ));
                }
        
                releaseResources(connection, statement, result_set);
            }
            catch (SQLException exception)
            {
                System.out.println("Eroare =>"+exception.getLocalizedMessage());
            }
                catch (ClassNotFoundException exception)
                {
                        exception.printStackTrace();
                }
        }
        
        private static void releaseResources(Connection connection, Statement
statement, ResultSet result_set) throws SQLException
        {
                result_set.close();
                statement.close();
                connection.close();
                
        }
}

When I "run" the site, i get an error at line
"Class.forName("com.mysql.jdbc.Driver");" from the file up above. I
don;t know how to copy-paste the output on the Tomcat Servlet Engine
(oh, yes, I am running it on Tomcat), it is embedded into a JAVA
window... Anywya, the next line in the stack trace, besides
ClassNotFoundException: com.mysql.jdbc.Driver
is "at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java);

Any help it is highly apreciated, and thanks for your understanding.

-- 
Mihai Bogdan Eugen

Reply via email to