Jersey 试图获取我的客户端接口并从中创建一个服务器

Jersey tries to pick up my client interfaces and create a server from them

我正在将一个多模块应用程序从 Weblogic 10.3.6 移植到 12.2.1.2.0,我的一些模块有问题。这似乎与那些本身不提供 REST 服务但作为 REST 服务客户端的模块有关。在应用程序启动时,它们将在下面的堆栈跟踪中停止。

从堆栈跟踪中我们可以看出是 'org.glassfish.jersey.server.ApplicationHandler' 发出了错误。但是,我没有在这个模块中实现 REST 服务。它似乎通过 class 注释 @PATH 发现了客户端接口。如果我省略 class 注释,一切都会正常启动。那么我的客户端路径当然会缺少一些元素。有人知道如何防止 weblogic/jersey 这样做吗?

摘自我的一个界面:

@Path("/v1/batch")
@Produces(BatchJobRestService.JSON)
@Consumes(BatchJobRestService.JSON)
public interface BatchJobRestService {
    String JSON = MediaType.APPLICATION_JSON + ";charset=utf-8";

    @GET
    @Path("runAffectedMunicipalities")
    boolean runAffectedMunicipalities();

堆栈跟踪:

Caused By: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
[[HINT] A HTTP GET method, public abstract void no.xxxxxxxxx.yyyy.location_ng.api.BatchJobRestService.setMunicipalitiesSimplifiedGeometriesDryRun(boolean), returns a void type. It can be intentional and perfectly fine, but it is a little uncommon that GET method returns always "204 No Content".; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.BatchJobRestService, handlerConstructors=[]}, definitionMethod=public abstract void no.xxxxxxxxx.yyyy.location_ng.api.BatchJobRestService.setMunicipalitiesSimplifiedGeometriesDryRun(boolean), parameters=[Parameter [type=boolean, source=dryRun, defaultValue=null]], responseType=void}, nameBindings=[]}', [HINT] A HTTP GET method, public abstract void no.xxxxxxxxx.yyyy.location_ng.api.BatchJobRestService.setCountiesSimplifiedGeometriesDryRun(boolean), returns a void type. It can be intentional and perfectly fine, but it is a little uncommon that GET method returns always "204 No Content".; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.BatchJobRestService, handlerConstructors=[]}, definitionMethod=public abstract void no.xxxxxxxxx.yyyy.location_ng.api.BatchJobRestService.setCountiesSimplifiedGeometriesDryRun(boolean), parameters=[Parameter [type=boolean, source=dryRun, defaultValue=null]], responseType=void}, nameBindings=[]}', [FATAL] No injection source found for a parameter of type public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findRoadReferenceAndGeometryForPlace(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadType,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService, handlerConstructors=[]}, definitionMethod=public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findRoadReferenceAndGeometryForPlace(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadType,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId), parameters=[Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=id, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory, source=roadCategory, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber, source=roadNumber, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadType, source=roadType, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId, source=county, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId, source=municipality, defaultValue=null]], responseType=java.util.List<no.xxxxxxxxx.yyyy.location_ng.model.RoadReferenceAndGeometry>}, nameBindings=[]}', [FATAL] No injection source found for a parameter of type public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findRoadDirections(no.xxxxxxxxx.yyyy.location_
ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadType,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,java.math.BigDecimal,java.math.BigDecimal,java.math.BigDecimal,java.math.BigDecimal,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId) at index 9.; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService, handlerConstructors=[]}, definitionMethod=public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findRoadDirections(no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadType,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,java.math.BigDecimal,java.math.BigDecimal,java.math.BigDecimal,java.math.BigDecimal,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId), parameters=[Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory, source=road-category, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber, source=road-number, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadType, source=road-type, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId, source=county, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId, source=municipality, defaultValue=null], Parameter [type=class java.math.BigDecimal, source=easting-from, defaultValue=null], Parameter [type=class java.math.BigDecimal, source=northing-from, defaultValue=null], Parameter [type=class java.math.BigDecimal, source=easting-to, defaultValue=null], Parameter [type=class java.math.BigDecimal, source=northing-to, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=place-id-from, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=place-id-to, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=place-public-id-from, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=place-public-id-to, defaultValue=null]], responseType=java.util.List<no.xxxxxxxxx.yyyy.location_ng.model.location.Direction>}, nameBindings=[]}', [WARNING] Return type, java.util.List<no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference<? extends no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId>>, of method, public abstract java.util.List<no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference<? extends no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId>> no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlaceReferences(no.xxxxxxxxx.yyyy.location_ng.model.id.RegionId,java.util.Set<no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory>,java.util.Set<no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber>,java.util.Set<no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadType>,java.util.Set<no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId>,java.util.Set<no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId>,java.lang.String,boolean), is not resolvable to a concrete type.; source='public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlaceReferences(no.xxxxxxxxx.yyyy.location_ng.model.id.RegionId,java.util.Set,java.util.Set,java.util.Set,java.util.Set,java.util.Set,
java.lang.String,boolean)', [FATAL] No injection source found for a parameter of type public abstract no.xxxxxxxxx.yyyy.location_ng.model.place.PlaceOrig no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlacesFull(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService, handlerConstructors=[]}, definitionMethod=public abstract no.xxxxxxxxx.yyyy.location_ng.model.place.PlaceOrig no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlacesFull(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId), parameters=[Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=id, defaultValue=null]], responseType=class no.xxxxxxxxx.yyyy.location_ng.model.place.PlaceOrig}, nameBindings=[]}', [FATAL] No injection source found for a parameter of type public abstract no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlace(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService, handlerConstructors=[]}, definitionMethod=public abstract no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlace(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId), parameters=[Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=id, defaultValue=null]], responseType=no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference<? extends no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId>}, nameBindings=[]}', [WARNING] Return type, no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference<? extends no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId>, of method, public abstract no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference<? extends no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId> no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlace(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId), is not resolvable to a concrete type.; source='public abstract no.xxxxxxxxx.yyyy.location_ng.model.placereference.PlaceReference no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlace(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId)', [FATAL] No injection source found for a parameter of type public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlacePublicFromList(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,java.lang.Double,java.lang.Double,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,java.lang.Double,java.lang.Double,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,boolean) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService, handlerConstructors=[]}, definitionMethod=public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlacePublicFromList(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,java.lang.Double,java.lang.Double,no.
xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,java.lang.Double,java.lang.Double,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,boolean), parameters=[Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=id, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId, source=municipalityId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId, source=countyId, defaultValue=null], Parameter [type=class java.lang.Double, source=easting, defaultValue=null], Parameter [type=class java.lang.Double, source=northing, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId, source=municipalityIdTo, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId, source=countyIdTo, defaultValue=null], Parameter [type=class java.lang.Double, source=eastingTo, defaultValue=null], Parameter [type=class java.lang.Double, source=northingTo, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory, source=roadCategory, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber, source=roadNumber, defaultValue=null], Parameter [type=boolean, source=extended, defaultValue=null]], responseType=java.util.List<no.xxxxxxxxx.yyyy.location_ng.model.location.PlacePublic>}, nameBindings=[]}', [FATAL] No injection source found for a parameter of type public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlacePublicToList(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,java.lang.Double,java.lang.Double,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,boolean) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[application/json;charset=utf-8], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService, handlerConstructors=[]}, definitionMethod=public abstract java.util.List no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.findPlacePublicToList(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,java.lang.Double,java.lang.Double,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,boolean), parameters=[Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=id, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=placePublicFromId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId, source=municipalityId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId, source=countyId, defaultValue=null], Parameter [type=class java.lang.Double, source=easting, defaultValue=null], Parameter [type=class java.lang.Double, source=northing, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory, source=roadCategory, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber, source=roadNumber, defaultValue=null], Parameter [type=boolean, source=extended, defaultValue=null]], responseType=java.util.List<no.xxxxxxxxx.yyyy.location_ng.model.location.PlacePublic>}, nameBindings=[]}', [FATAL] No injection source found for a parameter of type public abstract java.lang.String no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.buildMapRequest(no.xxxxxxxxx.yyyy.location_ng.model.id.
PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,no.xxxxxxxxx.yyyy.location_ng.model.id.RegionId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[application/json;charset=utf-8], producedTypes=[text/plain], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=interface no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService, handlerConstructors=[]}, definitionMethod=public abstract java.lang.String no.xxxxxxxxx.yyyy.location_ng.api.RoadDataRestService.buildMapRequest(no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId,no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory,no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber,no.xxxxxxxxx.yyyy.location_ng.model.id.RegionId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId,no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId), parameters=[Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=fromPlaceId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.PlaceId, source=toPlaceId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.enums.RoadCategory, source=roadCategory, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.RoadNumber, source=roadNumber, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.RegionId, source=regionId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId, source=fromMunicipalityId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.MunicipalityId, source=toMunicipalityId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId, source=fromCountyId, defaultValue=null], Parameter [type=class no.xxxxxxxxx.yyyy.location_ng.model.id.CountyId, source=toCountyId, defaultValue=null]], responseType=class java.lang.String}, nameBindings=[]}']
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:555)
        at org.glassfish.jersey.server.ApplicationHandler.access0(ApplicationHandler.java:184)
        at org.glassfish.jersey.server.ApplicationHandler.call(ApplicationHandler.java:350)
        at org.glassfish.jersey.server.ApplicationHandler.call(ApplicationHandler.java:347)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
        at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:390)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:172)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:364)
        at javax.servlet.GenericServlet.init(GenericServlet.java:244)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:343)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:294)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
        at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
        at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
        at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:99)
        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:87)
        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:71)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:57)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:31)
        at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:673)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:612)
        at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2054)
        at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:2031)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1920)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3091)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1823)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:882)
        at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
        at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
        at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
        at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233)
        at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:78)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:52)
        at weblogic.application.internal.BaseDeployment.next(BaseDeployment.java:750)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:260)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:66)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:90)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:627)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:171)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:121)
        at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:151)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:347)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:901)
        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1456)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:456)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:181)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:217)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access0(DeploymentReceiverCallbackDeliverer.java:14)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.run(DeploymentReceiverCallbackDeliverer.java:69)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
        at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
        at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
        at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
        at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
        at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
> 

我不得不抛出两个咒语来解决这个问题。首先添加这个资源配置:

import org.glassfish.jersey.CommonProperties;
import org.glassfish.jersey.server.ResourceConfig;
import javax.ws.rs.ApplicationPath;

@ApplicationPath("/")
public class ServerAutoDiscoveryDisableResourceConfig extends ResourceConfig {
    {
        property(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE_SERVER, true);
    }
}

... 然后我还必须将 web.xml 版本从 2.5 降低到 2.4:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    ...
</web-app>

更新

我发现起作用的不是 属性,而是用 ApplicationPath 注释启动的空 REST 服务。然而,我发现使用根路径(“/”)并不是一个好主意,因为它会影响所有其他优先级较低的 servlet。相反,我使用了“/虚拟”路径:

import org.glassfish.jersey.server.ResourceConfig;
import javax.ws.rs.ApplicationPath;

@ApplicationPath("/dummy")
public class ServerAutoDiscoveryDisableResourceConfig extends ResourceConfig {
}