org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jdbc.datasource.init.DataSourceInitializer#0': Invocation of init method failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement at line 1 of resource class path resource [org/springframework/batch/core/schema-postgresql.sql]: CREATE TABLE BATCH_JOB_INSTANCE ( JOB_INSTANCE_ID BIGINT NOT NULL PRIMARY KEY , VERSION BIGINT , JOB_NAME VARCHAR(100) NOT NULL, JOB_KEY VARCHAR(32) NOT NULL, constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) )

spring.io | 5 months ago
  1. 0

    Trying to configure Spring Batch Job Repository - Spring Forum

    spring.io | 5 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jdbc.datasource.init.DataSourceInitializer#0': Invocation of init method failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement at line 1 of resource class path resource [org/springframework/batch/core/schema-postgresql.sql]: CREATE TABLE BATCH_JOB_INSTANCE ( JOB_INSTANCE_ID BIGINT NOT NULL PRIMARY KEY , VERSION BIGINT , JOB_NAME VARCHAR(100) NOT NULL, JOB_KEY VARCHAR(32) NOT NULL, constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) )
  2. 0

    [BATCH-2066] Bump Spring version to 3.2.7.RELEASE - Spring JIRA

    spring.io | 1 year ago
    org.springframework.dao.DataAccessResourceFailureException: PreparedStatementCallback; SQL [SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?]; connection exception: closed; nested exception is java.sql.SQLNonTransientConnectionException: connection exception: closed
  3. 0

    Using a plain DefaultDirContextValidator results in errors, with both Active Directory and Sun Directory Server. As soon as a valid base DN is set it works as expected. First a warning is logged: 14:05:50,355 WARN [DefaultDirContextValidator] DirContext 'javax.naming.ldap.InitialLdapContext@799f9a' failed validation with an exception. javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001A8, problem 2001 (NO_OBJECT), data 0, best match of: '' ]; remaining name '' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3010) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2931) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2737) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1808) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1731) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321) at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248) at org.springframework.ldap.pool.validation.DefaultDirContextValidator.validateDirContext(DefaultDirContextValidator.java:154) at org.springframework.ldap.pool.factory.DirContextPoolableObjectFactory.validateObject(DirContextPoolableObjectFactory.java:169) at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1035) at org.springframework.ldap.pool.factory.PoolingContextSource.getContext(PoolingContextSource.java:394) at org.springframework.ldap.pool.factory.PoolingContextSource.getReadOnlyContext(PoolingContextSource.java:374) at org.springframework.ldap.core.LdapTemplate.executeReadOnly(LdapTemplate.java:770) at org.springframework.ldap.core.LdapTemplate.lookup(LdapTemplate.java:897) [...] then an error: 14:05:50,358 ERROR [SequentialChannelRunner] Channel run error! Channel: channel1 org.springframework.dao.DataAccessResourceFailureException: Failed to borrow DirContext from pool.; nested exception is java.util.NoSuchElementException: Could not create a validated object at org.springframework.ldap.pool.factory.PoolingContextSource.getContext(PoolingContextSource.java:397) at org.springframework.ldap.pool.factory.PoolingContextSource.getReadOnlyContext(PoolingContextSource.java:374) at org.springframework.ldap.core.LdapTemplate.executeReadOnly(LdapTemplate.java:770) at org.springframework.ldap.core.LdapTemplate.lookup(LdapTemplate.java:897) [...] Caused by: java.util.NoSuchElementException: Could not create a validated object at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1049) at org.springframework.ldap.pool.factory.PoolingContextSource.getContext(PoolingContextSource.java:394) ... 9 more

    Spring JIRA | 8 years ago | Marius Scurtescu
    org.springframework.dao.DataAccessResourceFailureException: Failed to borrow DirContext from pool.; nested exception is java.util.NoSuchElementException: Could not create a validated object
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    h4. Status Quo The following lines from an SQL script worked with the {{EmbeddedDatabaseBuilder}} until I updated to the latest nightly snapshot ({{org.springframework.jdbc-3.0.4.BUILD-20100810.004442-53}}). {code:title=No longer working} INSERT INTO users(email_address, password, first_name, last_name, roles) values('sam.brannen@example.com', '$pr!ng', 'Sam', 'Brannen', 'ROLE_USER,ROLE_ADMIN'); {code} Execution of this script results in the following stacktrace: {code:title=Stacktrace} org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is java.sql.SQLException: Unexpected token INTOUSERS, requires INTO in statement [INSERT INTOusers] at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.populateDatabase(EmbeddedDatabaseFactory.java:158) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.initDatabase(EmbeddedDatabaseFactory.java:138) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.getDatabase(EmbeddedDatabaseFactory.java:114) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder.build(EmbeddedDatabaseBuilder.java:112) {code} Removing the newline between {{INTO}} and {{users}} (as in the following script) works. Thus, recent changes (from 3.0.3 - 3.0.4) now swallow {{\n}} in SQL scripts, effectively concatenating adjacent lines. {code:title=Working} INSERT INTO users(email_address, password, first_name, last_name, roles) values('sam.brannen@example.com', '$pr!ng', 'Sam', 'Brannen', 'ROLE_USER,ROLE_ADMIN'); {code} h4. Proposed Solution {{ResourceDatabasePopulator}} should be modified to properly interpret _empty lines_ in contrast to simply swallowing all {{\n}} characters.

    Spring JIRA | 6 years ago | Sam Brannen
    org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is java.sql.SQLException: Unexpected token INTOUSERS, requires INTO in statement [INSERT INTOusers]
  6. 0

    java.sql.SQLException: Protocol violation-SQL state [99999]; error code [17412]; error code [17402] (Object Relational Mapping forum at Coderanch)

    coderanch.com | 3 months ago
    org.springframework.dao.DataAccessResourceFailureException: Hibernate operation: could not get next sequence value; SQL [select SEQIPERFDASHBOARDID.nextval from dual]; OALL8 is in an inconsistent state; nested exception is : OALL8 is in an inconsistent state

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.dao.DataAccessResourceFailureException

      Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement at line 1 of resource class path resource [org/springframework/batch/core/schema-postgresql.sql]: CREATE TABLE BATCH_JOB_INSTANCE ( JOB_INSTANCE_ID BIGINT NOT NULL PRIMARY KEY , VERSION BIGINT , JOB_NAME VARCHAR(100) NOT NULL, JOB_KEY VARCHAR(32) NOT NULL, constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) )

      at org.springframework.jdbc.datasource.init.DataSourceInitializer.afterPropertiesSet()
    2. org.springframework.jdbc
      DataSourceInitializer.afterPropertiesSet
      1. org.springframework.jdbc.datasource.init.DataSourceInitializer.afterPropertiesSet(DataSourceInitializer.java:92)
      1 frame
    3. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      5. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
      6. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      7. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
      8. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
      9. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      9 frames
    4. Spring Context
      ClassPathXmlApplicationContext.<init>
      1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
      2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
      3. org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
      4. org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
      4 frames
    5. Spring Batch Core
      CommandLineJobRunner.main
      1. org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:282)
      2. org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574)
      2 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    7. org.codehaus.mojo
      ExecJavaMojo$1.run
      1. org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
      1 frame
    8. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:662)
      1 frame