0 Replies Latest reply on Mar 14, 2012 3:39 AM by Mansi Shah

    Hibernate mapping xml files not loaded when migrating from Jboss 4.2.3 to Jboss 5.1

    Mansi Shah Newbie

      Hi,

       

      We are in the process of migrating Jboss 4.2.3 to Jboss 5.1 and have run into problems with loading the hibernate xml files.

       

      The exception is:

      org.springframework.orm.hibernate3.HibernateSystemException: Named query not known: mercer.urlalias.getAllDomainRedirect; nested exception is org.hibernate.MappingException: Named query not known: mercer.urlalias.getAllDomainRedirect

              at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)

              at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)

              at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)

              at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)

              at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:979)

              at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:971)

              at com.mercer.app.persistentservice.urlaliaspersistentservice.urlaliasdao.URLAliasDAO.retrieveData(URLAliasDAO.java:44)

              at com.mercer.app.businessmodel.urlaliasbo.URLAliasBO.fetchAllDomainRedirects(URLAliasBO.java:133)

              at com.mercer.mbean.URLAliasService.buildDomainRedirectTable(URLAliasService.java:163)

              at com.mercer.mbean.URLAliasService.startService(URLAliasService.java:330)

              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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

              at org.springframework.jmx.export.MBeanExporter.autodetect(MBeanExporter.java:880)

              at org.springframework.jmx.export.MBeanExporter.autodetectMBeans(MBeanExporter.java:854)

              at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:516)

              at org.springframework.jmx.export.MBeanExporter.afterPropertiesSet(MBeanExporter.java:413)

            ...

       

       

      The structure or the EAR is as follows:

       

      mercerhr.ear

           |

           -- mercer.war

           |               |

           |               -- META-INF

           |                         |

           |                         -- com (hibernate resource files under this directory)    

           |                            |

           -- META-INF           -- manifest.mf

                            

       

      The entries in the applicationContext-db.xml (which forms as the hibernate configuration xml, located at mercerhr.ear/mercer.war/WEB-INF) for our application are as follows:

      <property name="mappingLocations">

                  <list>

                      <value>classpath*:META-INF/com/mercer/userprofile/*.hbm.xml</value>

                      <value>classpath*:META-INF/com/mercer/content/*.hbm.xml</value>

                      <value>classpath*:META-INF/com/mercer/product/*.hbm.xml</value>

                      <value>classpath*:META-INF/com/mercer/order/*.hbm.xml</value>

                      <value>classpath*:META-INF/com/mercer/lookup/*.hbm.xml</value>

                      <value>classpath*:META-INF/com/mercer/ukalumni/*.hbm.xml</value>

                      <!-- Innovation 03: Podcast: START -->

                      <value>classpath*:META-INF/com/mercer/podcast/*.hbm.xml</value>               

                      <!-- Innovation 03: Podcast: END -->

                      <!-- MercerPoll: START -->

                      <value>classpath*:META-INF/com/mercer/mercerpoll/*.hbm.xml</value>               

                      <!-- MercerPoll: END -->

                 

                      <value>classpath*:META-INF/com/mercer/userlog/AttachmentDownloadContentDetailProc.hbm.xml</value>

                      <value>classpath*:META-INF/com/mercer/userlog/AttachmentDownloadUserDetailProc.hbm.xml</value>

                      <value>classpath*:META-INF/com/mercer/userlog/MHRUserLogStoredProc.hbm.xml</value>   

                     

                  </list>

              </property>

       

       

      This structure was working fine for jboss 4.2.3 but leads to the exception above on Jboss 5.1. I tried to move the hbm files to mercer.war/WEB-INF/classes/resources/com/.. and the hibernate mapping xmls are then loading fine. 

      Could someone please help me with setting up the classpath for Jboss so that the ../mercer.war/META-INF folder gets added into the classpath.

       

      Any responses or pointers will be greatly appreiciated.