osdir.com

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

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


    [ https://issues.apache.org/jira/browse/ARIES-1829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16626033#comment-16626033 ] 

Timothy Ward commented on ARIES-1829:
-------------------------------------

Thank you for the bug report - are you able to share the application as a whole, perhaps on GitHub? It would be really useful to see the deployment as a whole, because the call to getResource should never return null. If you are able to share the project it would be ideal because otherwise we'll be guessing about what framework, database and DS versions you might be using.

> 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
>            Priority: Minor
>              Labels: beginner
>         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)