Announcement Announcement Module
Collapse
No announcement yet.
hibernate mappings in with weblogic Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • hibernate mappings in with weblogic

    Weblogic is unable to find Hibernate mappings in classpath if .war is not unpacked. My bean context mapping:

    Code:
    <bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
          <property name="mappingDirectoryLocations">
            <list>
             <value>classpath&#58;/com/foo/contract/domain/common</value>
             <value>classpath&#58;/com/foo/contract/domain/proposal</value>
             <value>classpath&#58;/com/foo/contract/domain/rfp</value>
             <value>classpath&#58;/com/foo/contract/domain/template</value>
            </list>
          ...more...
    </bean>
    Does anyone know of alternative configuration that I can use that does not force me to unpack war file. Thanks in advance.


    P.S. Spring rocks.

  • #2
    WebLogic does not normally extract most of the contents of WAR files out to the filessytem, as it internally uses a Zip file url handler to get at stuff in the archives.

    Just use the mappingLocations property instead of the mappingDirectoryLocations you are trying to use, and point to the mapping files directly on your classpath (which means they should be on the classpath somewhere of course :-).

    Be careful as this param is a Resource, and the default ResourceEditor PropertyEditor which will convert for you from a String path name in the appcontext definition to the actual Resource will get you different results for unqualified names here depending on whether it is a web ApplicationContext variant, or just a simple AppContext variant like ClasspathXmlApplicationContext. In the former, simple path names are treated as file paths relative to the web app context root, while in the latter they considered to be classpath resources. If you always want the path treated as a classpath, just use a
    classpath:
    prefix.

    Comment

    Working...
    X