Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not able to connect a web application to database server located on same system.

 
dhaval dethe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a sample web application using servlet and jsp (mvc) in Eclipse Helios.
I created dynamic web app project.
Application server is Apache Tomcat.

I want to connect to database server locating on same system.
I am using mysql 6.0.
I added mysql jdbc connector jar in my project but still I am getting

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Log In failed: An Exception has occurred! java.lang.NullPointerException

can any one please explain?
Where do I placed connector jar?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Application server is Apache Tomcat.

Tomcat is not an Application Server.


java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

how you are adding jar file in eclipse..?
put your mysql jar file in tomcat->lib folder as well, i solved same problem by putting jar file into lib.
Assuming you are adding jar file like this:
Project->Build Path->Add External jars.

hope it helps..
 
Tim Moores
Bartender
Posts: 2803
41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Punit Jain wrote:Tomcat is not an Application Server.

There is no generally agreed-upon definition of the term "application server", and Tomcat can easily serve as one. What Tomcat is not is a "JEE server", which is something that actually does have a fixed definition.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There is no generally agreed-upon definition of the term "application server"

i agree.

and Tomcat can easily serve as one.

how although tomcat not supports ejb's.

here
here

although there is no specific definition so we can decide for our self, i think
 
Tim Moores
Bartender
Posts: 2803
41
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Punit Jain wrote:how although tomcat not supports ejb's.

Because an application does not require the use of EJBs. A JEE server would require all JEE APIs to be implemented, including EJB.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18168
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ha! I can out-p├Ždant anyone here!

Tomcat is, according to generally-accepted usage, a Web Application Server.

Tomcat is - in a limited scope - a J2EE web application server. It is not, however, a full-stack web application server because it lacks several of the heavyweight capabilities (such as EJB container) that are required to be provided in order to be certifiable. Tomcat only provides the servlet/JSP support, a JNDI server, Database connection pools, security Realms, and a few odds and ends.

Despite Tomcat's limited capabilities, it has served as a prototyping platform for next-generation servlet/JSP designs. It also has been employed as the servlet/JSP subsystem services provider running embedded in full-stack J2EE/JEE web application servers such as JOnAS and JBoss,

----

So much for nit-picking. In Tomcat versions 6 and greater, the database driver JAR must be copied into the TOMCAT_HOME/lib directory. It must NOT be included as part of any application (WAR) because it's used at the container level by the connection pooler(s) and individual application classpaths are not shared as part of the server classpath. The server's classpath is part of the individual webapp classpaths, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic