Announcement Announcement Module
Collapse
No announcement yet.
Loading hibernate mappings in Axis Archives (AAR) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loading hibernate mappings in Axis Archives (AAR)

    Has anyone been able to use Spring to load hibernate mapping files inside of an AAR? I followed the documentation on the Axis 2 website to initialize Spring, but I have not had any luck loading mapping files.

    The file structure of the AAR is the following:

    (prefixed with tomcat\webapps\axis2\WEB-INF\services\<myservice>)

    \applicationContext.xml
    \domain\TransferScenario.hbm.xml

    In applicationContext, I defined the following:

    <property name="mappingResources">
    <list>
    <value>domain/TransferScenario.hbm.xml</value>
    </list>
    </property>

    I am getting a FileNotFoundException when I fire up my service:

    Error: org.apache.axis2.deployment.DeploymentException: Processing Operations Modules with an error of Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.io.FileNotFoundException: class path resource [domain/TransferScenario.hbm.xml] cannot be opened because it does not exist at

  • #2
    So the problem is that the AAR (Axis archive) is not on the classpath and thus Spring classloader can't find the mapping files. What is the best way to get the files somewhere on the classpath so the Spring classloader can find them? One suggestion was to user real paths (i.e. c:/path/to/file/myfile.hbm.xml) and other solution was to put the mapping files in Tomcat/webapps/axis2/WEB-INF/classes/. The first solution is a non-starter and I'm not too keen on the second one either. Is there a better way to get these files on the classpath (perhaps as part of the deployment) so Spring can load them?

    Thanks.

    Comment


    • #3
      Packaging mapping files inside an AAR is a must in your project ?

      Comment


      • #4
        There are some guidelines about Hibernate files and running Spring inside AAR on Axis 2 site: http://ws.apache.org/axis2/1_2/spring.html#263

        Comment


        • #5
          I don't know if packaging hibernate files in the AAR is a must, but it's certainly a "nice to have". I got a simple example working by putting my Hibernate mapping files in a location outside of the AAR (in a place where Spring can find them), but it's gross... I was just wondering if anyone had any better ideas...

          Comment


          • #6
            Same issue, hibernate is not aware of the AAR classes and JARs

            I have exactly the same issue, I have been trial and error for some time now. Basically I have to put my Entity classes and mappings in Axis2/WEB-INF/lib . I also had to put all spring-hibernate3/spring-* jars in Axis2/WEB-INF/lib contrary to what they say on http://ws.apache.org/axis2/1_3/spring.html#263 .

            Its ugly, I hope a fix comes for this real soon. The good news is, atleast my Axis2 Spring service is now wired with Hibernate.

            Comment

            Working...
            X