Advertisement
Guest User

Untitled

a guest
May 25th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Context path="/userProfile">
  3. <Resource
  4. auth="Container"
  5. driverClassName="org.postgresql.Driver"
  6. maxActive="100"
  7. maxIdle="30"
  8. maxWait="10000"
  9. name="jdbc/apiUserProfile"
  10. password="postgres"
  11. type="javax.sql.DataSource"
  12. url="jdbc:postgresql://localhost:5432/apiUserProfile"
  13. username="postgres"/>
  14. </Context>
  15.  
  16. http://localhost:8084/userProfile/rest/user/conn
  17.  
  18. javax.naming.NameNotFoundException: Name [jdbc/apiUserProfile] is not bound in this Context. Unable to find [jdbc].
  19. at org.apache.naming.NamingContext.lookup(NamingContext.java:818)
  20. at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
  21. at org.apache.naming.SelectorContext.lookup(SelectorContext.java:157)
  22. at javax.naming.InitialContext.lookup(InitialContext.java:411)
  23. at net.rest.dao.DbConn.apiUserProfileConn(DbConn.java:23)
  24. at net.rest.service.userProfile.returnDatabaseStatus(userProfile.java:51)
  25.  
  26. lib/mysql-connector-java-5.1.39-bin.jar
  27. lib/postgresql-9.3-1100-jdbc4.jar
  28.  
  29. package net.rest.dao;
  30.  
  31. import javax.naming.*;
  32. import javax.sql.*;
  33.  
  34. public class DbConn {
  35. private static DataSource DbConn = null;
  36. private static Context context = null;
  37. public static DataSource apiUserProfileConn() throws Exception {
  38. if(DbConn != null){
  39. return DbConn;
  40. }
  41. try {
  42. if(context == null){
  43. context = new InitialContext();
  44. }
  45. DbConn = (DataSource) context.lookup("jdbc/apiUserProfile");
  46. }
  47. catch (Exception e) {
  48. e.printStackTrace();
  49. }
  50. return DbConn;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement