Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karaf - Multiple dbcp2 DataSource created when creating a DataSource #369

Open
edadou-byte opened this issue Jan 10, 2025 · 8 comments
Open

Comments

@edadou-byte
Copy link

edadou-byte commented Jan 10, 2025

Hi,
I'm new to pax-jdbc and karaf and I'm working on an evolution a route that has to use two different datasources (one postgresql and one oracle).

I'm facing an issue with Karaf (version 4.2.11) and creating jdbc datasources. I first created a DataSource pool connection for PostgreSQL and everything went fine I used this configuration file :

# configuration for pax-jdbc-config to choose and configure specific org.osgi.service.jdbc.DataSourceFactory
dataSourceName = <ds_name>
dataSourceType = DataSource
osgi.jdbc.driver.class = org.postgresql.Driver
url = jdbc:postgresql://<host>/<db_name>
user = <username>
password = <password>

# hints for pax-jdbc-config to use org.ops4j.pax.jdbc.pool.common.PooledDataSourceFactory
pool = dbcp2
xa = false

# dbcp2 specific configuration of org.apache.commons.pool2.impl.GenericObjectPoolConfig
pool.minIdle = 2
pool.maxTotal = 50
pool.blockWhenExhausted = true
pool.maxWaitMillis = 2000
pool.testOnBorrow = true
pool.testWhileIdle = false

# dbcp2 specific configuration of org.apache.commons.dbcp2.PoolableConnectionFactory
factory.validationQuery = select schema_name from information_schema.schemata
factory.validationQueryTimeout = 2

And I tried to create another one for Oracle using the same template :

# configuration for pax-jdbc-config to choose and configure specific org.osgi.service.jdbc.DataSourceFactory
dataSourceName = <ds_name>
dataSourceType = DataSource
osgi.jdbc.driver.class = oracle.jdbc.OracleDriver
url = jdbc:oracle:thin:@//<host>:<port>/<service_name>
user = <username>
password = <password>

# hints for pax-jdbc-config to use org.ops4j.pax.jdbc.pool.common.PooledDataSourceFactory
pool = dbcp2
xa = false

# dbcp2 specific configuration of org.apache.commons.pool2.impl.GenericObjectPoolConfig
pool.minIdle = 2
pool.maxTotal = 50
pool.blockWhenExhausted = true
pool.maxWaitMillis = 2000
pool.testOnBorrow = true
pool.testWhileIdle = false

# dbcp2 specific configuration of org.apache.commons.dbcp2.PoolableConnectionFactory
factory.validationQuery = SELECT TRUNC(CURRENT_DATE) AS current_date FROM dual
factory.validationQueryTimeout = 2

But after I put the file in the container it creates duplicates of the object :

image

The drivers versions are :

Postgresql : 42.2.2
Oracle : ojdbc8/19.13.0.0.1
And the features installed on karaf :

jdbc : 4.2.11
pax-jdbc-pool-dbcp2 : 1.4.4
jndi : 4.2.11

logs when putting the cfg file in the etc folder :

2025-01-08T16:54:56,305 | INFO  | fileinstall-C:\Talend\TOS_ESB-20211109_1610-V8.0.1\Runtime_ESBSE\container\etc | install.internal.Util$OsgiLogger  205 | 12 - org.apache.felix.fileinstall - 3.6.8 | Creating configuration from org.ops4j.datasource-urtest.cfg
2025-01-08T16:54:56,309 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.ops4j.pax.jdbc.pool.common.PooledDataSourceFactory)(pool=dbcp2)(xa=false))
2025-01-08T16:54:56,310 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,310 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest
2025-01-08T16:54:56,315 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,315 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest
2025-01-08T16:54:56,316 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,316 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest
2025-01-08T16:54:56,317 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,317 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest
2025-01-08T16:54:56,319 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,319 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest
2025-01-08T16:54:56,320 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,320 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest
2025-01-08T16:54:56,322 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,322 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest
2025-01-08T16:54:56,323 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.ServiceTrackerHelper$1  132 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=oracle.jdbc.OracleDriver))
2025-01-08T16:54:56,323 | INFO  | CM Configuration Updater (Update: pid=org.ops4j.datasource.1a582fed-c02e-493f-b1ee-443d8bcbd68a) | nfig.impl.DataSourceRegistration   82 | 406 - org.ops4j.pax.jdbc.config - 1.4.4 | Found DataSourceFactory. Creating DataSource urtest

