Grails
  1. Grails
  2. GRAILS-5290

Modify gorm.xsd to support optional config-location and config-class as specified in GORMSessionFactoryDefinitionParser javadoc

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.1.1, 1.2-M1, 1.2-M2, 1.2-M3
    • Fix Version/s: 1.2.3, 1.3.2
    • Component/s: Persistence
    • Labels:
      None

      Description

      http://grails.org/doc/latest/api/org/codehaus/groovy/grails/orm/hibernate/cfg/GORMSessionFactoryDefinitionParser.html

      specifies:

      /*
       * <gorm:sessionFactory
       *          data-source-ref="myDataSource"
       *          base-package="my.company.domain"
       *          lob-handler-ref="lobHandler" <!--optional-->
       *          config-location="classpath:hibernate.cfg.xml" <!--optional-->
       *          config-class="org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration" <!--optional-->
       * >
       *      <property name="hibernateProperties"></property>
       * </gorm:sessionFactory>
      */
      

      I am trying to migrate to grails, by first moving my Java objects to Groovy. However due to a bug resulting in a proxy class cast exception, it is making the migration extremely painful.

      I would like to configure my application to use gorm with Hibernate annotations.
      The javadoc for org.codehaus.groovy.grails.orm.hibernate.cfg.GORMSessionFactoryDefinitionParser states this as possible, but I do not see any code to make it work. Also gorm.xsd does state the optional attributes.

      Please clarify if there is a plan to have this implemented, or remove the optional attributes from the javadoc.

        Issue Links

          Activity

          Hide
          Scott Murphy added a comment -
          Show
          Scott Murphy added a comment - Using this would solve: http://jira.codehaus.org/browse/GROOVY-3821
          Show
          Scott Murphy added a comment - http://opensource.atlassian.com/projects/hibernate/browse/HHH-3870
          Show
          Graeme Rocher added a comment - Fixed http://github.com/grails/grails/commit/c7ac36bd0dfa10b45c8043f2b875b14729af9085
          Hide
          Scott Murphy added a comment -

          gorm.xsd still needs to be updated.

          9-11-09 16:44:32,684 ERROR [org.springframework.test.context.TestContextManager] - <Caught exception while allowing TestExecutionListener [org.springframewor
          est.context.support.DependencyInjectionTestExecutionListener@16921fd] to prepare test instance [com.pictage.core.slideshow.SlideShowHibernateRepositoryTest@1
          011]>
          a.lang.IllegalStateException: Failed to load ApplicationContext
               at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
               at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:10
          
               at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:7
          
               at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:333)
               at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
               at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
               at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
               at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
               at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
               at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
               at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
               at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
               at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
               at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
               at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
               at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
               at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
               at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
               at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
               at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
               at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
               at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
               at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
               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:597)
               at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
               at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
          sed by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 130 in XML document from class path resource [annotation-test.xml] is inv
          d; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'config-location' is not allowed to appear in element 'gorm:sessionFa
          ry'.
               at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:378)
               at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:316)
               at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:284)
               at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
               at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
               at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
               at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
               at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81)
               at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
               at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
               at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
               ... 28 more
          sed by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'config-location' is not allowed to appear in element 'gorm:sessionFactory'.
               at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
               at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
               at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
               at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
               at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
               at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
               at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
               at org.apache.xerces.impl.xs.XMLSchemaValidator.processAttributes(Unknown Source)
               at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
               at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
               at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
               at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
               at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
               at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
               at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
               at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
               at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
               at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
               at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
               at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:370)
               ... 38 more
          
          Show
          Scott Murphy added a comment - gorm.xsd still needs to be updated. 9-11-09 16:44:32,684 ERROR [org.springframework.test.context.TestContextManager] - <Caught exception while allowing TestExecutionListener [org.springframewor est.context.support.DependencyInjectionTestExecutionListener@16921fd] to prepare test instance [com.pictage.core.slideshow.SlideShowHibernateRepositoryTest@1 011]> a.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:10 at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:7 at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:333) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 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:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) sed by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 130 in XML document from class path resource [annotation-test.xml] is inv d; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'config-location' is not allowed to appear in element 'gorm:sessionFa ry'. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:378) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:316) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:284) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1) at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304) ... 28 more sed by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'config-location' is not allowed to appear in element 'gorm:sessionFactory'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.processAttributes(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:370) ... 38 more
          Hide
          Scott Murphy added a comment -

          I modified gorm.xsd and added:

                          <xsd:attribute name="config-location" type="xsd:string" />
                          <xsd:attribute name="config-class" type="xsd:string" />
          
          Show
          Scott Murphy added a comment - I modified gorm.xsd and added: <xsd:attribute name= "config-location" type= "xsd:string" /> <xsd:attribute name= "config-class" type= "xsd:string" />
          Hide
          Scott Murphy added a comment -

          Also, setting config-class="org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration"

              <gorm:sessionFactory base-package="com.pictage.core" data-source-ref="v4DataSource"
          	                     message-source-ref="messageSource" config-class="org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration">
                  <property name="hibernateProperties">
                      <util:map>
                          <entry key="hibernate.hbm2ddl.auto" value="validate"/>
                          <entry key="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                          <entry key="hibernate.show_sql" value="true"/>
                          <entry key="hibernate.format_sql" value="true"/>
                      </util:map>
                  </property>
              </gorm:sessionFactory>
          

          I get a nullpointer exception:

          2009-11-11 17:44:34,287 ERROR [org.springframework.test.context.TestContextManager] - <Caught exception while allowing TestExecutionListener [org.springframewor
          k.test.context.support.DependencyInjectionTestExecutionListener@1ea6ce9] to prepare test instance [com.pictage.core.listing.ListingTypeHibernateRepositoryTest@1
          944b85]>
          java.lang.IllegalStateException: Failed to load ApplicationContext
                  at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
                  at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:10
          9)
                  at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:7
          5)
                  at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:333)
                  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
                  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
                  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
                  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
                  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
                  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
                  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
                  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
                  at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
                  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
                  at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
                  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
                  at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
                  at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
                  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
                  at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
                  at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
                  at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
                  at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
                  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:597)
                  at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
                  at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
          Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [annotation-test.x
          ml]; nested exception is java.lang.NullPointerException
                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:394)
                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:316)
                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:284)
                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
                  at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81)
                  at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
                  at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
                  at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
                  ... 28 more
          Caused by: java.lang.NullPointerException
                  at org.codehaus.groovy.grails.orm.hibernate.cfg.GORMSessionFactoryDefinitionParser.lookupConfigClass(GORMSessionFactoryDefinitionParser.java:236)
                  at org.codehaus.groovy.grails.orm.hibernate.cfg.GORMSessionFactoryDefinitionParser.parseSessionFactory(GORMSessionFactoryDefinitionParser.java:188)
                  at org.codehaus.groovy.grails.orm.hibernate.cfg.GORMSessionFactoryDefinitionParser.parse(GORMSessionFactoryDefinitionParser.java:111)
                  at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:72)
                  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1327)
                  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1317)
                  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:134)
                  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:91)
                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:475)
                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:372)
                  ... 38 more
          2009-11-11 17:44:34,287 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path resource [annotation-test.xml]>
          

          which is this line here:

                          configClass = classLoader.loadClass(configClassName);
          

          Apparently the classLoader is null.

          final ClassLoader classLoader = parserContext.getReaderContext().getBeanClassLoader();
          

          must be returning null.

          Show
          Scott Murphy added a comment - Also, setting config-class="org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration" <gorm:sessionFactory base- package = "com.pictage.core" data-source-ref= "v4DataSource" message-source-ref= "messageSource" config-class= "org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration" > <property name= "hibernateProperties" > <util:map> <entry key= "hibernate.hbm2ddl.auto" value= "validate" /> <entry key= "hibernate.dialect" value= "org.hibernate.dialect.PostgreSQLDialect" /> <entry key= "hibernate.show_sql" value= " true " /> <entry key= "hibernate.format_sql" value= " true " /> </util:map> </property> </gorm:sessionFactory> I get a nullpointer exception: 2009-11-11 17:44:34,287 ERROR [org.springframework.test.context.TestContextManager] - <Caught exception while allowing TestExecutionListener [org.springframewor k.test.context.support.DependencyInjectionTestExecutionListener@1ea6ce9] to prepare test instance [com.pictage.core.listing.ListingTypeHibernateRepositoryTest@1 944b85]> java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:10 9) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:7 5) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:333) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 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:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [annotation-test.x ml]; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:394) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:316) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:284) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1) at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304) ... 28 more Caused by: java.lang.NullPointerException at org.codehaus.groovy.grails.orm.hibernate.cfg.GORMSessionFactoryDefinitionParser.lookupConfigClass(GORMSessionFactoryDefinitionParser.java:236) at org.codehaus.groovy.grails.orm.hibernate.cfg.GORMSessionFactoryDefinitionParser.parseSessionFactory(GORMSessionFactoryDefinitionParser.java:188) at org.codehaus.groovy.grails.orm.hibernate.cfg.GORMSessionFactoryDefinitionParser.parse(GORMSessionFactoryDefinitionParser.java:111) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:72) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1327) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1317) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:134) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:91) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:475) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:372) ... 38 more 2009-11-11 17:44:34,287 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path resource [annotation-test.xml]> which is this line here: configClass = classLoader.loadClass(configClassName); Apparently the classLoader is null. final ClassLoader classLoader = parserContext.getReaderContext().getBeanClassLoader(); must be returning null.
          Show
          Burt Beckwith added a comment - 1.3.2: http://github.com/grails/grails-core/commit/57cbaea41a1b37f3d3fb4131f97da25b70785a5a 1.2.3: http://github.com/grails/grails-core/commit/74ffe3361e266eb7c8519651ca90989f29f707a9

            People

            • Assignee:
              Burt Beckwith
              Reporter:
              Scott Murphy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development