ops4j / org.ops4j.pax.web

OSGi R7 Http Service, Whiteboard and Web Applications (OSGi CMPN Release chapters 102, 140 and 128) implementation using Jetty 9, Tomcat 9 or Undertow 2.
https://ops4j1.jira.com/wiki/display/paxweb/Pax+Web
Other
146 stars 184 forks source link

WARN: Failed to find annotated classes for ServletContainerInitializer [PAXWEB-1132] #1338

Closed ops4j-issues closed 7 years ago

ops4j-issues commented 7 years ago

Amichai Rothman created PAXWEB-1132

In Karaf 4.1.2, the following is shown in the log:

2017-10-23T10:39:21,398 | WARN | paxweb-extender-1-thread-1 | ServletContainerInitializerScanner | 255 - org.ops4j.pax.web.pax-web-api - 6.0.6 | Failed to find annotated classes for ServletContainerInitializer
java.lang.RuntimeException: null
at org.objectweb.asm.MethodVisitor.visitParameter(Unknown Source) ~[?:?]
at org.objectweb.asm.ClassReader.b(Unknown Source) ~[?:?]
at org.objectweb.asm.ClassReader.accept(Unknown Source) ~[?:?]
at org.objectweb.asm.ClassReader.accept(Unknown Source) ~[?:?]
at org.apache.xbean.finder.AbstractFinder.readClassDef(AbstractFinder.java:581) ~[?:?]
at org.apache.xbean.finder.BundleAnnotationFinder$AnnotationFindingCallback.foundInDirectory(BundleAnnotationFinder.java:86) ~[?:?]
at org.apache.xbean.osgi.bundle.util.BundleResourceFinder.scanDirectory(BundleResourceFinder.java:151) ~[?:?]
at org.apache.xbean.osgi.bundle.util.BundleResourceFinder.scanBundleClassPath(BundleResourceFinder.java:132) ~[?:?]
at org.apache.xbean.osgi.bundle.util.BundleResourceFinder.find(BundleResourceFinder.java:88) ~[?:?]
at org.apache.xbean.finder.BundleAnnotationFinder.<init>(BundleAnnotationFinder.java:56) ~[?:?]
at org.apache.xbean.finder.BundleAnnotationFinder.<init>(BundleAnnotationFinder.java:50) ~[?:?]
at org.apache.xbean.finder.BundleAnnotationFinder.<init>(BundleAnnotationFinder.java:46) ~[?:?]
at org.ops4j.pax.web.utils.ServletContainerInitializerScanner.scanBundles(ServletContainerInitializerScanner.java:107) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.addContext(JettyServerWrapper.java:284) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.getOrCreateContext(JettyServerWrapper.java:209) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.JettyServerImpl.getContext(JettyServerImpl.java:283) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl$Started.getContext(ServerControllerImpl.java:346) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.getContext(ServerControllerImpl.java:175) ~[?:?]
at org.ops4j.pax.web.service.internal.HttpServiceStarted.begin(HttpServiceStarted.java:1187) ~[?:?]
at org.ops4j.pax.web.service.internal.HttpServiceProxy.begin(HttpServiceProxy.java:440) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit(RegisterWebAppVisitorWC.java:176) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:619) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.register(WebAppPublisher.java:228) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:173) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:129) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:98) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.WebObserver.deploy(WebObserver.java:217) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.WebObserver$1.doStart(WebObserver.java:172) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.extender.SimpleExtension.start(SimpleExtension.java:59) ~[?:?]
at org.ops4j.pax.web.extender.war.internal.extender.AbstractExtender.lambda$createExtension$0(AbstractExtender.java:277) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

Although it's a WARN, it's not clear if or how this affects the application runtime. Showing the full stack trace makes it look serious. I would suggest either changing the log level, or removing the full stack trace, or displaying a more informative message... whatever is appropriate in this condition. As it currently is it gets users to spend time investigating it, but without any clear resolution.


Affects: 6.0.6 Fixed in: 6.1.0, 6.0.8, 7.0.0 Votes: 1, Watches: 3

ops4j-issues commented 7 years ago

Achim Nierbeck commented

fixed

master:
https://github.com/ops4j/org.ops4j.pax.web/commit/18e52b52415515c0b67b0128243bf0d86cc75722

6.1.x:
https://github.com/ops4j/org.ops4j.pax.web/commit/c2b2d0a65260e696f27e691578b2ee10bac65319

6.0.x:
https://github.com/ops4j/org.ops4j.pax.web/commit/319b4ac971d0e54dbb8def6637c7df8735550fa0

ops4j-issues commented 7 years ago

Amichai Rothman commented

Thanks!

But is this really a warning, i.e. something is wrong? What does it mean?

ops4j-issues commented 7 years ago

Achim Nierbeck commented

This scanner scans for ServletContainerInitializer, obviosly you defined to have such a initializer in your service conf in META-INF/services

https://github.com/ops4j/org.ops4j.pax.web/blob/18e52b52415515c0b67b0128243bf0d86cc75722/pax-web-api/src/main/java/org/ops4j/pax/web/utils/ServletContainerInitializerScanner.java#L65

After the check if this class is an annotation or an interface this scanner will look for that.
In your case you defined a dependency for an annotation, which you didn't "Provide" therefore the warning:

https://github.com/ops4j/org.ops4j.pax.web/blob/18e52b52415515c0b67b0128243bf0d86cc75722/pax-web-api/src/main/java/org/ops4j/pax/web/utils/ServletContainerInitializerScanner.java#L102

ops4j-issues commented 7 years ago

Amichai Rothman commented

I see. Well I didn't add anything myself, but I guess either karaf or one of the dependency jars has this in META-INF. I see it in jars from pax web (pax-web-jsp-6.0.7.jar) and jetty (websocket-server-9.3.15.v20161220.jar, javax-websocket-server-impl-9.3.15.v20161220.jar, javax-websocket-server-impl-9.3.14.v20161028.jar). Nothing much I can do about it, no?