Jersey 2.26 Bean验证在WAR中工作,而在EJB中不工作

时间:2019-07-03 07:04:03

标签: maven websphere jersey-2.0 bean-validation

我有3个Maven项目:EAR = WAR + EJB

  • 球衣版本:2.26
  • Websphere应用程序服务器:8.5

    1. WAR在请求对象上可以正常使用剩余api和bean验证。我正在使用jersey-bean-validation。
    2. 然后,我将请求对象类移至EJB,并且验证停止工作。这很明显,因为EJB中不包含jersey-bean-validation。 当我在EJB的pom中包含jersey-bean-validation时,应用程序部署开始失败。错误如下:

java.lang.NoSuchMethodError:javax / ws / rs / core / Application.getProperties()Ljava / util / Map

stackstrace的一部分如下:

com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0271E: Uncaught init() exception
created by servlet [jersey-bean-validation-test-servlet] in application 
[jersey-bean-validation-test]:
java.lang.NoSuchMethodError: javax/ws/rs/core/Application.getProperties()Ljava/util/Map; 

(loaded from file:/<WAS85 location>/AppServer/plugins/javax.j2ee.jaxrs.jar
by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@4479d9e4)
called from class org.glassfish.jersey.server.ApplicationHandler 

(loaded from file:/<WAS85 location>/AppServer/profiles/AppSrv01/installedApps/VM122165
-FCNode04Cell/jersey-bean-validation-test.ear/jersey-bean-validation-test-web.war/WEB-INF
/lib/jersey-server-2.26.jar by 

com.ibm.ws.classloader.CompoundClassLoader@d08ed70a[war:jersey-bean-validation-test
/jersey-bean-validation-test-web.war]
Parent: com.ibm.ws.classloader.CompoundClassLoader@8a1ad3f5[PF]
[app:jersey-bean-validation-test]
   Delegation Mode: PARENT_LAST).
    at org.glassfish.jersey.server.ApplicationHandler.initialize
(ApplicationHandler.java:330)
    at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1
(ApplicationHandler.java:316)
.
.

Deployment.xml内容

<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi"
xmi:id="Deployment_155">

<deployedObject xmi:type="appdeployment:ApplicationDeployment"
xmi:id="ApplicationDeployment_155">

    <modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_155"
uri="jersey-bean-validation-test-web.war" classloaderMode="PARENT_LAST"/>
    <classloader xmi:id="Classloader_155" mode="PARENT_FIRST"/>

  </deployedObject>

</appdeployment:Deployment>

有人可以帮忙吗?预先感谢。

0 个答案:

没有答案