【发布时间】:2015-01-16 20:37:45
【问题描述】:
我尝试将 Apache CXF 配置为使用有限数量的线程,但 CXF 似乎是某种基于 CPU 数量的自动调整大小。 (我认为这是因为在一台机器上工作的相同配置文件在另一台具有更多 CPU 的机器上失败)。
xml 看起来像这样:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/transports/http-jetty/configuration
http://cxf.apache.org/schemas/configuration/http-jetty.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<httpj:engine-factory bus="cxf">
<httpj:engine port="0">
<httpj:threadingParameters minThreads="2" maxThreads="4" />
</httpj:engine>
</httpj:engine-factory>
</beans>
但是,当我在另一台具有更多 CPU 的机器上运行它时,我收到此错误:
Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 10,100: Not enough threads configured for port 10,100. Need at least 7 (6 for Jetty selectors and set managers) but only 4 configured.
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:386)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:178)
at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48)
at org.apache.cxf.binding.AbstractBaseBindingFactory.addListener(AbstractBaseBindingFactory.java:97)
at org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:901)
at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:131)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:349)
... 7 more
Caused by: org.apache.cxf.interceptor.Fault: Not enough threads configured for port 10,100. Need at least 7 (6 for Jetty selectors and set managers) but only 4 configured.
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.setupThreadPool(JettyHTTPServerEngine.java:469)
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:374)
... 13 more
我错过了什么?
【问题讨论】:
标签: java web-services jetty cxf