gpt4 book ai didi

java - 使用 Spring 4.0.2 作为 Jboss 7 模块时出现 ClassNotFoundException : org. jboss.vfs.VFS

转载 作者:行者123 更新时间:2023-11-30 03:54:57 25 4
gpt4 key购买 nike

我正在尝试使 Spring 4.0.2 作为 JBoss 7 模块运行。当我部署 war 文件时出现以下错误

Caused by: java.lang.IllegalStateException: Could not detect JBoss VFS infrastructure
at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:92) [spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
... 45 more
Caused by: java.lang.ClassNotFoundException: org.jboss.vfs.VFS from [Module "********:main" from local module loader @5ab785fe (finder: local module finder @46be1539 (roots: C:\jboss-as-7.2.0.Final\modules,C:\jboss-as-7.2.0.Final\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]
at org.springframework.core.io.VfsUtils.<clinit>(VfsUtils.java:69) [spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
... 45 more

我的 webappname-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="webappname"/>
</beans>

我的 spring.handlers 位于 META-INF 内,如果没有此文件,我会出现“攻击性资源...”错误

http\://www.springframework.org/schema/c=org.springframework.beans.factory.xml.SimpleConstructorNamespaceHandler
http\://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler
http\://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler
http\://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler
http\://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler
http\://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler
http\://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler
http\://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler

在 module.xml 文件中,我使用以下 jar

<resource-root path="spring-core-4.0.2.RELEASE.jar"/>
<resource-root path="spring-beans-4.0.2.RELEASE.jar"/>
<resource-root path="spring-context-4.0.2.RELEASE.jar"/>
<resource-root path="spring-web-4.0.2.RELEASE.jar"/>
<resource-root path="spring-webmvc-4.0.2.RELEASE.jar"/>

这个错误是因为我的设置还是 JBoss/Spring 的错误?如果我将 Spring 库放入 WEB-INF/lib 中,一切都会运行良好。

谢谢。

最佳答案

与 JBoss 5.1 EAP 一样,JBoss 7 似乎也在使用 VFS2。 org.jboss.vfs.VFS 类属于 VFS3。Spring Framework 4.x 不再支持 VFS2。您将在我的 GitHub 项目 https://github.com/arey/spring4-vfs2-support 上找到 Spring Framework 4.0 的 VFS2 向后移植。希望这对您有帮助,问候

关于java - 使用 Spring 4.0.2 作为 Jboss 7 模块时出现 ClassNotFoundException : org. jboss.vfs.VFS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23463808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com