File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes BEA/Weblogic and the fly likes errors while accessing MySQL database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "errors while accessing MySQL database" Watch "errors while accessing MySQL database" New topic

errors while accessing MySQL database

Robinson Francis

Joined: Aug 16, 2010
Posts: 22
Hello and Good day to every one,
I am trying to build a DB based application that will validate login ID of users. This project is part of tutorial that can be found here:

The application will

Ask the user to input his "username" and "password"
Check the existence of this user in the Data Base
If exists, Retrieve his first name and last name from the DB and display them
If not registered, Display "Sorry, you are not registered".

The folder structure of the project can be referred from the Attachement. The Main class that handles connection to the database is the ConnectionManager. java . The code is as below.

The settings for the datasource in my WeblOGic Server is shown in the attached picture.

When I try to run the project and key in the Username and password, I get an error as below.

Your user name is ROBINSON
Your password is FRANCIS
Query: SELECT * FROM users where username='ROBINSON' AND password='FRANCIS'
javax.naming.NameNotFoundException: While trying to look up comp/env/jdbc/important_schema in /app/webapp/LoginExample/4240780.; remaining name 'comp/env/jdbc/important_schema'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(
at weblogic.jndi.internal.ApplicationNamingNode.lookup(
at weblogic.jndi.internal.WLEventContextImpl.lookup(
at weblogic.jndi.internal.WLContextImpl.lookup(
at weblogic.jndi.internal.AbstractURLContext.lookup(
at javax.naming.InitialContext.lookup(
at ExamplePackage.ConnectionManager.getConnection(
at ExamplePackage.UserDAO.login(
at ExamplePackage.LoginServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at weblogic.servlet.internal.StubSecurityHelper$
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(
at weblogic.servlet.internal.ServletStubImpl.execute(
at weblogic.servlet.internal.ServletStubImpl.execute(
at weblogic.servlet.internal.WebAppServletContext$
at Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(
at weblogic.servlet.internal.WebAppServletContext.execute(
Log In failed: An Exception has occurred! java.lang.NullPointerException

Can you please help me on this? I was told that it has got to do with the way the jdbc datasource is named in the Weblogic console but I am not sure. Please help me on this. Thank you all in advance.

[Download MySQL Datasource configuration..bmp] Download

I agree. Here's the link:
subject: errors while accessing MySQL database
It's not a secret anymore!