cancel
Showing results for 
Search instead for 
Did you mean: 

dbSchemaUpadate=true java.lang.NullPointerException [FIXED]

luisalves00
Champ in-the-making
Champ in-the-making
Is there any reason for this to happen:


16-08-2011 10:29:37 Bootstrap [FATAL] Couldn't initialize Activiti Engine
java.lang.NullPointerException
   at org.activiti.engine.impl.db.DbSqlSession.dbSchemaUpdate(DbSqlSession.java:620)
   at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:872)
   at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:77)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:280)
   at com.me.gae.servlet.Bootstrap.initActiviti(Bootstrap.java:67)

I'm using mysql 5.1.
5 REPLIES 5

frederikherema1
Star Contributor
Star Contributor
What version of activiti are you using?

luisalves00
Champ in-the-making
Champ in-the-making
5.6… damn you're quick…

frederikherema1
Star Contributor
Star Contributor
Hmm.. can you post your full activiti-config?

luisalves00
Champ in-the-making
Champ in-the-making
need to add that I'm using programatic configuration…

e.g.

org.apache.commons.dbcp.BasicDataSource bds = new org.apache.commons.dbcp.BasicDataSource();
            bds.setDefaultAutoCommit(false); //FIXME: make me configurable
            bds.setUsername(ApplicationConfig.getEncryptedConfigParamDecrypted("activiti.username"));
            bds.setPassword(ApplicationConfig.getEncryptedConfigParamDecrypted("activiti.password"));
            bds.setDriverClassName(ApplicationConfig.getConfigParam("activiti.driverClassName"));
            bds.setUrl(ApplicationConfig.getConfigParam("activiti.url"));

ProcessEngine processEngine = ProcessEngineConfiguration
                    .createStandaloneProcessEngineConfiguration()
                    .setDataSource(bds)                .setJdbcMaxActiveConnections(Integer.parseInt(ApplicationConfig.getConfigParam("activiti.jdbcMaxActiveConnections")))
                    .setJdbcMaxIdleConnections(Integer.parseInt(ApplicationConfig.getConfigParam("activiti.jdbcMaxIdleConnections")))
                    .setDatabaseType(ApplicationConfig.getConfigParam("activiti.databaseType"))
                    .setDatabaseSchemaUpdate(ApplicationConfig.getConfigParam("activiti.databaseSchemaUpdate"))
                    .setHistory(ApplicationConfig.getConfigParam("activiti.history"))
                    .setProcessEngineName(ACTIVITI_ENGINE_NAME)
                    .setJobExecutorActivate(false) //FIXME: make me configurable
                    .buildProcessEngine();

            ProcessEngines.registerProcessEngine(processEngine);



Trying to figure out what is happening in your code:


public void dbSchemaUpdate() {
    String dbVersion = null;
   
    boolean isUpgradeNeeded = false;
     
    if (isEngineTablePresent()) {
      // the next piece assumes both DB version and library versions are formatted 5.x
      PropertyEntity dbVersionProperty = selectById(PropertyEntity.class, "schema.version");
      dbVersion = dbVersionProperty.getValue();
      isUpgradeNeeded = !ProcessEngine.VERSION.equals(dbVersion);
     
      if (isUpgradeNeeded) {
        dbVersionProperty.setValue(ProcessEngine.VERSION);

        PropertyEntity dbHistoryProperty;
        if ("5.0".equals(dbVersion)) {
          dbHistoryProperty = new PropertyEntity("schema.history", "create(5.0)");
          insert(dbHistoryProperty);
        } else {
          dbHistoryProperty = selectById(PropertyEntity.class, "schema.history");
        }
       
        String dbHistoryValue = dbHistoryProperty.getValue()+" upgrade("+dbVersion+"->"+ProcessEngine.VERSION+")";
        dbHistoryProperty.setValue(dbHistoryValue);
       
        dbSchemaUpgrade("engine", dbVersion);
      }
    } else {
      dbSchemaCreateEngine();
    }
   
    if (isHistoryTablePresent()) {
      if (isUpgradeNeeded) {
        dbSchemaUpgrade("history", dbVersion);
      }
    } else if (dbSqlSessionFactory.isDbHistoryUsed()) {
      dbSchemaCreateHistory();
    }
   
    if (isIdentityTablePresent()) {
      if (isUpgradeNeeded) {
        dbSchemaUpgrade("identity", dbVersion);
      }
    } else if (dbSqlSessionFactory.isDbIdentityUsed()) {
      dbSchemaCreateIdentity();
    }
   
    if (isCycleTablePresent()) {
      if (isUpgradeNeeded) {
        dbSchemaUpgrade("cycle", dbVersion);
      }
    } else if (dbSqlSessionFactory.isDbCycleUsed()) {
      dbSchemaCreateCycle();
    }
  }

luisalves00
Champ in-the-making
Champ in-the-making
Sorry for wasting your time…

the problem is fixed.

Was a communication issue with the DBA. He created the tables (with no data) on the fresh schema…
Is possible to remove the thread?