2 Replies Latest reply on Apr 6, 2011 10:16 PM by camilo casadiego

    Seam - Spring - Hibernate inteagration problem

    camilo casadiego Newbie

      HI there, its been already 8 hours i was triyong to find/understand fix a problem, but now im stuck in a dead end:

      The situation si the next...i have a seam generated project integrated with spring hibernate and jBPM, eveithings is fine but the packagesToScan atribute on AnnotationSessionFactoryBean doesn't work, i make a deep debug on the application, and the problem is that the class loader when called through method getClassLoader().getResources(path); return a resurce which points to a vfsfile protocol. so when the code gets into

      Enumeration resourceUrls = getClassLoader().getResources(path);

      with a correct PATH variable, it returns a

      [URL [vfsfile:******]]

      object....and the when the code gets back to spring ResourceUtils class, on method getFile its fails...because its specting a 'file' protocol instead of a vfsfile....

      Im really stuck with this...a triyed to put some of the anotated classes and it works fine ( but i cannot do it for all of them...is a migration project and are like 1000 or more domain objects...:s)

      Next i put the significant parts for my config files....


      <bean id="hibernateSessionFactory"
                      <property name="dataSource" ref="applicationDataSource" />
                      <property name="annotatedPackages">
                      <property name="packagesToScan">
                      <property name="hibernateProperties">
                      <!-- hibernate.hbm2ddl.auto=update -->
                      <property name="useTransactionAwareDataSource" value="false" />


      <!-- use the power of Spring transactions -->
                      config-locations="/WEB-INF/springConfig/springComponent.xml" />
                      platform-transaction-manager-name="localTransactionManager" />
                      name="hibernateSession" auto-create="true" session-factory="#{hibernateSessionFactory}" />

      appart from that...donw have anithing unusual...

      Pdta: Sorry for my bad typing...im really tired and a little bit desperate

        • 1. Re: Seam - Spring - Hibernate inteagration problem
          camilo casadiego Newbie

          jus in case...some debug info..

          when executing...

          while (resourceUrls.hasMoreElements()) {
                                  URL url = (URL) resourceUrls.nextElement();

          i came out with

          [URL [vfsfile:/C:/DEVELOPMENT/IDESWindows/jboss-5.1.0.GA/server/default/deploy/Salarix.war/WEB-INF/classes/valida/path]]

          but when we get to getFile method

          if (!URL_PROTOCOL_FILE.equals(resourceUrl.getProtocol())) {
                                  throw new FileNotFoundException(
                                                  description + " cannot be resolved to absolute file path " +
                                                  "because it does not reside in the file system: " + resourceUrl);

          whit vfsfile as protocol it crashes.....

          at the end im getting

          Cannot search for matching files underneath URL [vfsfile:/C:/DEVELOPMENT/IDESWindows/jboss-5.1.0.GA/server/default/deploy/Salarix.war/WEB-INF/classes/co/com/adv/salarix/advalorhum/] because it does not correspond to a directory in the file system

          just in case...im posting the same qeuestion in spring forums...

          • 2. Re: Seam - Spring - Hibernate inteagration problem
            camilo casadiego Newbie

            one last thing...

            java version "1.6.0_24"
            Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
            Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)