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....


      springContext.xml


      <bean id="hibernateSessionFactory"
                      class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
                      <property name="dataSource" ref="applicationDataSource" />
                      <property name="annotatedPackages">
                              <list>
                                      <value>co.com.adv.salarix.auditoria.domain</value>
                              </list>
                      </property>
                      
                      
                      <property name="packagesToScan">
                              <list>
                                      <value>co.com.adv.salarix.advalorhum.domain</value>
                                      <value>co.com.adv.salarix.interfaces.domain</value>
                                      <value>co.com.adv.salarix.parametrizacion.domain</value>
                              </list>
                      </property>
                      <property name="hibernateProperties">
                              <value>
                                      hibernate.dialect=${hibernate.dialect}
                                      hibernate.show_sql=${hibernate.show_sql}
                                      hibernate.transaction.flush_before_completion=true
                                      hibernate.connection.release_mode=after_transaction
                                      hibernate.cache.use_second_level_cache=true
                                      hibernate.cache.use_second_level_cache=true
                                      hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
                              </value>
                      </property>
                      <!-- hibernate.hbm2ddl.auto=update -->
                      <property name="useTransactionAwareDataSource" value="false" />
      



      componets.xml


      <!-- use the power of Spring transactions -->
              <spring:context-loader
                      config-locations="/WEB-INF/springConfig/springComponent.xml" />
                      
              <spring:spring-transaction
                      platform-transaction-manager-name="localTransactionManager" />
      
              <persistence:managed-hibernate-session
                      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();
                                  result.add(convertClassLoaderURL(url));
                          }
          



          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...


            jboss-5.1.0.GA
            jboss-seam-2.2.1.Final
            
            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)