Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1829

FELIX: tx-control-local combined with jdbc-local give me a null java.sql.Connection

    XMLWordPrintableJSON

Details

    • Question
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • transaction-jdbc-1.0.0
    • None
    • tx-control

    Description

      Hi all,

      I'm using tx-control-local [version 1.0.0] combined with jdbc-local [version 1.0.0] into apche felix enviroment.

       

      I have followed all instructions written into Apache Aries tutorial:

       

      • Find and install a JDBC Service implementation for your chosen database --> I'm using SQL Server
      • Create a factory configuration using the factory pid org.apache.aries.tx.control.jdbc.local --> My configuration looks like this:

       

      osgi.jdbc.driver.class=com.microsoft.sqlserver.jdbc.SQLServerDriver
      url=jdbc:sqlserver://localhost:1433;databaseName=2017_TEST;user=osgiuser;password=osgiuser;
      dataSourceName=test

       

      So, in my apache felix enviroment I can see that JDBC Local bundle create a new service under JDBCConnectionProvider interface with all properties shown up. Also Local Transaction control register its own service correctly.

       

      But here comes problems, when I install my test bundle that perform a simple read query seems that, when it receives JDBCConnectionProvider and try to get SQL Connection through these instructions, it return a null connection:

       @Reference()
       void setProvider(JDBCConnectionProvider provider) {
         conn = provider.getResource(control);
       }

       

      So when it tries to create SQLStatement it gave me this error:

           java.lang.NullPointerException

       

      I don't know if I have missed some steps, but I can't solve this problem. I report below all checks I have done:

       

      • JDBC URL is correct, I was able to connect with a simple Java Program that perform JDBC Connection
      • User ha all privileges to access to database

       

      Can someone help me?

      Thanks. 

       

       

      Attachments

        1. bundles.PNG
          38 kB
          Andrea Fino
        2. jdbc-local.PNG
          38 kB
          Andrea Fino
        3. JDBCTester.java
          1 kB
          Andrea Fino
        4. transaction-control.PNG
          13 kB
          Andrea Fino

        Activity

          People

            Unassigned Unassigned
            andrea.fino Andrea Fino
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: