Do you use context.xml? If so maybe use tomee.xml

Le 22 mai 2017 05:30, "tonywestonuk" <[email protected]> a écrit :

> I have an @ApplicationScoped class containing a producer method....below.
>
> When I start/stop the application with the manager app, I get the error:
> javax.management.InstanceAlreadyExistsException:
> tomcat.jdbc:name="org.tony.DBIProducer/dataSource",
> context=/tribune_etl,engine=Catalina,type=ConnectionPool,
> host=localhost,class=org.apache.tomcat.jdbc.pool.DataSource
>
>
> What do I need to do, to avoid this error.
> Thanks.
>
>
>
> @ApplicationScoped
> public class DBIProducer implements ConnectionFactory {
>
>         @Resource
>         DataSource dataSource;
>
>         @Resource(name="db_schema")
>         String schema;
>
>         @Produces
>         public DBI createDBI(){
>                 DBI dbi = new DBI(this);
>
>                 return new DBI(this);
>         }
>
>
>         @Override
>         public Connection openConnection() throws SQLException {
>                 Connection connection = dataSource.getConnection();
>                 connection.setSchema(schema);
>                 connection.setAutoCommit(true);
>                 return connection;
>         }
> }
>
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/Correct-destroy-of-producer-method-tp4681721.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Reply via email to