osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (ARIES-1829) FELIX: tx-control-local combined with jdbc-local give me a null java.sql.Connection


Andrea Fino created ARIES-1829:
----------------------------------

             Summary: FELIX: tx-control-local combined with jdbc-local give me a null java.sql.Connection
                 Key: ARIES-1829
                 URL: https://issues.apache.org/jira/browse/ARIES-1829
             Project: Aries
          Issue Type: Question
          Components: tx-control
    Affects Versions: transaction-jdbc-1.0.0
            Reporter: Andrea Fino
         Attachments: JDBCTester.java, bundles.PNG, jdbc-local.PNG, transaction-control.PNG

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:

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

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:
{code:java}
 @Reference()
 void setProvider(JDBCConnectionProvider provider) {
   conn = provider.getResource(control);
 }{code}
 

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

     {color:#FF0000}*java.lang.NullPointerException*{color}

 

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. 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)