ops4j / org.ops4j.pax.jdbc

An OSGi JDBC Service Implementation, including adapters for various database drivers
Apache License 2.0
44 stars 68 forks source link

NPE on oracle thin client with TNS key-value syntax in jdbc url [PAXJDBC-147] #104

Closed grgrzybek closed 5 years ago

grgrzybek commented 5 years ago

Andre Schlegel-Tylla created PAXJDBC-147

I have karaf 4.2.6 with pax-jdbc 1.3.5, pax-jdbc-oracle and using Oracle JDBC Driver Version 6 (ojdbc6.jar; also testet with ojdbc8.jar).

If I create a new datasource and using the TNS key-value syntax for the oracle thin driver I got an NPE.

jdbc:ds-create -p XXXX -u YYYYY -dc oracle.jdbc.OracleDriver -url jdbc:oracle:thin:@(DESCRIPTION_LIST=(LOAD_BALANCE=off)(FAILOVER=off)(DESCRIPTION=(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=dev06.virtimo.net)(PORT=1821)))(CONNECT_DATA=(INSTANCE_NAME=XE)))) testName

08:18:54.762 INFO [CM Event Dispatcher (Fire ConfigurationEvent: pid=org.ops4j.datasource.e0c1cede-46b3-443d-b198-005b5f6248f0)] configurationEvent: org.osgi.service.cm.ConfigurationEvent@69a8b4e5
08:18:54.762 INFO [CM Event Dispatcher (Fire ConfigurationEvent: pid=org.ops4j.datasource.e0c1cede-46b3-443d-b198-005b5f6248f0)] Configuration update event for PID: org.ops4j.datasource.e0c1cede-46b3-443d-b198-005b5f6248f0
08:18:54.763 INFO [CM Event Dispatcher (Fire ConfigurationEvent: pid=org.ops4j.datasource.e0c1cede-46b3-443d-b198-005b5f6248f0)] configurationEvent: org.osgi.service.cm.ConfigurationEvent@5d6dbcd0
08:18:54.763 ERROR [CM Configuration Updater (Update: pid=org.ops4j.datasource.e0c1cede-46b3-443d-b198-005b5f6248f0)] [org.osgi.service.cm.ManagedServiceFactory, id=198, bundle=17/mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5]: Unexpected problem updating configuration org.ops4j.datasource.e0c1cede-46b3-443d-b198-005b5f6248f0
java.lang.NullPointerException: null
    at org.ops4j.pax.jdbc.config.impl.ExternalConfigLoader.resolve(ExternalConfigLoader.java:74) ~[?:?]
    at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:71) ~[?:?]
    at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) ~[9:org.apache.felix.configadmin:1.9.14]
    at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [9:org.apache.felix.configadmin:1.9.14]
    at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1400) [9:org.apache.felix.configadmin:1.9.14]
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [9:org.apache.felix.configadmin:1.9.14]
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [9:org.apache.felix.configadmin:1.9.14]
    at java.lang.Thread.run(Thread.java:748) [?:?]

I have used this syntax in an older version without any problem. So I have checked the history of the class (https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-config/src/main/java/org/ops4j/pax/jdbc/config/impl/DataSourceConfigManager.java). It seems to me, that the change from the issue PAXJDBC-132 causes the problem.

I have no problems if I'm using the simple syntax.

jdbc:ds-create -p XXXX -u YYYY -dc oracle.jdbc.OracleDriver -url jdbc:oracle:thin:@dev06.virtimo.net:1821:XE testName

See also: https://docs.oracle.com/cd/B28359_01/java.111/b31224/jdbcthin.htm


Affects: 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5 Fixed in: 1.4.2 Votes: 0, Watches: 3


Referenced issues

is related from:

grgrzybek commented 5 years ago

Grzegorz Grzybek commented

Benjamin Graf may I assign to you?

grgrzybek commented 5 years ago

Benjamin Graf commented

Sure ��

grgrzybek commented 5 years ago

Grzegorz Grzybek commented

PR merged. I can release next week, ok?

grgrzybek commented 5 years ago

Benjamin Graf commented

Release next week is fine to me.