Liquibase during startup JEE / EJB get the data source & No valid EE environment for injection of liquibase.integration.cdi.CDILiquibase

Hey guy,

I looked into and have some trouble with this code. My Resource is always null. Well I expected it to be null.

I played around with it and declaring the thing to an EJB works fine. Should we update the documentation or do I miss simply something

  1. @Stateless
  2. public class LiquibaseProducer {
  3.     @Resource(name = "jdbc/easyScrum")
  4.     private DataSource myDataSource;

  6.     @Produces @LiquibaseType
  7.     public CDILiquibaseConfig createConfig() {
  8.         CDILiquibaseConfig config = new CDILiquibaseConfig();
  9.         config.setChangeLog("/changelog.xml");
  10.         return config;
  11.     }

  12.     @Produces @LiquibaseType
  13.     public DataSource createDataSource() throws SQLException, NamingException {
  14.         if (myDataSource == null) throw new IllegalStateException("Missing jdbc/easyScrum in container!");
  15.         return myDataSource;
  16.     }

  17.     @Produces @LiquibaseType
  18.     public ResourceAccessor create() {
  19.         return new ClassLoaderResourceAccessor(getClass().getClassLoader());
  20.     }

I get also the anoing error im my glassfish:

No valid EE environment for injection of liquibase.integration.cdi.CDILiquibase

And a lot of Spring class not found … well of course not it is a JEE project and not Spring.

Does this make sense?



Deployment fails on a JEE7 container: e.g.: GlassFish Server 4.0

I grabbed the source and removed the issue in that link for my own purpose. It now deploys past that issue, but I am still getting an issue with the @LiquibaseType Datasource not working… keeps telling me something about dependencies. I am an Eclipse/Ant project guy, not maven, and can’t seem to figure out what runtime jars are required for Liquibase. I suspect that either I am missing a jar (or many) in my WEB-INF/lib folder, or that my configuration in web.xml is incorrect. I configured a jdbc/myConnectionPool in glassfish that works, and use it in the ejb/entities just fine. Hoping someone knows what may be up with this, or can at least provide a list of all the required runtime dependencies.


I’ll post in separate thread, but wondering if anyone knows how to find out all the required runtime dependency jars that I should put in my web-inf/lib to use luiquibase 3.x

The only dependency you should need for liquibase 3 is snakeyaml