{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/jetty.project/issues/2853","repository_url":"https://api.github.com/repos/eclipse/jetty.project","labels_url":"https://api.github.com/repos/eclipse/jetty.project/issues/2853/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/jetty.project/issues/2853/comments","events_url":"https://api.github.com/repos/eclipse/jetty.project/issues/2853/events","html_url":"https://github.com/eclipse/jetty.project/issues/2853","id":353403394,"node_id":"MDU6SXNzdWUzNTM0MDMzOTQ=","number":2853,"title":"Http1FieldPreEncoder not loaded, throws ArrayIndexOutOfBoundsException, prevent initialization","user":{"login":"va1erian","id":1766390,"node_id":"MDQ6VXNlcjE3NjYzOTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1766390?v=4","gravatar_id":"","url":"https://api.github.com/users/va1erian","html_url":"https://github.com/va1erian","followers_url":"https://api.github.com/users/va1erian/followers","following_url":"https://api.github.com/users/va1erian/following{/other_user}","gists_url":"https://api.github.com/users/va1erian/gists{/gist_id}","starred_url":"https://api.github.com/users/va1erian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/va1erian/subscriptions","organizations_url":"https://api.github.com/users/va1erian/orgs","repos_url":"https://api.github.com/users/va1erian/repos","events_url":"https://api.github.com/users/va1erian/events{/privacy}","received_events_url":"https://api.github.com/users/va1erian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-23T14:19:20Z","updated_at":"2018-08-23T14:53:48Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\nWe are deploying Jetty v9.4.11 on an OSGI environnment. Every once in a while, it appears the Service Loader call in PreEncodedHttpField does not return the HTTP 1.1 impl of PreEncodedHttpField (see the second log line) which make code fails with an ArrayIndexOutOfBoundsException and prevent the initialization of the server.\r\n\r\n```\r\n<2018.08.20 22:24:28 920 +0530><org.eclipse.jetty.util.component.AbstractLifeCycle:185> starting o.e.j.s.ServletContextHandler@21fa176c{HTTP Service,/,null,UNAVAILABLE}\r\n<2018.08.20 22:24:28 966 +0530><org.eclipse.jetty.http.PreEncodedHttpField:64> HttpField encoders loaded: [org.eclipse.jetty.http2.hpack.HpackFieldPreEncoder@46efc595]\r\n<2018.08.20 22:24:28 967 +0530><org.eclipse.jetty.util.component.AbstractLifeCycle:213> FAILED o.e.j.s.ServletContextHandler@21fa176c{HTTP Service,/,null,STARTING}: java.lang.ExceptionInInitializerError\r\n        at org.eclipse.jetty.http.MimeTypes$Type.<init>(MimeTypes.java:103)\r\n        at org.eclipse.jetty.http.MimeTypes$Type.<clinit>(MimeTypes.java:58)\r\n        at org.eclipse.jetty.http.MimeTypes.<clinit>(MimeTypes.java:191)\r\n        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:832)\r\n        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:287)\r\n        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)\r\n        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)\r\n        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)\r\n        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)\r\n        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)\r\n        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)\r\n        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)\r\n        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)\r\n        at org.eclipse.jetty.server.handler.StatisticsHandler.doStart(StatisticsHandler.java:252)\r\n        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)\r\n        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)\r\n        at org.eclipse.jetty.server.Server.start(Server.java:419)\r\n        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)\r\n        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)\r\n        at org.eclipse.jetty.server.Server.doStart(Server.java:386)\r\n        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)\r\n        at com.xxx.as.agent.web.container.Container.start(Container.java:329)\r\n        at com.xxx.as.agent.web.container.Container.access$300(Container.java:67)\r\n        at com.xxx.as.agent.web.container.Container$4.run(Container.java:235)\r\n        at com.xxx.as.service.concurrent.impl.Helper.runTask(Helper.java:57)\r\n        at com.xxx.as.service.concurrent.impl.ThreadQueueExecutor.lambda$execute$6(ThreadQueueExecutor.java:212)\r\n        at com.xxx.as.service.concurrent.impl.ThreadQueue.runTask(ThreadQueue.java:132)\r\n        at com.xxx.as.service.concurrent.impl.ThreadQueue.run(ThreadQueue.java:112)\r\n        at java.lang.Thread.run(Thread.java:748)\r\nCaused by: java.lang.ArrayIndexOutOfBoundsException: 1\r\n        at org.eclipse.jetty.http.PreEncodedHttpField.<clinit>(PreEncodedHttpField.java:71)\r\n        ... 29 more\r\n```\r\nI really don't know why this happens as Http1FieldPreEncoder is already in the same bundle and the META-INF/services spi config file is here. However I believe this case should be handled better. My suggestion for a fix would be identical to the one mentioned in #1325 and add the elements in the array at the correct index using the index static method.\r\n"},"comment":{"url":"https://api.github.com/repos/eclipse/jetty.project/issues/comments/415447623","html_url":"https://github.com/eclipse/jetty.project/issues/2853#issuecomment-415447623","issue_url":"https://api.github.com/repos/eclipse/jetty.project/issues/2853","id":415447623,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTQ0NzYyMw==","user":{"login":"joakime","id":191721,"node_id":"MDQ6VXNlcjE5MTcyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/191721?v=4","gravatar_id":"","url":"https://api.github.com/users/joakime","html_url":"https://github.com/joakime","followers_url":"https://api.github.com/users/joakime/followers","following_url":"https://api.github.com/users/joakime/following{/other_user}","gists_url":"https://api.github.com/users/joakime/gists{/gist_id}","starred_url":"https://api.github.com/users/joakime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakime/subscriptions","organizations_url":"https://api.github.com/users/joakime/orgs","repos_url":"https://api.github.com/users/joakime/repos","events_url":"https://api.github.com/users/joakime/events{/privacy}","received_events_url":"https://api.github.com/users/joakime/received_events","type":"User","site_admin":false},"created_at":"2018-08-23T14:53:48Z","updated_at":"2018-08-23T14:53:48Z","author_association":"MEMBER","body":"Might be related to Issue #1325 or #2048"}}
{"actor":{"display_login":"joakime"}}