Hi,
As part of migration to jdk11 we are asked to upgrade guice version which 
supports jdk11.

So in pom.xml I tried to upgrade guice version from 4.0 => 4.2.2 and left 
other dependency versions as it is but when i started our REST application 
its unable to get a successful C3p0 connection. However if i revert back to 
4.0 version it works fine.

<dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        **<version>4.2.2</version>**
</dependency>
<dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-jndi</artifactId>
        <version>4.0</version>
</dependency>
<dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-servlet</artifactId>
        <version>4.0</version>
</dependency>
<dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.5.2</version>
</dependency>
<!-- END: C3P0 database connection and google guice for inject -->

Java Code:

import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.AbstractModule;
import com.google.inject.Provider;
import com.google.inject.jndi.JndiIntegration;

public class DemoDataSource extends AbstractModule {
private static final String JNDI_ENV = "java:comp/env/jdbc/c3p0DataSource";

@Override
protected void configure() {

bind(javax.naming.Context.class).to(javax.naming.InitialContext.class).asEagerSingleton();
Provider dataSourceProvider = JndiIntegration.fromJndi(DataSource.class, 
JNDI_ENV);
bind(DataSource.class).toProvider(dataSourceProvider).asEagerSingleton();
bind(DBConnectionPool.class).to(C3P0ConnectionProvider.class).asEagerSingleton();
}
}
}

Any help is much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/d8a6acc2-129b-484e-ba58-4ae2faeb04b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to