| Author |
unable to connect project to database
|
Nikunj Aggarwal
Greenhorn
Joined: Dec 24, 2010
Posts: 2
|
|
hi,
I am new to j2ee and i am doing netbeans E-commerce tutorial . But when i reach to "Connecting the Application to the Database" topic,i unable to connect project to database. I done all the things right but still when i am running "testDataSource.jsp" page it showing error in the browser.
exception
javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/affablebean"
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/affablebean"
This exception is coming. I read troubleshoot also but still no help. I want to know to add "reference resource " because in the tutorial is done differently and i am using netbeans 6.9.1
Please help me, in order to solve this problem.
|
 |
Cesar Loachamin
Ranch Hand
Joined: Dec 25, 2010
Posts: 90
|
|
Hi Nikunj.
It looks like your application server can't find the JDBC driver for you DataSource, you must read the documentation of your application server to determine the location of the libs, for example for oracle DataBase you need the ojdbc.jar that contains the necessary class to connect to oracle, and with glassfish you must put the ojdbc.jar in glassfish/domains/domain1/lib/ext so you application server can find the correct driver for you DataSource.
Or try to put your jdbc driver jar, on the lib folder of your web application, example WEB-INF/lib/ojdbc.jar
Regards
Cesar
|
When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
|
 |
Maurice Rogers
Greenhorn
Joined: Jan 24, 2011
Posts: 2
|
|
Did you ever manage to find a solution to this problem?
I'm going through the tutorial right now and I'm experiencing the same issue.
|
 |
Leandro Coutinho
Ranch Hand
Joined: Mar 04, 2009
Posts: 415
|
|
Same error following the example. I think the problem is that Glassfish is not deploying the driver.
It doesn't appear Deploying driver in my console. I put the jar file in the same location. I also in the project's lib folder. Restarted the server but it didn't work.
Please. Someone help us.
My output:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
Copying 1 file to /home/leandro/NetBeansProjects/AffableBean/build/web/WEB-INF/lib
library-inclusion-in-manifest:
compile:
compile-jsps:
Created dir: /home/leandro/NetBeansProjects/AffableBean/build/generated/src
Created dir: /home/leandro/NetBeansProjects/AffableBean/build/generated/classes
Compiling 1 source file to /home/leandro/NetBeansProjects/AffableBean/build/generated/classes
Starting GlassFish Server 3.x
GlassFish Server 3.x is running.
Incrementally deploying AffableBean
Completed incremental distribution of AffableBean
Incrementally redeploying AffableBean
Initializing...
run-deploy:
Browsing: http://localhost:8080/AffableBean/faces/test/testDataSource.jsp
run-display-browser:
run:
BUILD SUCCESSFUL (total time: 40 seconds)
|
 |
Maurice Rogers
Greenhorn
Joined: Jan 24, 2011
Posts: 2
|
|
I think the problem I was experiencing was due to a space in one of my configuration files.
Double check your xml config to make sure that the connection source is as it should be....
If you like I could probably connect to you via TeamViewer to offer some assistance.
|
 |
Leandro Coutinho
Ranch Hand
Joined: Mar 04, 2009
Posts: 415
|
|
Maurice Rogers wrote:I think the problem I was experiencing was due to a space in one of my configuration files.
Double check your xml config to make sure that the connection source is as it should be....
testDataSource.jsp
web.xml
|
 |
Leandro Coutinho
Ranch Hand
Joined: Mar 04, 2009
Posts: 415
|
|
Problem SOLVED!!! YEAH! hehe
I had the AffableBeanPool in the JDBC Connections Pools, but didn't have jdbc/affablebean in JDBC Resources.
Glassfish Admin Console -> JDBC -> JDBC Resources -> New
|
 |
 |
|
|
subject: unable to connect project to database
|
|
|