This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Your application uses data source that called jdbc/sabit - follows from web.xml
Your web container has only jdbc/postgres data source - follows from context.xml
Your application for persistence uses java:/comp/env/jdbc/sabit data source - follows from persistence.xml
Change context.xml so that name would meet the name from web.xml
Note: I'm not really sure but in Tomcat container You could define persistence data source without java:/comp/env/.
Also be sure that your connection drivers are loaded with web container (driver jars are in lib directory).
Strange: You in persistence.xml define Your connection as org.hibernate.dialect.Oracle10gDialect but in context.xml using org.postgresql.Driver. Check once again Your configuration.
The most common cause of this really annoying error is something miscoded on the Tomcat Resource definition. Usually the URL, since a miscoded class name results in a ClassNotFoundException, and invalid userid/password generally results in a login rejection.
It's definitely not right that the Resource is registered under (java:comp/env/)jdbc/posgres, but the webapp is attempting to look up java:comp/env/jdcb/sabit. Although ordinarily attempting to look up an undefined name via JNDI would result in a NamingException, so I wonder if there isn't another Resource definition you didn't tell us about.
As for having the "java:comp/env" part of the directory path be optional, Tomcat itself merely provides the app with a JNDI registry. However, the client JPA code may be capable of automatically supplying the fixed part of the directory path. Either it or Spring can, I know, but it's been a while since I looked at it. It's safer to use the full (absolute) JNDI path, however.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jan 16, 2012
Thanks for the reply.
Because of these differences, with remaking a true example of documentation.
# Caused by: java.lang.NullPointerException
# at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
# at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
# at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
# at java.sql.DriverManager.getDriver(DriverManager.java:253)
# at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
Check to make sure that your Oracle JDBC driver jar is present in the Tomcat server's "lib" directory. DO NOT include this jar in the WAR itself!
Joined: Jan 16, 2012
I put the ojdbc6.jar in
in my VM arguments