2017-07-12 23 views
-1

私はレスポンスを返すMULTIPART FORM_DATAを消費し、それを使って何かを行いますdropwizardで、残りのAPIを作成しようとしていますが、ユーザーがいない合格した場合のシステムよりもマルチパートファイルが復帰応答io.dropwizard.jersey.errors.LoggingExceptionMapper:リクエストの処理中にエラーが発生しました:5a81495aefe8fa44! java.lang.NullPointerExceptionが:ヌル

{ 
"code": 500, 
"message": "There was an error processing your request. It has been logged (ID dd0ffe2edbe69923)."`}` 
です

私はそこに自分自身の応答がほしいと思うintstead。これは、クライアントが

@POST 

@Path("/upload") 
@CacheControl(maxAge = 1, maxAgeUnit = TimeUnit.DAYS) 
@Consumes(MediaType.MULTIPART_FORM_DATA) 
@Produces({"application/json", "application/xml", 
      "application/OCTET_STREAM", "application/x-protobuf", 
      "application/PLAIN.TEXT"}) 
public Response start(@FormDataParam("file") InputStream inputStream, 
         @FormDataParam("file") FormDataContentDisposition fileDetail 
        )throws NullPointerException,Exception{ 




    return Response.ok("anything").build(); 

} 

を取得していることを応答であり、要求が

curl -X POST \ 
    http://localhost:3013/not \ 
    -H 'cache-control: no-cache' \ 
    -H 'postman-token: 8214d505-55a4-c13d-80df-896582a6cff0' 

であり、これはエラーサーバー

ERROR [2017-07-12 16:38:02,543] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: dd0ffe2edbe69923 
! java.lang.NullPointerException: null 
! at org.glassfish.jersey.media.multipart.internal.FormDataParamValueFactoryProvider$FormDataParamValueFactory.provide(FormDataParamValueFactoryProvider.java:282) 
! at org.glassfish.jersey.server.spi.internal.ParamValueFactoryWithSource.provide(ParamValueFactoryWithSource.java:71) 
! at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParameterValues(ParameterValueHelper.java:90) 
! at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$AbstractMethodParamInvoker.getParamValues(JavaResourceMethodDispatcherProvider.java:127) 
! at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) 
! at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) 
! at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) 
! at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) 
! at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) 
! at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) 
! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) 
! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) 
! 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.process(Errors.java:267) 
! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) 
! at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) 
! at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) 
! at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) 
! at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) 
! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) 
! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) 
! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) 
! at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49) 
! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634) 
! at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:34) 
! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621) 
! at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:50) 
! at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:44) 
! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621) 
! at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541) 
! at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) 
! at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239) 
! at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) 
! at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481) 
! at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) 
! at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141) 
! at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 
! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) 
! at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:241) 
! at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51) 
! at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:494) 
! at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:68) 
! at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56) 
! at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169) 
! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) 
! at org.eclipse.jetty.server.Server.handle(Server.java:564) 
! at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) 
! at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) 
! at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) 
! at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) 
! at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) 
! at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672) 
! at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590) 
! at java.lang.Thread.run(Thread.java:745) 

で示され、依存関係は

<dependency> 
    <groupId>org.glassfish.jersey.media</groupId> 
    <artifactId>jersey-media-multipart</artifactId> 
    <version>2.17</version> 
    <exclusions> 
       <exclusion> 
        <groupId>javax.servlet</groupId> 
        <artifactId>javax.servlet-api</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>junit</groupId> 
        <artifactId>junit</artifactId> 
       </exclusion> 
      </exclusions> 
</dependency> 

答えて

0

をしています実際に問題はwだったorg.glassfish.jersey.mediaバージョンで2.23に変更されました。現在は正常に動作しています

関連する問題