0 Replies Latest reply on Mar 26, 2013 3:12 AM by k koushik

    Jboss 7 + HIbernate3 unable to deploy sar file File not  found exception

    k koushik Newbie

      Hi ,

      i am trying to migrate one of my application in to jboss 7 form jboss 4x.

      while configuring the hibernate, the hibernate api is unable to find the configuration and mapping files.

      i am maing use of full qualified name of the configuration file.

      the configuration and mapping files are present in the classpath.

      the following excaption is thrown

       

      Caused by: org.hibernate.MappingNotFoundException: resource: com/test/test1/dcm/model/model.cfg.xml not found

              at org.hibernate.cfg.Configuration.addResource(Configuration.java:563)

              at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)

              at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)

              at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)

              at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)

              at org.hibernate.cfg.Configuration.configure(Configuration.java:1443)

              at com.cisco.dcbu.dcm.service.ServiceInitHelper.getConnection(ServiceInitHelper.java:159)

       

      my deployement structure ie like below

       

      | deployments

           | servicembean.sar

                |com

                     |test classes...

                |META-INF

       

      Also i observed if i try to look for these resources by myclass.getClass().getclassloader().getresource(/com/...../model.cfg.xml)  i am able to get the appropriate URL value.

       

      howevere the statement   

      System.out.println("====>"+Environment.class.getResourceAsStream(/com/...../model.cfg.xml));  printing null value( Environment is hibernate api class"org.hibernate.cfg.Environment")

      looks like different classs loaders are being used .. not sure.Can any one please help to resolve this issue

      Thanks,