java.lang.StringIndexOutOfBoundsException: String index out of range: 0

Hibernate JIRA | Matt Sgarlata | 1 decade ago
  1. 0

    When a joined-subclass declaration is missing a declaration of the key column, Hibernate 3.0.1 throws a StringIndexOutOfBoundsException. It would be nice to let the user know that they must specify a key column instead. Example mapping: <hibernate-mapping > <class name="com.spider.scoreboard.hdao.impl.ScorecardNodeHDao" table="scorecardnodes" proxy="com.spider.scoreboard.hdao.IScorecardNode" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version" > <id name="id" column="scorecardnodeid" type="java.lang.Integer" > <generator class="assigned"> <!-- To add non XDoclet generator parameters, create a file named hibernate-generator-params-ScorecardNodeHDao.xml containing the additional parameters and place it in your merge dir. --> </generator> </id> <property name="label" type="java.lang.String" update="true" insert="true" access="property" column="scorecardnodename" not-null="true" /> <!-- To add non XDoclet property mappings, create a file named hibernate-properties-ScorecardNodeHDao.xml containing the additional properties and place it in your merge dir. --> <joined-subclass name="com.spider.scoreboard.hdao.impl.MetricHDao" table="metrics" dynamic-update="false" dynamic-insert="false" proxy="com.spider.scocreboard.hdao.impl.IMetric" > <key column="" /> <property name="equation" type="java.lang.String" update="true" insert="true" access="property" column="equation" /> <property name="lastReminded" type="java.util.Date" update="true" insert="true" access="property" column="lastReminded" /> </joined-subclass> </class> </hibernate-mapping> Stack trace: ERROR (Configuration:addInputStream) - Could not configure datastore from input stream java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:558) at org.hibernate.mapping.Column.setName(Column.java:58) at org.hibernate.cfg.HbmBinder.bindColumns(HbmBinder.java:948) at org.hibernate.cfg.HbmBinder.bindColumnsOrFormula(HbmBinder.java:1290) at org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:991) at org.hibernate.cfg.HbmBinder.bindJoinedSubclass(HbmBinder.java:790) at org.hibernate.cfg.HbmBinder.handleJoinedSubclass(HbmBinder.java:1800) at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1741) at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:317) at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:235) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:151) at org.hibernate.cfg.Configuration.add(Configuration.java:360) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:397) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:548) at com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.createLocalSessionFactoryBean(DatabaseBeanFactoryPostProcessor.java:150) at com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.postProcessBeanFactory(DatabaseBeanFactoryPostProcessor.java:91) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:375) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:301) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131) at com.spider.scoreboard.framework.springx.ScoreboardApplicationContext.refresh(ScoreboardApplicationContext.java:73) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.loadContext(ScoreboardContextLoaderServlet.java:293) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.startupOrRestart(ScoreboardContextLoaderServlet.java:115) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.init(ScoreboardContextLoaderServlet.java:83) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:888) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:776) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3363) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3586) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141) at org.apache.catalina.core.StandardHost.start(StandardHost.java:707) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143) at org.apache.catalina.startup.Catalina.start(Catalina.java:463) at org.apache.catalina.startup.Catalina.execute(Catalina.java:350) at org.apache.catalina.startup.Catalina.process(Catalina.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156) ERROR (ScoreboardContextLoaderServlet:startupOrRestart) - Context initialization failed

    Hibernate JIRA | 1 decade ago | Matt Sgarlata
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  2. 0

    When a joined-subclass declaration is missing a declaration of the key column, Hibernate 3.0.1 throws a StringIndexOutOfBoundsException. It would be nice to let the user know that they must specify a key column instead. Example mapping: <hibernate-mapping > <class name="com.spider.scoreboard.hdao.impl.ScorecardNodeHDao" table="scorecardnodes" proxy="com.spider.scoreboard.hdao.IScorecardNode" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version" > <id name="id" column="scorecardnodeid" type="java.lang.Integer" > <generator class="assigned"> <!-- To add non XDoclet generator parameters, create a file named hibernate-generator-params-ScorecardNodeHDao.xml containing the additional parameters and place it in your merge dir. --> </generator> </id> <property name="label" type="java.lang.String" update="true" insert="true" access="property" column="scorecardnodename" not-null="true" /> <!-- To add non XDoclet property mappings, create a file named hibernate-properties-ScorecardNodeHDao.xml containing the additional properties and place it in your merge dir. --> <joined-subclass name="com.spider.scoreboard.hdao.impl.MetricHDao" table="metrics" dynamic-update="false" dynamic-insert="false" proxy="com.spider.scocreboard.hdao.impl.IMetric" > <key column="" /> <property name="equation" type="java.lang.String" update="true" insert="true" access="property" column="equation" /> <property name="lastReminded" type="java.util.Date" update="true" insert="true" access="property" column="lastReminded" /> </joined-subclass> </class> </hibernate-mapping> Stack trace: ERROR (Configuration:addInputStream) - Could not configure datastore from input stream java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:558) at org.hibernate.mapping.Column.setName(Column.java:58) at org.hibernate.cfg.HbmBinder.bindColumns(HbmBinder.java:948) at org.hibernate.cfg.HbmBinder.bindColumnsOrFormula(HbmBinder.java:1290) at org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:991) at org.hibernate.cfg.HbmBinder.bindJoinedSubclass(HbmBinder.java:790) at org.hibernate.cfg.HbmBinder.handleJoinedSubclass(HbmBinder.java:1800) at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1741) at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:317) at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:235) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:151) at org.hibernate.cfg.Configuration.add(Configuration.java:360) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:397) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:548) at com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.createLocalSessionFactoryBean(DatabaseBeanFactoryPostProcessor.java:150) at com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.postProcessBeanFactory(DatabaseBeanFactoryPostProcessor.java:91) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:375) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:301) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131) at com.spider.scoreboard.framework.springx.ScoreboardApplicationContext.refresh(ScoreboardApplicationContext.java:73) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.loadContext(ScoreboardContextLoaderServlet.java:293) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.startupOrRestart(ScoreboardContextLoaderServlet.java:115) at com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.init(ScoreboardContextLoaderServlet.java:83) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:888) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:776) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3363) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3586) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141) at org.apache.catalina.core.StandardHost.start(StandardHost.java:707) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143) at org.apache.catalina.startup.Catalina.start(Catalina.java:463) at org.apache.catalina.startup.Catalina.execute(Catalina.java:350) at org.apache.catalina.startup.Catalina.process(Catalina.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156) ERROR (ScoreboardContextLoaderServlet:startupOrRestart) - Context initialization failed

    Hibernate JIRA | 1 decade ago | Matt Sgarlata
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  3. 0

    How to Integrate SQLite *.db file and Hibernate when controlled by Spring

    Stack Overflow | 3 years ago | DavidZemon
    java.lang.IllegalStateException: Failed to load ApplicationContext
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    could not read column value from result set ; String index out of range: 0

    Stack Overflow | 8 years ago | Anthony Dahanne
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  6. 0

    Web Services Tutorial with Apache CXF | Ben McCann

    benmccann.com | 1 month ago
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0

  1. harshg 2 times, last 3 months ago
  2. balintn 4 times, last 3 months ago
  3. poroszd 1 times, last 3 months ago
  4. Stefan Braune 1 times, last 5 months ago
  5. mauritius 1 times, last 5 months ago