(the logs are cropped, there are like 800 lines that are repeated)

After the command ls org.osgi.service.jdbc.DataSourceFactory I had like 300 objects all with the osgi.jdbc.driver.class = oracle.jdbc.OracleDriver and each one had a different osgi.jdbc.driver.name like org.apache.servicemix.bundles.jasypt-spring31-native and org.apache.karaf.jaas.jasypt-native

Is there something missing on my configuration file specific for Oracle db or something on my karaf installation that might cause this issue ?

Thanks

stackoverflow post : https://stackoverflow.com/questions/79338900/karaf-multiple-dbcp2-datasource-created-when-creating-a-datasource

output of ls org.osgi.service.jdbc.DataSourceFactory :
ls_org_osgi_service_jdbc_DataSourceFactory_output.txt

output of ls javax.sql.DataSource (I removed sensistive elements password and urls) :
ls_javax_sql_DataSource_output.txt

@grgrzybek
Copy link
Member

Reference: https://stackoverflow.com/questions/79338900/karaf-multiple-dbcp2-datasource-created-when-creating-a-datasource

Thanks for the report.
Please provide output of the bundles installed using la -l command in Karaf console.
Also please provide output of:

  • ls org.osgi.service.jdbc.DataSourceFactory
  • ls javax.sql.DataSource (it may contain passwords, so please be aware of that)

@edadou-byte
Copy link
Author

Thanks, I edited the issue with what you asked

@grgrzybek
Copy link
Member

grgrzybek commented Jan 10, 2025

In my case, I have only:

karaf@root()> ls org.osgi.service.jdbc.DataSourceFactory
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = oracle.jdbc.OracleDriver
 osgi.jdbc.driver.name = oracle
 service.bundleid = 58
 service.id = 89
 service.scope = singleton
Provided by : 
 OPS4J Pax JDBC Oracle Driver Adapter (58)
Used by: 
 OPS4J Pax JDBC Config (62)

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = oracle.jdbc.OracleDriver
 osgi.jdbc.driver.name = wrap_file__home_ggrzybek_.m2_repository_com_oracle_database_jdbc_ojdbc8_23.3.0.23.09_ojdbc8-23.3.0.23.09.jar-native
 osgi.jdbc.driver.version = 0.0.0
 service.bundleid = 60
 service.id = 104
 service.scope = singleton
Provided by : 
 wrap_file__home_ggrzybek_.m2_repository_com_oracle_database_jdbc_ojdbc8_23.3.0.23.09_ojdbc8-23.3.0.23.09.jar (60)
Used by: 
 OPS4J Pax JDBC Config (62)

