Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServletHttpHandlerAdapter @WebServlet annotation attributes do not conform to servlet spec [SPR-16591] #21133

Closed
spring-projects-issues opened this issue Mar 14, 2018 · 7 comments
Assignees
Labels
in: web type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 14, 2018

zyro opened SPR-16591 and commented

trying to deploy a spring-5 web-app (servlet/war) to weblogic 12c (12.2.1.2) fails during the validation phase (prior to the actual application start) with:

Either the urlPatterns or the value attribute in the WebServlet annotation MUST be present: org.springframework.http.server.reactive.ServletHttpHandlerAdapter.

unfortunately, i think weblogic may be right because it seems the annotation @WebServlet(asyncSupported = true) without a value or urlPatterns attribute does not conform to the servlet spec (3.0, 3.1, 4.0):

The urlPatterns or the value attribute on the annotation MUST be present.

offending occurrences:

environment: win x64, oracle jdk8u151, weblogic 12c 12.2.1.2, spring-boot-2.0.0.RELEASE, spring-web-5.0.4.

console output:

<Error> <HTTP> <BEA-101371> <There was a failure when processing annotations for application /path/to/my/app/src/main/webapp. Ensure that the annotations are valid. The error is 

There are 3 nested errors:

weblogic.j2ee.dd.xml.AnnotationProcessException: [HTTP:101396]Either the urlPatterns or the value attribute in the WebServlet annotation MUST be present: org.springframework.http.server.reactive.JettyHttpHandlerAdapter.
	at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1489)
	at weblogic.servlet.internal.WebAnnotationProcessor.validateValueAndUrlPatterns(WebAnnotationProcessor.java:181)
	at weblogic.servlet.internal.WebAnnotationProcessor.processWebServletAnnotation(WebAnnotationProcessor.java:137)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationForClasses(AnnotationProcessingManager.java:192)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:145)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationsOutsideWebFragment(AnnotationProcessingManager.java:173)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:130)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:105)
	at weblogic.servlet.internal.WebAppModule.processAnnotations(WebAppModule.java:1975)
	at weblogic.servlet.internal.WebAppModule.processAnnotations(WebAppModule.java:1937)
	at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:800)
	at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:295)
	at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
	at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
	at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
	at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
	at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
	at weblogic.application.utils.StateMachineDriver.nextStateInParallel(StateMachineDriver.java:144)
	at weblogic.application.internal.flow.ModuleStateDriver.parallelPrepare(ModuleStateDriver.java:46)
	at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:75)
	at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:55)
	at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:727)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:239)
	at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:66)
	at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
	at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:229)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:103)
	at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:241)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:794)
	at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1340)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:267)
	at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:177)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:186)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:14)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:47)
	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)

and

weblogic.j2ee.dd.xml.AnnotationProcessException: [HTTP:101396]Either the urlPatterns or the value attribute in the WebServlet annotation MUST be present: org.springframework.http.server.reactive.ServletHttpHandlerAdapter.
	at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1489)
	at weblogic.servlet.internal.WebAnnotationProcessor.validateValueAndUrlPatterns(WebAnnotationProcessor.java:181)
	at weblogic.servlet.internal.WebAnnotationProcessor.processWebServletAnnotation(WebAnnotationProcessor.java:137)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationForClasses(AnnotationProcessingManager.java:192)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:145)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationsOutsideWebFragment(AnnotationProcessingManager.java:173)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:130)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:105)
	at weblogic.servlet.internal.WebAppModule.processAnnotations(WebAppModule.java:1975)
	at weblogic.servlet.internal.WebAppModule.processAnnotations(WebAppModule.java:1937)
	at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:800)
	at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:295)
	at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
	at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
	at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
	at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
	at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
	at weblogic.application.utils.StateMachineDriver.nextStateInParallel(StateMachineDriver.java:144)
	at weblogic.application.internal.flow.ModuleStateDriver.parallelPrepare(ModuleStateDriver.java:46)
	at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:75)
	at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:55)
	at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:727)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:239)
	at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:66)
	at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
	at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:229)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:103)
	at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:241)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:794)
	at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1340)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:267)
	at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:177)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:186)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:14)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:47)
	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)

and

weblogic.j2ee.dd.xml.AnnotationProcessException: [HTTP:101396]Either the urlPatterns or the value attribute in the WebServlet annotation MUST be present: org.springframework.http.server.reactive.TomcatHttpHandlerAdapter.
	at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.addProcessingError(BaseJ2eeAnnotationProcessor.java:1489)
	at weblogic.servlet.internal.WebAnnotationProcessor.validateValueAndUrlPatterns(WebAnnotationProcessor.java:181)
	at weblogic.servlet.internal.WebAnnotationProcessor.processWebServletAnnotation(WebAnnotationProcessor.java:137)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationForClasses(AnnotationProcessingManager.java:192)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:145)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationsOutsideWebFragment(AnnotationProcessingManager.java:173)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:130)
	at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:105)
	at weblogic.servlet.internal.WebAppModule.processAnnotations(WebAppModule.java:1975)
	at weblogic.servlet.internal.WebAppModule.processAnnotations(WebAppModule.java:1937)
	at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:800)
	at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:295)
	at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
	at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
	at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
	at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
	at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
	at weblogic.application.utils.StateMachineDriver.nextStateInParallel(StateMachineDriver.java:144)
	at weblogic.application.internal.flow.ModuleStateDriver.parallelPrepare(ModuleStateDriver.java:46)
	at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:75)
	at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:55)
	at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:727)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:239)
	at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:66)
	at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
	at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:229)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:103)
	at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:241)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:794)
	at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1340)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:267)
	at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:177)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:186)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:14)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:47)
	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)

i hope i am not missing something - would not be surprised if weblogic is the culprit..

thank you!


Affects: 5.0.4

Referenced from: commits 7de2650

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 14, 2018

Rossen Stoyanchev commented

Interesting, actually the expected way to deploy this is through AbstractReactiveWebInitializer which uses programmatic registration to do all that's necessary. So as far as I can see that annotation is a left-over that's not even needed.

Can you confirm if you're using AbstractReactiveWebInitializer to deploy, and if not could you see if using it helps?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 14, 2018

Rossen Stoyanchev commented

I'm scheduling for a fix in 5.0.5 since in the very least we should drop that annotation.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 14, 2018

Juergen Hoeller commented

It looks like we meant to enforce asyncSupported = true there... for use outside of AbstractReactiveWebInitializer. Is an explicit setAsyncSupported(true) call necessary for async enabling through programmatic registration in any case since @WebServlet would get ignored in any such scenario?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 14, 2018

Rossen Stoyanchev commented

I think the annotation came from very early days, before the initializer was available. We could of course add a default mapping of "/" on the annotation, although I'm not sure how that would interact with use of the initializer which allows overriding the mapping. I'm wondering why not always expect use of the initializer? This is what we do for the DispatcherServlet as well.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 14, 2018

Juergen Hoeller commented

Agreed, let's simply drop the annotation then.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 14, 2018

Rossen Stoyanchev commented

It looks like Boot needs to change in parallel though. I've opened spring-projects/spring-boot#12486 to discuss.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 16, 2018

zyro commented

i can confirm the fix on weblogic 12c. the same deployment now works with 5.0.5.BUILD-SNAPSHOT just fine. thanks again for the immediate help - much appreciated!

@spring-projects-issues spring-projects-issues added type: bug in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.5 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web type: bug
Projects
None yet
Development

No branches or pull requests

2 participants