我正在创建一个api,但是在某些端点上却收到了NoSuchElementException。我不明白为什么要扔它。我正在使用payara。
错误:
[2019-05-22T15:56:56.159+0200] [Payara 5.184] [SEVERE] []
[fish.payara.microprofile.opentracing.jaxrs.JaxrsContainerRequestTracingFilter]
[tid: _ThreadID=42 _ThreadName=http-thread-pool::http-listener-1(4)] [timeMillis: 1558533416159] [levelValue: 1000] [[
java.util.NoSuchElementException
java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:349)
at dao.config.SecurityFilter.filter(SecurityFilter.java:31)
at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:132)
at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:68)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:269)
端点:
@Stateless
@Path("kweet")
@Produces({MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Secured
public class KweetAPI extends Application {
@Inject
private KweetService kweetService;
@GET
public Response findAll(){
List<Kweet> kweets = kweetService.getAllKweets();
if(kweets != null){
return Response.ok().entity(kweets).build();
} else {
return Response.noContent().build();
}
}
}
谢谢您的帮助!