Hi all!!

I've been having an issue using PAX-JDBC and Aries jdbc

There is a detailed information here:

https://ops4j1.jira.com/browse/PAXJDBC-106


I copy my last comment in the bug here:

"

Ok, I've debugged this in detailed, PAX know I believe it does it right but I see an inconsistency in the aries side. PAX provides the factory a correc datasource object. However.. in the aries side:

        if  ("xa".equals(transaction) || (transactionManager !=null  && 
dataSourceinstanceof  XADataSource)) {
            mcf =new  XADataSourceMCFFactory();
            if  (transaction ==null) {
                transaction ="xa";
            }
        }else  if  (dataSourceinstanceof  DataSource) {
            mcf =new  DataSourceMCFFactory();
            if  (transaction ==null) {
                transaction = transactionManager !=null  ?"local"  :"none";
            }
        }else  {
            throw  new  IllegalArgumentException("dataSource must be of type 
javax.sql.DataSource/XADataSource");
        }
        mcf.setDataSource(dataSource);
        mcf.setExceptionSorterAsString(exceptionSorter);
        mcf.setUserName(username);
        mcf.setPassword(password);
        mcf.init();
{
    return  foo;
}

so basically because noone did use the REcoverableDatasource.java setters to stablish the user and password, the factory information has the wrong info.

Now the question is whether this is a bug in PAX or in aries

in PAX could be solved in the AriesXaPooledDataSoruceFactory.java

    public  DataSource createDataSource(Properties props)throws  SQLException {
        try  {
            XADataSource ds = 
dsFactory.createXADataSource(getNonPoolProps(props));
            RecoverableDataSource mds =new  RecoverableDataSource();
            mds.setDataSource((CommonDataSource) ds);
            mds.setTransactionManager((AriesTransactionManager) tm);
            BeanConfig.configure(mds, getPoolProps(props));
            mds.start();
            return  mds;
        }
        catch  (Throwable e) {
            LOG.error("Error creating pooled datasource"  + e.getMessage(), e);
            if  (einstanceof  SQLException) {
                throw  (SQLException) e;
            }
            else  if  (einstanceof  RuntimeException) {
                throw  (RuntimeException) e;
            }
            else  {
                throw  new  RuntimeException(e.getMessage(), e);
            }
        }
    }

there it could be solved by doing like this:

@Override
        public  DataSource createDataSource(Properties props)throws  
SQLException {
                try  {
                        XADataSource ds = 
dsFactory.createXADataSource(getNonPoolProps(props));
                        RecoverableDataSource mds =new  RecoverableDataSource();
                        mds.setDataSource(ds);
                        mds.setUsername(props.get("user").toString());
                        mds.setPassword(props.get("password").toString());
                        mds.setTransactionManager(tm);
                        BeanConfig.configure(mds, getPoolProps(props));
                        mds.start();
                        return  mds;
                }catch  (Throwable e) {
                        LOG.error("Error creating pooled datasource"  + 
e.getMessage(), e);
                        if  (einstanceof  SQLException) {
                                throw  (SQLException) e;
                        }else  if  (einstanceof  RuntimeException) {
                                throw  (RuntimeException) e;
                        }else  {
                                throw  new  RuntimeException(e.getMessage(), e);
                        }
                }
        }

But again, I'm not sure who should have the responsability to do this PAX or Aries...I believe ariesbut this is just my opinionI will contact them in the mailing list, I'm sure perhaps Christian Scheneider should know about this... so we know where exactly this should be fixed


"


I believe this should be fixed in the Aries-jdbc side, in RecoverableDatasource.java if the provided Datasource object has already a user and a password. Because right now there is the inconsistency that the RecoverableDatasource.java provides empty strings when the DataSource object does already have the datasource


I'm currently working locally in my computer with that work around I've explained in the PAX Jira until a solution for this is decided


Thanks

Regards





--
WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. E-mail transmission cannot be guaranteed to be secure or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the contents of this message, which arise as a 
result of e-mail transmission.

Warning: Although the company has taken reasonable precautions to ensure no 
viruses are present in this email, the company cannot accept responsibility for 
any loss or damage arising from the use of this email or attachments.

Reply via email to