• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

errors while accessing MySQL database

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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: http://met.guc.edu.eg/OnlineTutorials/JSP%20-%20Servlets/Full%20Login%20Example.aspx

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(BasicNamingNode.java:1139)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:144)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at ExamplePackage.ConnectionManager.getConnection(ConnectionManager.java:25)
at ExamplePackage.UserDAO.login(UserDAO.java:30)
at ExamplePackage.LoginServlet.doGet(LoginServlet.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
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.
Filename: MySQL-Datasource-configuration..bmp
Description: DataSource Configuration in Weblogic Console.
File size: 930 Kbytes
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic