Announcement Announcement Module
No announcement yet.
FileNotFoundException with hibernate and JBoss Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • FileNotFoundException with hibernate and JBoss

    I get the following exception from jboss when I start my app using hibernate. xception: Error creating bean with name 'hibernateTemplate' defined in ServletContext resource [/WEB-INF/SMSSpringBeans.xml]: Cannot resolve reference to b
    ean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in
    ServletContext resource [/WEB-INF/SMSSpringBeans.xml]: Invocation of init method failed; nested exception is class path resource [AggregatorJSON.hbm.xml] cannot be opened
    because it does not exist

    It does not matter where I put the files or the paths I put in the list items. Setting and unsetting the "mappingDirectoryLocations" property doesn't help either (or I don't know the secret sauce for it). Not having it produces the same result. Currently the xml files are in the WEB-INF directory with the spring xml file.

    I have the following configurations in my spring xml file.

    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
    <property name="sessionFactory" ref="sessionFactory" />

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mappingDirectoryLocations">
    <property name="mappingResources">

    Any help will be appreciated.


  • #2
    The answer to the unanswered question

    First I want to thank everyone for their lack of response to mine as well as the other similar questions going back a ways that I found.

    On the upside, I found the answer. For those who may be struggling with this issue, it can be solved with snowdrop from the jboss distribution ( Mind you of the three ways they show you can make use of snowdrop, the only one that worked for me was to use the snowdrop spring deployer and than build your <app>.spring deployment as they show. Of course, the default spring deployer does not have all that you need to access hibernate, but that can be solved by adding the appropriate spring jars to it.

    A couple additional thoughts, your spring definition xml file should be renamed to jboss-spring.xml and placed in the META-INF directory of your <app>.spring deployment. All of the other xml files that may be reference should be in the root directory of your <app>.spring deployment. Your classes should follow the standard class trees under the deployment's root directory as well.


    • #3
      And there's more! If you create a classes directory under the WEB-INF directory with your classes proplery pathed (com/tollgrade/package/...) you can then place the xml files you need in the classes directory and they will get found!

      The weekness of most programmers (I include myself in this statement) is that it is easier to build a tool to configure the monstrosities we create than to document them. It makes it hard for those of us who's IDE is a good programmers editor.