【问题标题】:jboss deployment errorjboss部署错误
【发布时间】:2011-04-28 10:50:27
【问题描述】:

我在 jboss 上部署 spring 项目时遇到问题。
好吧,问题来了,我在文件 applicationContext.xml 中有这个 bean 定义

<bean id="sessionFactory" 
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
<property name="dataSource"> 
    <ref local="dataSource"/>
</property> 
<property name="mappingDirectoryLocations"> 
    <list> 
    <value> 
        classpath:tn/com/zuro/ris/domain/hibernate/hbm/
    </value> 
    </list> 
</property> 

 ...

我在目录类路径中有 Patient.hbm.xml 文件:tn/com/zuro/ris/domain/hibernate/hbm 当我在 jboss 中部署战争时,我得到了这个错误

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [tn/com/zuro/ris/domain/hibernate/hbm/] cannot be resolved to absolute file path because it does not reside in the file system: vfsfile:/C:/jboss/server/default/deploy/war-1.0-SNAPSHOT.war/WEB-INF/classes/tn/com/zuro/ris/domain/hibernate/hbm/

【问题讨论】:

    标签: java hibernate spring jboss


    【解决方案1】:
    • 检查您是否真的有所需的路径并在那里有 hbm 映射
    • 尝试删除尾部斜杠(示例中没有,应该是有问题但尝试)
    • 检查目录的权限

    【讨论】:

    • 我在 C:/jboss/server/default/deploy/war-1.0-SNAPSHOT.war/WEB-INF/classes/tn/com/zuro/ris/domain/hibernate 中有 hbm 映射/hbm,我尝试删除斜杠,问题仍然存在
    【解决方案2】:

    如果您使用的是 Spring 2.5.x,您可能会遇到这个问题:

    https://jira.springsource.org/browse/SPR-5120

    基本上,Spring 需要针对类路径扫描的协议特定支持,并且无法处理 JBoss 的 vfsfile-protocol 以访问其虚拟文件系统。

    【讨论】:

    • 我该如何解决?我应该使用 spring 3.0.x?
    猜你喜欢
    • 2013-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-21
    • 2013-04-04
    • 2018-12-07
    • 2015-08-07
    • 2017-02-20
    相关资源
    最近更新 更多