Web服务异常:“请求处理期间容器中发生异常或错误java.lang.Exception:未设置主机”

时间:2017-08-02 11:45:44

标签: java web-services maven payara

我有一个web方法,通过读取类文件(maven插件文件)获取一些名称并返回其所需的输入类型(BOM,AML,BOM和AML或任何其他名称)。在尝试这样做时,我的情况低于例外。

[2017-08-02T17:14:33.902+0800] [Payara 4.1] [SEVERE] [AS-WEB-CORE-00037] [javax.enterprise.web.core] [tid: _ThreadID=47 _ThreadName=http-thread-pool::http-listener-1(1)] [timeMillis: 1501665273902] [levelValue: 1000] [[
  An exception or error occurred in the container during the request processing
java.lang.Exception: Host is not set
    at org.glassfish.grizzly.http.server.util.Mapper.map(Mapper.java:902)
    at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:496)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:309)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:466)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:169)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Thread.java:722)
]]

你能帮我解决一下吗?

2 个答案:

答案 0 :(得分:0)

我再次通过创建一个新工作区(从svn结帐)来构建war文件,并且它有效。

答案 1 :(得分:0)

Grizzly从请求中的Host标头中获取虚拟主机名。从HTTP 1.1开始,Host标头是必需的。但是,如果Host标头设置为空名称,则Grizzly无法获取该名称并引发此类异常。

通常,Host请求标头由HTTP客户端设置。但是,即使存在Host标头,但由于某些原因其值为空,您也会发生这样的错误。