Guest User

Untitled

a guest
Oct 27th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <datasource jta="true" jndi-name="java:/datasources/DATASOURCEBD" pool-name="APLICACIONWEB" enabled="true" use-ccm="false">
  2. <connection-url>jdbc:oracle:thin:@192.168.1.57:1521:ORCL</connection-url>
  3. <driver-class>oracle.jdbc.OracleDriver</driver-class>
  4. <driver>OracleJDBCDriver</driver>
  5. <security>
  6. <user-name>USERDB</user-name>
  7. <password>CLAVE</password>
  8. </security>
  9. <validation>
  10. <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
  11. <background-validation>true</background-validation>
  12. <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
  13. <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
  14. </validation>
  15. </datasource>
  16.  
  17. <jboss-web>
  18. <resource-ref>
  19. <res-ref-name>jdbc/AppDSLocal</res-ref-name>
  20. <jndi-name>java:/datasources/DATASOURCEBD</jndi-name>
  21. </resource-ref>
  22. </jboss-web>
  23.  
  24. <web-app>
  25. <resource-ref>
  26. <description>DB Connection</description>
  27. <res-ref-name>jdbc/AppDSLocal</res-ref-name>
  28. <res-type>javax.sql.DataSource</res-type>
  29. <res-auth>Container</res-auth>
  30. </resource-ref>
  31. </web-app>
  32.  
  33. public final class DBHelper {
  34.  
  35. @Resource(name = "jdbc/AppDSLocal")
  36. private DataSource datasource;
  37.  
  38. public Connection getConecction() {
  39. try {
  40. Connection connection = datasource.getConnection();
  41. return connection;
  42. }
  43. catch(NamingException ne) {
  44. throw new PersistenceException("Error al obtener conexion", ne);
  45. }
  46. catch(SQLException sqle) {
  47. throw new PersistenceException("Error ", sqle);
  48. }
  49. }
  50. }
  51.  
  52. 01:14:27,147 ERROR [stderr] (default task-2) java.lang.NullPointerException
Add Comment
Please, Sign In to add comment