However in your case, I see that org.osgi.service.jdbc.DataSourceFactory is Provided by 402 bundles:

 Abdera Core (80)
 Abdera Extensions - Main (81)
 activemq-osgi (364)
 Apache Apache HttpClient OSGi bundle (217)
 Apache Apache HttpCore OSGi bundle (218)
 Apache Aries Blueprint API (83)
 Apache Aries Blueprint CM (84)
 Apache Aries Blueprint Core (85)
 Apache Aries Blueprint Spring Extender Support (88)
 Apache Aries Blueprint Spring Support (87)
 Apache Aries JMX API (89)
 Apache Aries JMX Blueprint API (90)
 Apache Aries JMX Blueprint Core (91)
 Apache Aries JMX Core (92)
 Apache Aries JNDI API (409)
 Apache Aries JNDI Core (410)
 Apache Aries JNDI RMI Handler (412)
 Apache Aries JNDI Support for Legacy Runtimes (411)
 Apache Aries JNDI URL Handler (413)
 Apache Aries Proxy Service (94)
 Apache Aries SPI Fly Dynamic Weaving Bundle (95)
 Apache Aries Util (96)
 Apache Aries Whiteboard support for JMX DynamicMBean services (93)
 Apache Commons BeanUtils (376)
 Apache Commons Codec (154)
 Apache Commons Collections (153)
 Apache Commons Collections (155)
 Apache Commons Compress (156)
 Apache Commons DBCP (414)
 Apache Commons IO (157)
 Apache Commons Lang (160)
 Apache Commons Net (377)
 Apache Commons Pool (158)
 Apache Commons Text (159)
 Apache CXF Advanced Logging Feature (170)
 Apache CXF Command Line Tools Common (197)
 Apache CXF Command Line Tools JavaTo WS (198)
 Apache CXF Command Line Tools Validator (200)
 Apache CXF Command Line Tools WADLTo JAXRS Frontend (201)
 Apache CXF Command Line Tools WSDLTo Core (202)
 Apache CXF Command Line Tools WSDL to JavaScript Front End (204)
 Apache CXF Command Line Tools WSDLTo JAXB Databinding (203)
 Apache CXF Command Line Tools WSDLTo JAXWS Frontend (205)
 Apache CXF Command Line Tools WSDLTo Misctools (199)
 Apache CXF Core (162)
 Apache CXF JAX-RS Client (179)
 Apache CXF JAX-RS Extensions: JSON Basic (182)
 Apache CXF JAX-RS Extensions: Providers (180)
 Apache CXF JAX-RS Extensions: Search (181)
 Apache CXF JAX-RS Service Description (183)
 Apache CXF Karaf Commands (206)
 Apache CXF Metrics Feature (171)
 Apache CXF RS XML Security (379)
 Apache CXF Runtime Aegis Databinding (167)
 Apache CXF Runtime Clustering (169)
 Apache CXF Runtime Colocated Binding (163)
 Apache CXF Runtime CORBA Binding (164)
 Apache CXF Runtime Core for WSDL (196)
 Apache CXF Runtime HTTP Jetty Transport (187)
 Apache CXF Runtime HTTP Transport (186)
 Apache CXF Runtime JavaScript Client Generator (177)
 Apache CXF Runtime JavaScript Frontend (175)
 Apache CXF Runtime JAXB DataBinding (168)
 Apache CXF Runtime JAX-RS Frontend (173)
 Apache CXF Runtime JAX-WS Frontend (174)
 Apache CXF Runtime JMS Transport (188)
 Apache CXF Runtime Local Transport (189)
 Apache CXF Runtime Management (178)
 Apache CXF Runtime SAML Security functionality (185)
 Apache CXF Runtime Security functionality (184)
 Apache CXF Runtime Simple Frontend (176)
 Apache CXF Runtime SOAP Binding (165)
 Apache CXF Runtime UDP Transport (190)
 Apache CXF Runtime WS Addressing (191)
 Apache CXF Runtime WS MetadataExchange (192)
 Apache CXF Runtime WS Policy (193)
 Apache CXF Runtime WS Reliable Messaging (194)
 Apache CXF Runtime WS Security (195)
 Apache CXF Runtime XML Binding (166)
 Apache CXF Throttling Feature (172)
 Apache CXF XJC Runtime (207)
 Apache Felix Configuration Admin Service (11)
 Apache Felix Coordinator Service (9)
 Apache Felix Declarative Services (209)
 Apache Felix File Install (12)
 Apache Felix Inventory (208)
 Apache Felix Metatype Service (3)
 Apache Felix Web Console Event Plugin (211)
 Apache Felix Web Console Memory Usage Plugin (212)
 Apache Felix Web Console Service Component Runtime/Declarative Services Plugin (210)
 Apache Geronimo JMS Spec 2.0 (214)
 Apache Geronimo OSGI factory registry (216)
 Apache JAMES Mime4j (Core) (219)
 Apache James :: Mime4j :: Core (220)
 Apache Karaf :: Bundle :: BlueprintStateService (221)
 Apache Karaf :: Bundle :: Core (222)
 Apache Karaf :: ConfigAdmin :: Core (223)
 Apache Karaf :: Deployer :: Blueprint (224)
 Apache Karaf :: Deployer :: Features (225)
 Apache Karaf :: Deployer :: Karaf Archive (.kar) (226)
 Apache Karaf :: Deployer :: Wrap Non OSGi Jar (227)
 Apache Karaf :: Diagnostic :: Core (228)
 Apache Karaf :: Features :: Command (230)
 Apache Karaf :: Features :: Core (13)
 Apache Karaf :: HTTP :: Core (231)
 Apache Karaf :: Instance :: Core (232)
 Apache Karaf :: JAAS :: Blueprint :: Config (233)
 Apache Karaf :: JAAS :: Blueprint :: Jasypt (381)
 Apache Karaf :: JAAS :: Command (234)
 Apache Karaf :: JAAS :: Config (235)
 Apache Karaf :: JAAS :: Jasypt Encryption (382)
 Apache Karaf :: JAAS :: Modules (236)
 Apache Karaf :: JDBC :: Core (415)
 Apache Karaf :: JNDI :: Core (416)
 Apache Karaf :: KAR :: Core (237)
 Apache Karaf :: Log :: Core (238)
 Apache Karaf :: Management (239)
 Apache Karaf :: OSGi Services :: Event (229)
 Apache Karaf :: OSGi Services :: EventAdmin (2)
 Apache Karaf :: Package :: Core (240)
 Apache Karaf :: SCR :: Bundle State (242)
 Apache Karaf :: SCR :: Management MBeans (241)
 Apache Karaf :: Service :: Core (243)
 Apache Karaf :: Shell :: Core (246)
 Apache Karaf :: Shell :: SSH (247)
 Apache Karaf :: Shell :: Table (248)
 Apache Karaf :: Shell :: Various Commands (244)
 Apache Karaf :: System :: Core (249)
 Apache Karaf :: Web Console :: Console (250)
 Apache Karaf :: Web Console :: Features Plugin (251)
 Apache Karaf :: Web Console :: Gogo Plugin (252)
 Apache Karaf :: Web Console :: HTTP Plugin (253)
 Apache Karaf :: Web Console :: Instance Plugin (254)
 Apache MINA Core (255)
 Apache Mina SSHD :: OSGi (294)
 Apache Mina SSHD :: SCP (295)
 Apache Mina SSHD :: SFTP (296)
 Apache Neethi (256)
 Apache ServiceMix :: Bundles :: abdera-parser (258)
 Apache ServiceMix :: Bundles :: ant (259)
 Apache ServiceMix :: Bundles :: aopalliance (260)
 Apache ServiceMix :: Bundles :: aspectj (261)
 Apache ServiceMix :: Bundles :: bcel (262)
 Apache ServiceMix :: Bundles :: c3p0 (263)
 Apache ServiceMix :: Bundles :: cglib (264)
 Apache ServiceMix :: Bundles :: derby (265)
 Apache ServiceMix :: Bundles :: dom4j (266)
 Apache ServiceMix :: Bundles :: FastInfoset (267)
 Apache ServiceMix :: Bundles :: jasypt (268)
 Apache ServiceMix :: Bundles :: jasypt-spring31 (383)
 Apache ServiceMix :: Bundles :: javax.inject (269)
 Apache ServiceMix :: Bundles :: jaxb-runtime (270)
 Apache ServiceMix :: Bundles :: jaxb-xjc (271)
 Apache ServiceMix :: Bundles :: jdom (272)
 Apache ServiceMix :: Bundles :: js (279)
 Apache ServiceMix :: Bundles :: jsch (384)
 Apache ServiceMix :: Bundles :: jzlib (273)
 Apache ServiceMix :: Bundles :: kxml2 (274)
 Apache ServiceMix :: Bundles :: not-yet-commons-ssl (275)
 Apache ServiceMix :: Bundles :: okio (276)
 Apache ServiceMix :: Bundles :: opensaml (277)
 Apache ServiceMix :: Bundles :: reflections (278)
 Apache ServiceMix :: Bundles :: spring-aop (280)
 Apache ServiceMix :: Bundles :: spring-beans (281)
 Apache ServiceMix :: Bundles :: spring-context (282)
 Apache ServiceMix :: Bundles :: spring-context-support (283)
 Apache ServiceMix :: Bundles :: spring-core (284)
 Apache ServiceMix :: Bundles :: spring-expression (285)
 Apache ServiceMix :: Bundles :: spring-jms (385)
 Apache ServiceMix :: Bundles :: spring-tx (386)
 Apache ServiceMix :: Bundles :: wsdl4j (286)
 Apache ServiceMix :: Bundles :: xalan (287)
 Apache ServiceMix :: Bundles :: xercesImpl (288)
 Apache ServiceMix :: Bundles :: xmlresolver (289)
 Apache ServiceMix :: Bundles :: xpp3 (290)
 Apache ServiceMix :: Bundles :: xstream (291)
 Apache ServiceMix :: Specs :: JAX-RS API 2.1 (292)
 Apache ServiceMix :: Specs :: JAXWS API 2.3 (293)
 Apache Tika core (297)
 Apache Velocity - Engine (298)
 Apache WSS4J DOM WS-Security (303)
 Apache WSS4J Streaming WS-Security (305)
 Apache WSS4J Streaming WS-SecurityPolicy (304)
 Apache WSS4J WS-Security Bindings (300)
 Apache WSS4J WS-Security Common (302)
 Apache WSS4J WS-SecurityPolicy model (301)
 Apache XBean :: Classpath Resource Finder (307)
 Apache XBean :: Naming (417)
 Apache XBean OSGI Bundle Utilities (306)
 Apache XML Security for Java (257)
 bcpkix (15)
 bcprov (16)
 bcutil (17)
 Brave (65)
 camel-api (97)
 camel-attachments (98)
 camel-base (99)
 camel-base-engine (100)
 camel-bean (101)
 camel-bean-osgi (148)
 camel-blueprint (373)
 camel-browse (102)
 camel-cloud (103)
 camel-cluster (104)
 camel-commands-core (149)
 camel-controlbus (105)
 camel-core-catalog (106)
 camel-core-engine (107)
 camel-core-languages (108)
 camel-core-model (109)
 camel-core-osgi (150)
 camel-core-processor (110)
 camel-core-reifier (111)
 camel-core-xml (365)
 camel-cxf (366)
 camel-cxf-blueprint (374)
 camel-cxf-transport (367)
 camel-cxf-transport-blueprint (375)
 camel-dataformat (112)
 camel-dataset (113)
 camel-direct (114)
 camel-directvm (115)
 camel-endpointdsl (116)
 camel-file (117)
 camel-ftp (368)
 camel-groovy (118)
 camel-health (119)
 camel-http (120)
 camel-http-base (121)
 camel-http-common (122)
 camel-jms (369)
 camel-karaf-commands (151)
 camel-language (123)
 camel-log (124)
 camel-main (125)
 camel-management (126)
 camel-management-api (127)
 camel-mock (128)
 camel-ref (129)
 camel-rest (130)
 camel-saga (131)
 camel-scheduler (132)
 camel-seda (133)
 camel-spring (370)
 camel-spring-xml (371)
 camel-ssh (372)
 camel-stub (134)
 camel-support (135)
 camel-timer (136)
 camel-tooling-model (137)
 camel-util (138)
 camel-util-json (139)
 camel-validator (140)
 camel-vm (141)
 camel-xml-io-util (142)
 camel-xml-jaxb (143)
 camel-xml-jaxp (144)
 camel-xpath (145)
 camel-xslt (146)
 camel-xstream (147)
 CDI APIs (362)
 com.github.ben-manes.caffeine (26)
 Commons CLI (152)
 Commons JXPath (378)
 Commons Pool (161)
 Eclipse Compiler for Java(TM) (387)
 Ehcache 3 (336)
 ehcache (79)
 Expression Language 3.0 API (72)
 Extended StAX API (342)
 geronimo-j2ee-management_1.1_spec (380)
 geronimo-jta_1.1_spec (215)
 Groovy Runtime (35)
 Gson (27)
 Guava: Google Core Libraries for Java (28)
 Guava InternalFutureFailureAccess and InternalFutures (29)
 HikariCP (34)
 I18N Libraries (82)
 istack common utility code runtime (31)
 Jackson-annotations (18)
 Jackson-core (19)
 jackson-databind (20)
 Jackson-dataformat-YAML (21)
 Jackson datatype: JSR310 (22)
 Jackson-JAXRS-base (23)
 Jackson-JAXRS-JSON (24)
 Jakarta Activation (30)
 Jakarta Annotations API (69)
 Jakarta Bean Validation API (71)
 jakarta.jws API (70)
 Jakarta Mail API (32)
 Jakarta SOAP Implementation (33)
 jansi (7)
 Java Authentication SPI for Containers (213)
 Java Persistence API 2.2 (74)
 Java Servlet API (75)
 javax.interceptor API (73)
 JAXB2 Basics - Runtime (341)
 jaxen (77)
 jettison (308)
 Jetty :: Asynchronous HTTP Client (309)
 Jetty :: Continuation (310)
 Jetty :: Deployers (311)
 Jetty :: Http Utility (312)
 Jetty :: IO Utility (313)
 Jetty :: JAAS (314)
 Jetty :: JASPI Security (321)
 Jetty :: JMX Management (315)
 Jetty :: JNDI Naming (316)
 Jetty :: Plus (317)
 Jetty :: Proxy (318)
 Jetty :: Rewrite Handler (319)
 Jetty :: Security (320)
 Jetty :: Server Core (322)
 Jetty :: Servlet Handling (323)
 Jetty :: Utilities (325)
 Jetty :: Utilities :: Ajax(JSON) (326)
 Jetty :: Utility Servlets and Filters (324)
 Jetty :: Webapp Application Support (327)
 Jetty :: Websocket :: API (328)
 Jetty :: Websocket :: Client (329)
 Jetty :: Websocket :: Common (330)
 Jetty :: Websocket :: javax.websocket :: Client Implementation (331)
 Jetty :: Websocket :: javax.websocket.server :: Server Implementation (332)
 Jetty :: Websocket :: Server (333)
 Jetty :: Websocket :: Servlet Interface (334)
 Jetty :: XML utilities (335)
 JLine Builtins (337)
 JLine Reader (338)
 JLine Terminal (339)
 Joda-Time (78)
 Metrics Core (47)
 Metrics Core (48)
 Metrics Integration with JMX (49)
 Netty/Buffer (50)
 Netty/Codec (51)
 Netty/Codec/HTTP (52)
 Netty/Codec/Socks (53)
 Netty/Common (54)
 Netty/Handler (55)
 Netty/Handler/Proxy (56)
 Netty/Resolver (57)
 Netty/Transport (58)
 Netty/Transport/Native/Epoll (59)
 Netty/Transport/Native/KQueue (60)
 Netty/Transport/Native/Unix/Common (61)
 OPS4J Pax CDI Bean Bundle API (388)
 OPS4J Pax JDBC Config (406)
 OPS4J Pax JDBC Generic Driver Extender (405)
 OPS4J Pax JDBC Pooling DBCP2 (418)
 OPS4J Pax JDBC Pooling Support Base (407)
 OPS4J Pax Logging - API (5)
 OPS4J Pax Logging - Log4Jv2 implementation (6)
 OPS4J Pax Url - mvn: (4)
 OPS4J Pax Url - wrap: (14)
 OPS4J Pax Web - API (348)
 OPS4J Pax Web - Jetty (349)
 OPS4J Pax Web - Jsp Support (389)
 OPS4J Pax Web - Runtime (350)
 OPS4J Pax Web - Service SPI (351)
 org.apache.zookeeper (356)
 org.apache.zookeeper-jute (357)
 org.objectweb.asm (343)
 org.objectweb.asm.commons (344)
 org.objectweb.asm.tree (345)
 org.objectweb.asm.tree.analysis (346)
 org.objectweb.asm.util (347)
 org.osgi:org.osgi.service.jdbc (408)
 org.osgi:org.osgi.util.function (10)
 org.osgi:org.osgi.util.promise (8)
 PostgreSQL JDBC Driver JDBC42 (404)
 quartz (352)
 SnakeYAML (353)
 Stax2 API (354)
 swagger-annotations (62)
 swagger-core (63)
 swagger-models (64)
 Talend ESB :: Auxiliary Storage :: client common (390)
 Talend ESB :: Auxiliary Storage :: Common (391)
 Talend ESB :: Auxiliary Storage :: REST client (359)
 Talend ESB :: Auxiliary Storage :: REST Security (392)
 Talend ESB :: Camel Talend Job Component (360)
 Talend ESB :: CXF :: Crypto configuration (361)
 Talend ESB :: Job :: API (393)
 Talend ESB :: Job :: Controller (394)
 Talend ESB :: Locator (363)
 Talend ESB :: Policies :: Compression (395)
 Talend ESB :: Policies :: Correlation ID (396)
 Talend ESB :: Policies :: SAM Enabling (397)
 Talend ESB :: Policies :: Transformation (402)
 Talend ESB :: Policies :: XSD Schema Validation (403)
 Talend ESB :: Request-Callback (398)
 Talend ESB :: SAM :: Agent (399)
 Talend ESB :: SAM :: Common (400)
 Talend ESB :: Security :: Common (401)
 WebSocket server API (76)
 Woodstox (25)
 wrap_file__C__Talend_TOS_ESB-20211109_1610-V8.0.1_Runtime_ESBSE_container_system_org_jacorb_jacorb-omgapi_3.7_jacorb-omgapi-3.7.jar (355)
 XmlSchema Core (299)
 Zipkin Core Library (68)
 Zipkin Reporter Brave (67)
 Zipkin Reporter: Core (66)

