Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0030919Openbravo ERPA. Platformpublic2015-09-24 12:222015-11-23 21:16
alostale 
alostale 
immediateminorhave not tried
closedfixed 
5
 
3.0PR16Q13.0PR16Q1 
AugustoMauch
Core
Production - Confirmed Stable
2011-01-19
3.0RC4
https://code.openbravo.com/erp/devel/pi/rev/7fc34fd92373 [^]
No
0030919: can't use DB connection defined as JNDI service
It is not possible to use DB connection defined as JNDI service because even having it configured, direct connection is tried to be created in some places.

The behavior is different depending on OB version:

* 3.0RC4-current pi (pre PR15Q4), this error is risen:
   [main] ERROR org.openbravo.database.ConnectionProviderImpl - Error getting connection java.sql.SQLException: No suitable driver found for null/null
    at java.sql.DriverManager.getConnection(DriverManager.java:689)
    at java.sql.DriverManager.getConnection(DriverManager.java:270)
    at org.openbravo.database.OpenbravoDriverManagerConnectionFactory.createConnection(OpenbravoDriverManagerConnectionFactory.java:55)
* current pi (pre PR15Q4), in same place a ClassCastException is thrown trying to cast JNDIConnectionProvider to ConnectionProviderImpl

Additionally, when it is combined with JdbcExternalConnectionPool:
* it tries to create two pools: one for DAL and another one for xsql connections
* DAL connections try to use direct DB connection rather than JNDI resulting in NPE if those properties are not set
* Configure Openbravo to use JNDI (removing the rest of direct DB connection settings) [1] removing from Openbravo.properties settings to use direct DB connection
* Start Tomcat

[1] follow documentation in http://wiki.openbravo.com/wiki/Projects:JNDI_Service/Technical_Documentation [^] until 0030918 is fixed
No tags attached.
related to defect 0030918 acknowledged Triage Platform Base missing user documentation for jndi db connection 
related to feature request 00295643.0PR15Q4 closed inigosanchez Include Connection Pool module into distribution 
depends on backport 00309203.0PR15Q3.3 closed platform can't use DB connection defined as JNDI service 
depends on backport 00309213.0PR15Q2.6 closed platform can't use DB connection defined as JNDI service 
Issue History
2015-09-24 12:22alostaleNew Issue
2015-09-24 12:22alostaleAssigned To => platform
2015-09-24 12:22alostaleModules => Core
2015-09-24 12:22alostaleTriggers an Emergency Pack => No
2015-09-24 12:26alostaleRegression level => Production - Confirmed Stable
2015-09-24 12:26alostaleRegression date => 2011-01-19
2015-09-24 12:26alostaleRegression introduced in release => 3.0RC4
2015-09-24 12:26alostaleRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/7fc34fd92373 [^]
2015-09-24 12:28alostaleRelationship addedrelated to 0030918
2015-09-24 12:35alostaleDescription Updatedbug_revision_view_page.php?rev_id=9470#r9470
2015-09-24 12:36alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9472#r9472
2015-09-24 12:38alostaleDescription Updatedbug_revision_view_page.php?rev_id=9473#r9473
2015-09-24 12:38alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9474#r9474
2015-09-24 12:39alostaleStatusnew => scheduled
2015-09-24 12:39alostaleAssigned Toplatform => alostale
2015-09-24 12:40alostaleRelationship addedrelated to 0029564
2015-09-24 12:54alostaleTarget Version => 3.0PR15Q4
2015-09-28 18:37rafademiguelIssue Monitored: rafademiguel
2015-09-29 12:29alostaleTarget Version3.0PR15Q4 => 3.0PR16Q1
2015-10-22 07:39hgbotCheckin
2015-10-22 07:39hgbotNote Added: 0081182
2015-10-22 07:39hgbotStatusscheduled => resolved
2015-10-22 07:39hgbotResolutionopen => fixed
2015-10-22 07:39hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/7f26d269ea390bc6eb51b9200da4cc4f2c020984 [^]
2015-10-22 07:40alostaleReview Assigned To => AugustoMauch
2015-10-26 11:57hgbotCheckin
2015-10-26 11:57hgbotNote Added: 0081309
2015-10-27 09:45AugustoMauchNote Added: 0081332
2015-10-27 09:45AugustoMauchStatusresolved => closed
2015-10-27 09:45AugustoMauchFixed in Version => 3.0PR16Q1
2015-11-23 21:16hudsonbotCheckin
2015-11-23 21:16hudsonbotNote Added: 0082140
2015-11-23 21:16hudsonbotCheckin
2015-11-23 21:16hudsonbotNote Added: 0082158

Notes
(0081182)
hgbot   
2015-10-22 07:39   
Repository: erp/devel/pi
Changeset: 7f26d269ea390bc6eb51b9200da4cc4f2c020984
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Oct 21 12:21:21 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/7f26d269ea390bc6eb51b9200da4cc4f2c020984 [^]

fixed bug 30919: can't use DB connection defined as JNDI service

  Several problems fixed:
   * Even configured, JNDI was not used in ModelProvider.initializeReferenceClasses
     method
   * Casting exception was thrown in ModelProvider.initializeReferenceClasses
   * When Tomcat Pool was configured as external pool and also JDNI datasource
     was configured, it was not properly managed. Now the pool is used and JNDI
     datasource is set
   * Improved some error logging which was hiding root cause stack traces

---
M modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/JdbcExternalConnectionPool.java
M src-core/src/org/openbravo/base/ConnectionProviderContextListener.java
M src-core/src/org/openbravo/base/HttpBaseServlet.java
M src-core/src/org/openbravo/database/ConnectionProviderImpl.java
M src-core/src/org/openbravo/database/JNDIConnectionProvider.java
M src/org/openbravo/base/model/ModelProvider.java
M src/org/openbravo/base/session/SessionFactoryController.java
---
(0081309)
hgbot   
2015-10-26 11:57   
Repository: erp/devel/pi
Changeset: ed046574e6ff71eb503d8309e810b283c8d48242
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Oct 26 11:56:37 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/ed046574e6ff71eb503d8309e810b283c8d48242 [^]

related to issue 30919: fixed logic to check if JNDIConnectionProvider is used

  Old JNDIConnectionProvider should be used if JNDI is configured and there is
  no external pool in use.

---
M src-core/src/org/openbravo/base/ConnectionProviderContextListener.java
---
(0081332)
AugustoMauch   
2015-10-27 09:45   
Code reviewed and verified in pi@3a698bde90ad
(0082140)
hudsonbot   
2015-11-23 21:16   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7b56bebaaa88 [^]
Maturity status: Test
(0082158)
hudsonbot   
2015-11-23 21:16   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7b56bebaaa88 [^]
Maturity status: Test