我刚从glassfish切换到wildfly 9,我想使用Eclipselink,因为它是我之前使用的。我在C:\wildfly-9.0.2.Final\modules\system\layers\base\org\eclipse\persistence\main
文件夹中添加了eclipselink.jar。并做了以下
添加到module.xml:
<resource-root path="eclipselink.jar">
<filter>
<exclude path="javax/**" />
</filter>
persistence.xml中的:
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
错误:
16:53:17,021 WARN [org.jboss.modules] (ServerService Thread Pool -- 58) Failed to define class org.eclipse.persistence.jpa.rs.exceptions.JPARSExceptionMapper in Module "org.eclipse.persistence:main" from local module loader @45283ce2 (finder: local module finder @2077d4de (roots: C:\wildfly-9.0.2.Final\modules,C:\wildfly-9.0.2.Final\modules\system\layers\base)): java.lang.LinkageError: Failed to link org/eclipse/persistence/jpa/rs/exceptions/JPARSExceptionMapper (Module "org.eclipse.persistence:main" from local module loader @45283ce2 (finder: local module finder @2077d4de (roots: C:\wildfly-9.0.2.Final\modules,C:\wildfly-9.0.2.Final\modules\system\layers\base)))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:560)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
at org.eclipse.persistence.jpa.rs.service.JPARSApplication.<init>(JPARSApplication.java:65)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)
at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)
at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)
at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)
at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/ext/ExceptionMapper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432)
... 33 more
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.ext.ExceptionMapper from [Module "org.eclipse.persistence:main" from local module loader @45283ce2 (finder: local module finder @2077d4de (roots: C:\wildfly-9.0.2.Final\modules,C:\wildfly-9.0.2.Final\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 37 more
16:53:17,022 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 58) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./csbasement: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./csbasement: java.lang.RuntimeException: Failed to construct public org.eclipse.persistence.jpa.rs.service.JPARSApplication()
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.RuntimeException: Failed to construct public org.eclipse.persistence.jpa.rs.service.JPARSApplication()
at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:160)
at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211)
at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:295)
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:236)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)
at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)
at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
... 6 more
Caused by: java.lang.LinkageError: Failed to link org/eclipse/persistence/jpa/rs/exceptions/JPARSExceptionMapper (Module "org.eclipse.persistence:main" from local module loader @45283ce2 (finder: local module finder @2077d4de (roots: C:\wildfly-9.0.2.Final\modules,C:\wildfly-9.0.2.Final\modules\system\layers\base)))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:560)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
at org.eclipse.persistence.jpa.rs.service.JPARSApplication.<init>(JPARSApplication.java:65)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:148)
... 19 more
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/ext/ExceptionMapper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432)
... 33 more
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.ext.ExceptionMapper from [Module "org.eclipse.persistence:main" from local module loader @45283ce2 (finder: local module finder @2077d4de (roots: C:\wildfly-9.0.2.Final\modules,C:\wildfly-9.0.2.Final\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 37 more
16:53:17,031 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "csbasement.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./csbasement" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./csbasement: java.lang.RuntimeException: Failed to construct public org.eclipse.persistence.jpa.rs.service.JPARSApplication()
Caused by: java.lang.RuntimeException: Failed to construct public org.eclipse.persistence.jpa.rs.service.JPARSApplication()
Caused by: java.lang.LinkageError: Failed to link org/eclipse/persistence/jpa/rs/exceptions/JPARSExceptionMapper (Module \"org.eclipse.persistence:main\" from local module loader @45283ce2 (finder: local module finder @2077d4de (roots: C:\\wildfly-9.0.2.Final\\modules,C:\\wildfly-9.0.2.Final\\modules\\system\\layers\\base)))
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/ext/ExceptionMapper
答案 0 :(得分:11)
我添加了
<module name="javax.ws.rs.api"/>
在module.xml中,现在一切都很顺利。