Something's wrong with your runtime... I'd need to (or you'd need to) debug how/when the org.osgi.service.jdbc.DataSourceFactory services are registered in OSGi runtime...

@edadou-byte
Copy link
Author

Ok thanks, I'm reinstalling the runtime in a clean environment to see where the issue might come from

@edadou-byte
Copy link
Author

edadou-byte commented Jan 15, 2025

Hi, so I reinstalled the runtime in a clean environment. The issue for Oracle Datasources that were replicated is gone, but now I have a different but similar issue.
So here a the different issues I came across when I tested the new environment :

  • when I deploy a camel route (kar file) to karaf the datasources are duplicated
  • when the container is restarted the datasources are duplicated in the same case as described in the issue (some datasources are created with different bundle names for osgi.jdbc.driver.name)
  • when a 1st datasource is created and a route is deployed it can access the datasource but after creating a 2nd datasource (while the route is running) the 1st isn't recongnized anymore here is the specific error : org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: sql://select%20schema_name%20from%20information_schema.schemata?dataSource=jdbc%2Fpostgresqlds due to: DataSource must be configured

When I run the ds-list command I have this output :
image

This is the result of the command config:list '(service.factoryPid=org.ops4j.datasource)' :

config-list-2.txt

This is the result of the command ls org.osgi.service.jdbc.DataSourceFactory :
ls-service.txt

More information about the runtime :
The runtime is a karaf provided by Talend, (Talend Open Studio - 20211109 V8.0.1)

@grgrzybek
Copy link
Member

Just by checking config-list.txt, looks like your fileinstall monitors two different locations - is it correct?

  • felix.fileinstall.filename = file:/data/Talend/Runtime_ESBSE/container/etc/org.ops4j.datasource-postgresqlds.cfg
  • felix.fileinstall.filename = file:/data/Talend/Runtime_ESBSE/container/etc/org.ops4j.datasource-urtest.cfg
  • felix.fileinstall.filename = file:/data/TOS_ESB-20211109_1610-V8.0.1/Runtime_ESBSE/container/etc/org.ops4j.datasource-postgresqlds.cfg
  • felix.fileinstall.filename = file:/data/TOS_ESB-20211109_1610-V8.0.1/Runtime_ESBSE/container/etc/org.ops4j.datasource-urtest.cfg

@edadou-byte
Copy link
Author

edadou-byte commented Jan 15, 2025

Hi yes, sorry it was an old version of the file I replaced it with a new one (in the previous comment), there is only two with the file path as : file:/data/Talend/Runtime_ESBSE/container/etc

@grgrzybek
Copy link
Member

Is it fine now? I checked the ls-services.txt and I see (filtered for Oracle only):

karaf@trun()> ls org.osgi.service.jdbc.DataSourceFactory

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 service.id = 540
 osgi.jdbc.driver.version = 3.0.8
 service.bundleid = 35
 service.scope = singleton
 osgi.jdbc.driver.name = groovy-native
 osgi.jdbc.driver.class = oracle.jdbc.OracleDriver
Provided by : 
 Groovy Runtime (35)
Used by: 
 OPS4J Pax JDBC Config (406)

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 service.id = 554
 osgi.jdbc.driver.version = 0.0.0
 service.bundleid = 419
 service.scope = singleton
 osgi.jdbc.driver.name = wrap_mvn_com.oracle.database.jdbc_ojdbc8_19.13.0.0.1-native
 osgi.jdbc.driver.class = oracle.jdbc.OracleDriver
Provided by : 
 wrap_mvn_com.oracle.database.jdbc_ojdbc8_19.13.0.0.1 (419)
Used by: 
 OPS4J Pax JDBC Config (406)

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 service.id = 565
 osgi.jdbc.driver.version = 0.1.0
 service.bundleid = 424
 service.scope = singleton
 osgi.jdbc.driver.name = interfaces.R_TEST_ROUTE-native
 osgi.jdbc.driver.class = oracle.jdbc.OracleDriver
Provided by : 
 R_TEST_ROUTE (424)
Used by: 
 OPS4J Pax JDBC Config (406)

So you have 3 bundles providing oracle.jdbc.OracleDriver - Oracle driver itself, Groovy Runtime bundle and your custom R_TEST_ROUTE bundle...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants