Die*_*nci 6 java jboss wildfly
我正在尝试将我的spring应用程序从glassfish 4导出到JBoss wildfly 8.x或9 alpha,但是当我的应用程序在我的代码的某些部分启动时抛出异常:
Caused by: java.lang.RuntimeException: java.nio.file.FileSystemNotFoundException: Provider "vfs" not installed
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:218)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
Caused by: java.nio.file.FileSystemNotFoundException: Provider "vfs" not installed
at java.nio.file.Paths.get(Paths.java:147) [rt.jar:1.7.0_72]
at com.springmvcangular.backend.utils.entity.BaseEntityInitializer.extendsEntities(BaseEntityInitializer.java:123)
at com.springmvcangular.backend.utils.entity.BaseEntityInitializer.initializeBaseEntities(BaseEntityInitializer.java:88)
at com.springmvcangular.backend.config.ApplicationInitializer.onStartup(ApplicationInitializer.java:60)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:178)
... 7 more
Run Code Online (Sandbox Code Playgroud)
在我的班级BaseEntityInitializer中,我有以下例外情况:
packagepath = Paths.get(this.getClass().getClassLoader()
.getResource(path.replace('.', '/')).toURI());
Run Code Online (Sandbox Code Playgroud)
其中,path它的一个包路径一样com.something.model,为什么在我的GlassFish 4服务器这完美的作品和我需要在wildfly用呢?我不知道wildfly中缺少什么,或者我是否需要包含一些库.
它碰巧在 GlassFish 中起作用。无处的ClassLoader合同(或Java EE平台规范)是指定什么样的URL,你回来。在 GlassFish ClasLoder 中,它可能恰好是一个jar://或file://URL,恰好有一个 FileSystemProvider(jar://顺便说一句,只是偶然)。在 WildFly 中,它URL恰好是一个 JBoss VFS URL。您可以应用各种技巧来使其暂时工作,但它们都无法掩盖您依赖不可移植行为的事实。你最好使用类似的东西URL#openStream(),它是便携式的,因此应该可以在任何地方工作。
更新
您可以尝试做的是在编译时做更多的事情。选项包括:
ClassLoader#getResources(String)可以返回多个结果。如果您提供有关您要解决的问题的更具体的信息,我可能会给出更具体的答案。
| 归档时间: |
|
| 查看次数: |
4245 次 |
| 最近记录: |