jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emiliano albiani <emilianoalbi...@tagetik.com>
Subject problem MSSqlPersistenceManager with JNDI
Date Fri, 24 Sep 2010 15:05:20 GMT
Hi all,

I am using the MSSqlPersistenceManager with JNDI but it seems there is a problem about the
user and password. Even if, as javadoc says, I don't configure the user and password:

 <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.MSSqlPersistenceManager">
            <param name="url" value="java:comp/env/it.gruppo.easy.jdbc.main00"/>
            <param name="driver" value="javax.naming.InitialContext"/>
 </PersistenceManager>


the framework try to use them:

public final class ConnectionFactory {
    ...
   private DataSource createDataSource(String driver, String url, String user, String password)
            throws RepositoryException {
        Class<?> driverClass = getDriverClass(driver);
        if (driverClass != null
                && Context.class.isAssignableFrom(driverClass)) {
            @SuppressWarnings("unchecked")
            DataSource database = getJndiDataSource((Class<Context>) driverClass, url);
            if (user == null && password == null) {
                return database;
            } else {
                return new DataSourceWrapper(database, user, password);
            }
        } else {
            return getDriverDataSource(driverClass, url, user, password);
        }
    }
}


because, by default, are initialized with an empty string:

public class MSSqlPersistenceManager extends SimpleDbPersistenceManager
...
 public MSSqlPersistenceManager() {
        // preset some attributes to reasonable defaults
        schema = "mssql";
        driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
        schemaObjectPrefix = "";
        user = "";
        password = "";
        initialized = false;
        tableSpace = "";
    }
...
}


As a workaround I extended MSSqlPersistentManager, and I used it in my configuration file:

public class TGKMSSqlPersistenceManager extends MSSqlPersistenceManager {
    public TGKMSSqlPersistenceManager() {
        super();
        setPassword(null);
        setUser(null);
    }
}

Am I misunderstanding something?

Thanks.
Emiliano







Mime
View raw message