Hi Markus,

it should be done on Jetty connector, so basically in Pax Web.

Regards
JB

On 14/01/2020 16:12, Markus Rathgeb wrote:
> Do you know about a method that can I call in my bundle code (e.g. in
> its init method) to get it running on 4.2.7?
> Any change to call "setMultiPartFormDataCompliance" in the servlet
> implementation?
> Or adding a configuration to config admin, ...?
> 
> Am Di., 14. Jan. 2020 um 16:01 Uhr schrieb Jean-Baptiste Onofré
> <[email protected]>:
>>
>> It should be fixed on 4.2.8.
>>
>> See https://ops4j1.jira.com/browse/PAXWEB-1246 for details.
>>
>> Regards
>> JB
>>
>> On 14/01/2020 15:55, Markus Rathgeb wrote:
>>> Hi,
>>>
>>> I updated a product using a custom distribution from 4.2.6 to 4.2.7.
>>> Because of this in the runtime the following versions has been changed:
>>> * Pax Web: 7.2.10 to 7.2.11
>>> * Jetty: from 9.4.18.v20190429 to 9.4.20.v20190813
>>>
>>> There is a bundle that contains a HTTP servlet for a fie upload.
>>>
>>> The POST request is handled by a method that takes the
>>> HttpServletRequest "request" and the HttpServletResponse "response".
>>> At the beginning it calls:
>>>         final Collection<Part> parts = request.getParts();
>>>
>>> After that it handles the parts.
>>>
>>> This worked before but does not anymore.
>>>
>>> An exception is raised.
>>>
>>> java.lang.NoClassDefFoundError:
>>> org/eclipse/jetty/util/MultiPartInputStreamParser
>>>         at 
>>> org.eclipse.jetty.server.MultiParts$MultiPartsUtilParser.<init>(MultiParts.java:104)
>>> ~[!/:9.4.20.v20190813]
>>>         at org.eclipse.jetty.server.Request.newMultiParts(Request.java:2295)
>>> ~[!/:9.4.20.v20190813]
>>>         at org.eclipse.jetty.server.Request.getParts(Request.java:2217)
>>> ~[!/:9.4.20.v20190813]
>>>         at org.eclipse.jetty.server.Request.getParts(Request.java:2203)
>>> ~[!/:9.4.20.v20190813]
>>>         at ....UploadServlet.doPost(UploadServlet.java:152) ~[?:?]
>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>>> ~[!/:3.1.0]
>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
>>> ~[!/:3.1.0]
>>>         at 
>>> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1591)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
>>> ~[!/:?]
>>>         at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293)
>>> ~[!/:?]
>>>         at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
>>> ~[!/:?]
>>>         at 
>>> org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:722)
>>> ~[!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
>>> ~[!/:9.4.20.v20190813]
>>>         at org.eclipse.jetty.server.Server.handle(Server.java:494)
>>> ~[!/:9.4.20.v20190813]
>>>         at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374)
>>> [!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268)
>>> [!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
>>> [!/:9.4.20.v20190813]
>>>         at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
>>> [!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
>>> [!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782)
>>> [!/:9.4.20.v20190813]
>>>         at 
>>> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918)
>>> [!/:9.4.20.v20190813]
>>>         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
>>>
>>> I do not use the "MultiPartInputStreamParser" myself just call
>>> "request.getParts()" in line 152 of the UploadServlet.java file.
>>>
>>> I assume the Jetty bundle misses some import for that specific util.
>>> But this does not seems to be the case...
>>>
>>> karaf@root()> bundle:list -t 0 -l | grep jetty | grep server
>>> 192 (0x Active    │  30 │ 9.4.20.v20190813        │
>>> mvn:org.eclipse.jetty/jetty-server/9.4.20.v20190813
>>> 202 (0x Active    │  30 │ 9.4.20.v20190813        │
>>> mvn:org.eclipse.jetty.websocket/javax-websocket-server-impl/9.4.20.v20190813
>>> 203 (0x Active    │  30 │ 9.4.20.v20190813        │
>>> mvn:org.eclipse.jetty.websocket/websocket-server/9.4.20.v20190813
>>>
>>> The command "bundle:headers 192" shows:
>>>
>>> Import-Package =
>>>         ...
>>>         org.eclipse.jetty.util;version="[9.4.20,10)",
>>>         ...
>>>
>>> There is also only one util bundle (except the additional ajax one):
>>>
>>> karaf@root()> bundle:list -t 0 -l | grep jetty | grep util
>>> 195 (0x Active    │  30 │ 9.4.20.v20190813        │
>>> mvn:org.eclipse.jetty/jetty-util/9.4.20.v20190813
>>> 196 (0x Active    │  30 │ 9.4.20.v20190813        │
>>> mvn:org.eclipse.jetty/jetty-util-ajax/9.4.20.v20190813
>>>
>>> For me the following command shows the class is exported:
>>>
>>> karaf@root()> bundle:classes 195 | grep MultiPartInputStreamParser
>>> org/eclipse/jetty/util/MultiPartInputStreamParser$1.class | exported: true
>>> org/eclipse/jetty/util/MultiPartInputStreamParser$Base64InputStream.class
>>> | exported: true
>>> org/eclipse/jetty/util/MultiPartInputStreamParser$MultiPart.class |
>>> exported: true
>>> org/eclipse/jetty/util/MultiPartInputStreamParser$NonCompliance.class
>>> | exported: true
>>> org/eclipse/jetty/util/MultiPartInputStreamParser.class | exported: true
>>>
>>> What's wrong?
>>>
>>>
>>>
>>> I assume it is not relevant, but let's not loose any information:
>>> There is an init method of the http servlet implementation class that
>>> looks like:
>>> ===
>>> @Override
>>> public void init() throws ServletException {
>>>     /*
>>>      * @MultipartConfig annotation for the class does not seem to work.
>>>      * So let's configure it programmatically.
>>>      */
>>>     final MultipartConfigElement mc = new
>>> MultipartConfigElement(tempDir.getAbsolutePath(), MAX_FILE_SIZE,
>>>             MAX_REQUEST_SIZE, FILE_SIZE_THRESHOLD);
>>>
>>>     for (final Entry<String, ? extends ServletRegistration> entry :
>>> getServletContext().getServletRegistrations()
>>>             .entrySet()) {
>>>         final ServletRegistration reg = entry.getValue();
>>>         if (reg == null) {
>>>             continue;
>>>         }
>>>
>>>         if (reg instanceof ServletRegistration.Dynamic) {
>>>             final ServletRegistration.Dynamic regDyn =
>>> (ServletRegistration.Dynamic) reg;
>>>             regDyn.setMultipartConfig(mc);
>>>         }
>>>     }
>>> }
>>> ===
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [email protected]
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to