Hmm,

That was a while back, I don't recall what the solution was. However, I was able to create two database connections with mybatis in the end.

Jason


On 12/20/16 4:11 AM, Carol Schäfer wrote:
Hi Jason,

did you solve the problem back then? I get exactly the same message. Pretty annoying, don't know what to do about this.

Thanks in advance!

Am Donnerstag, 21. Januar 2016 20:45:33 UTC+1 schrieb Jason Novotny:

    Hi,

    I'm new to dropwizard and I'm using the mybatis-dropwizard
    https://github.com/login-box/dropwizard-mybatis
    <https://github.com/login-box/dropwizard-mybatis> integrtaion
    which I've modified a bit since I need to access two databases.

    My code has the following:

    @Override public void run(T configuration, io.dropwizard.setup.Environment 
environment)throws Exception {
         ManagedDataSource fooDataSource = buildFooDataSource(configuration, 
environment);
         ManagedDataSource barDataSource = buildBarDataSource(configuration, 
environment);

         environment.lifecycle().manage(fooDataSource);
         environment.lifecycle().manage(barDataSource);

         fooSqlSessionFactory = createSqlSessionFactory(fooDataSource);
         barSqlSessionFactory = createSqlSessionFactory(barDataSource);

         environment.healthChecks().register("foo",new 
SqlSessionFactoryHealthCheck(fooSqlSessionFactory));
         
environment.jersey().register(SqlSessionProvider.binder(fooSqlSessionFactory));

         environment.healthChecks().register("bar",new 
SqlSessionFactoryHealthCheck(barSqlSessionFactory));
         
environment.jersey().register(SqlSessionProvider.binder(barSqlSessionFactory));
    }

    Basically I had just copied lines I found for one DB/SqlSessionfactory for 
the other.

    Now I get an error/warning after the 2nd environment.jersey().register is 
executed:

    WARN  [2016-01-21 19:37:55,529] org.glassfish.jersey.internal.Errors: The 
following warnings have been detected: WARNING: Cannot create new registration 
for component type class 
com.loginbox.dropwizard.mybatis.providers.SqlSessionProvider$Binder: Existing 
previous registration found for the type.

    I'm pretty clueless here, what do I need to register and how?

    Thanks, Jason



-- You received this message because you are subscribed to a topic in the Google Groups "dropwizard-user" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/dropwizard-user/tQzwQUfcNTE/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected] <mailto:[email protected]>. For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to