我们正在尝试将测试REST Web服务启动并运行,并将其部署到Caucho Resin 4.0的Jersey 2.29.1。
但是我们似乎与Resin的内置CDI实现发生冲突。
当我们尝试在没有CDI实现的情况下部署Jersey时,会出现以下错误:
[19-12-05 14:47:36.420] {resin-32} java.lang.IllegalStateException: InjectionMan
agerFactory not found.
at org.glassfish.jersey.internal.inject.Injections.lambd
a$lookupInjectionManagerFactory$0(Injections.java:74)
at java.util.Optional.orElseThrow(Optional.java:290)
at org.glassfish.jersey.internal.inject.Injections.looku
pInjectionManagerFactory(Injections.java:74)
at org.glassfish.jersey.internal.inject.Injections.creat
eInjectionManager(Injections.java:69)
at org.glassfish.jersey.server.ApplicationHandler.<init>
(ApplicationHandler.java:259)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebC
omponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(Se
rvletContainer.java:154)
at org.glassfish.jersey.servlet.ServletContainer.init(Se
rvletContainer.java:346)
at javax.servlet.GenericServlet.init(GenericServlet.java
:70)
at com.caucho.server.dispatch.ServletConfigImpl.createSe
rvletImpl(ServletConfigImpl.java:1376)
at com.caucho.server.dispatch.ServletConfigImpl.createSe
rvlet(ServletConfigImpl.java:1272)
at com.caucho.server.dispatch.ServletConfigImpl.createSe
rvlet(ServletConfigImpl.java:1223)
at com.caucho.server.dispatch.ServletManager.init(Servle
tManager.java:252)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java
:3892)
at com.caucho.server.webapp.WebApp.access$700(WebApp.jav
a:209)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebAp
p.java:5451)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThr
ead2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.
java:118)
[19-12-05 14:47:36.423] {resin-32} WebApp[production/webapp/default/jersey] fail
当我们尝试使用Weld CDI实施部署Jersey时,会出现以下错误:
[19-12-05 15:28:02.433] {resin-30} org.jboss.weld.exceptions.IllegalStateExcepti
on: WELD-000144: CDI API version mismatch. CDI 1.0 API detected on classpath. We
ld requires version 1.1 or better.
at org.jboss.weld.bootstrap.WeldStartup.checkApiVersion(
WeldStartup.java:257)
at org.jboss.weld.bootstrap.WeldStartup.startContainer(W
eldStartup.java:170)
at org.jboss.weld.bootstrap.WeldBootstrap.startContainer
(WeldBootstrap.java:69)
at org.jboss.weld.environment.se.Weld.initialize(Weld.ja
va:764)
at org.jboss.weld.environment.se.Weld.initialize(Weld.ja
va:174)
at org.glassfish.jersey.inject.cdi.se.CdiSeInjectionMana
ger.completeRegistration(CdiSeInjectionManager.java:241)
at org.glassfish.jersey.server.ApplicationHandler.initia
lize(ApplicationHandler.java:347)
at org.glassfish.jersey.server.ApplicationHandler.lambda
$initialize$1(ApplicationHandler.java:293)
at org.glassfish.jersey.internal.Errors.process(Errors.j
ava:292)
at org.glassfish.jersey.internal.Errors.process(Errors.j
ava:274)
at org.glassfish.jersey.internal.Errors.processWithExcep
tion(Errors.java:232)
at org.glassfish.jersey.server.ApplicationHandler.initia
lize(ApplicationHandler.java:292)
at org.glassfish.jersey.server.ApplicationHandler.<init>
(ApplicationHandler.java:259)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebC
omponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(Se
rvletContainer.java:154)
at org.glassfish.jersey.servlet.ServletContainer.init(Se
rvletContainer.java:346)
at javax.servlet.GenericServlet.init(GenericServlet.java
:70)
at com.caucho.server.dispatch.ServletConfigImpl.createSe
rvletImpl(ServletConfigImpl.java:1376)
at com.caucho.server.dispatch.ServletConfigImpl.createSe
rvlet(ServletConfigImpl.java:1272)
at com.caucho.server.dispatch.ServletConfigImpl.createSe
rvlet(ServletConfigImpl.java:1223)
at com.caucho.server.dispatch.ServletManager.init(Servle
tManager.java:252)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java
:3892)
at com.caucho.server.webapp.WebApp.access$700(WebApp.jav
a:209)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebAp
p.java:5451)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThr
ead2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.
java:118)
[19-12-05 15:28:02.435] {resin-30} WebApp[production/webapp/default/jersey] fail
有什么方法可以使Jersey 2.x与Resin一起使用? 我可以以某种方式禁用内置的CDI实现吗? 还是可以让Jersey配合使用?