6 more registered users
18 unregistered visitors
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. java.lang.StringIndexOutOfBoundsException

    String index out of range: 0

    at java.lang.String.charAt()
  2. Java RT
    String.charAt
    1. java.lang.String.charAt(String.java:558)
    1 frame
  3. Hibernate
    Configuration.addInputStream
    1. org.hibernate.mapping.Column.setName(Column.java:58)
    2. org.hibernate.cfg.HbmBinder.bindColumns(HbmBinder.java:948)
    3. org.hibernate.cfg.HbmBinder.bindColumnsOrFormula(HbmBinder.java:1290)
    4. org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:991)
    5. org.hibernate.cfg.HbmBinder.bindJoinedSubclass(HbmBinder.java:790)
    6. org.hibernate.cfg.HbmBinder.handleJoinedSubclass(HbmBinder.java:1800)
    7. org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1741)
    8. org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:317)
    9. org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:235)
    10. org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:151)
    11. org.hibernate.cfg.Configuration.add(Configuration.java:360)
    12. org.hibernate.cfg.Configuration.addInputStream(Configuration.java:397)
    12 frames
  4. Hibernate
    LocalSessionFactoryBean.afterPropertiesSet
    1. org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:548)
    1 frame
  5. com.spider.scoreboard
    DatabaseBeanFactoryPostProcessor.postProcessBeanFactory
    1. com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.createLocalSessionFactoryBean(DatabaseBeanFactoryPostProcessor.java:150)
    2. com.spider.scoreboard.database.DatabaseBeanFactoryPostProcessor.postProcessBeanFactory(DatabaseBeanFactoryPostProcessor.java:91)
    2 frames
  6. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:375)
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:301)
    2 frames
  7. Spring
    AbstractRefreshableWebApplicationContext.refresh
    1. org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131)
    1 frame
  8. com.spider.scoreboard
    ScoreboardContextLoaderServlet.init
    1. com.spider.scoreboard.framework.springx.ScoreboardApplicationContext.refresh(ScoreboardApplicationContext.java:73)
    2. com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.loadContext(ScoreboardContextLoaderServlet.java:293)
    3. com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.startupOrRestart(ScoreboardContextLoaderServlet.java:115)
    4. com.spider.scoreboard.framework.springx.ScoreboardContextLoaderServlet.init(ScoreboardContextLoaderServlet.java:83)
    4 frames
  9. JavaServlet
    GenericServlet.init
    1. javax.servlet.GenericServlet.init(GenericServlet.java:258)
    1 frame
  10. Glassfish Core
    Catalina.process
    1. org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:888)
    2. org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:776)
    3. org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3363)
    4. org.apache.catalina.core.StandardContext.start(StandardContext.java:3586)
    5. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
    6. org.apache.catalina.core.StandardHost.start(StandardHost.java:707)
    7. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
    8. org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316)
    9. org.apache.catalina.core.StandardService.start(StandardService.java:450)
    10. org.apache.catalina.core.StandardServer.start(StandardServer.java:2143)
    11. org.apache.catalina.startup.Catalina.start(Catalina.java:463)
    12. org.apache.catalina.startup.Catalina.execute(Catalina.java:350)
    13. org.apache.catalina.startup.Catalina.process(Catalina.java:129)
    13 frames
  11. 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:585)
    4 frames
  12. Glassfish Core
    Bootstrap.main
    1. org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)
    1 frame