当前位置: 首页 > 知识库问答 >
问题:

Spring SOAP web服务集成测试错误:未找到endpoint映射。soap服务本身可以工作,问题在于测试

海宁
2023-03-14

我用Spring WS创建了一个soap web服务。当我运行应用程序并向endpoint发送SOAP请求时,我得到了正确的响应。因此,服务本身正在发挥作用。

现在我想使用Spring的MockWebServiceClient编写集成测试,但我得到了错误:

org.springframework.ws.NoEndpointFoundException: No endpoint can be found for request [SaajSoapMessage {http://tempuri.org/}StartSessionGetOffers]

因为服务在我启动应用程序时起作用,但在运行测试时不起作用,所以我在启动时寻找日志中的差异。当应用程序旋转时,我看到与肥皂服务映射相关的日志,这些日志在测试上下文中不存在:

INFO  ServletRegistrationBean - Servlet messageDispatcherServlet mapped to [/soapWebService/*]

我的理解是,测试类上的@ContextConfiguration注释负责在Application Context上注册肥皂服务,然后由mock Client使用它来调用服务,即mockClient=MockWebServiceClient.createClient(Application ationContext);

问题还可能与集成测试中如何生成请求/响应有关。我正在使用RequestCreators类,并向其传递我已经测试过并知道有效的soap请求xml。请求看起来生成正确。

但它不起作用,我也没有主意了。

我的测试类别:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { WebServiceConfig.class })
public class InteractProxyEndpointTest {
    @Autowired
    ApplicationContext applicationContext;

    @Autowired
    ResourceLoader resourceLoader;

    MockWebServiceClient mockClient;


    @Before
    public void createClient() {
        Assert.assertNotNull(applicationContext);
        mockClient = MockWebServiceClient.createClient(applicationContext);
    }

    @Test
    public void interactEndpointTest() throws IOException {
        final RequestCreator requestCreator; // Creator for the request
        final ResponseMatcher responseMatcher; // Matcher for the response

        mockClient = MockWebServiceClient.createClient(applicationContext);

        Resource requestPayLoad = resourceLoader.getResource("classpath:com/lmig/dragon/controller/test/requestPayload.xml");
        Resource responsePayload = resourceLoader.getResource("classpath:com/lmig/dragon/controller/test/responsePayload.xml");

        requestCreator = RequestCreators
                .withSoapEnvelope(requestPayLoad);


        responseMatcher = ResponseMatchers.soapEnvelope(responsePayload);

        // Calls the endpoint
        mockClient.sendRequest(requestCreator).andExpect(responseMatcher);
    }
}

我的WebServiceConfig

@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {

  @Bean
  public ServletRegistrationBean<Servlet> messageDispatcherServlet(ApplicationContext applicationContext) {
        MessageDispatcherServlet servlet = new MessageDispatcherServlet();
        servlet.setApplicationContext(applicationContext);
        servlet.setTransformWsdlLocations(true);
        return new ServletRegistrationBean<>(servlet,"/soapWebService/*");
  }

  @Bean(name = "interactOffers")
  public DefaultWsdl11Definition interactWsdl11Definition(XsdSchema interactOffersSchema) {
    DefaultWsdl11Definition definition = new DefaultWsdl11Definition();
    definition.setPortTypeName("InteractOffersPort");
    definition.setTargetNamespace("http://tempuri.org/StartSessionGetOffers");
    definition.setLocationUri("/soapWebService");
    definition.setSchema(interactOffersSchema);
    return definition;
  }

  @Bean
  public XsdSchema interactOffersSchema() {
    return new SimpleXsdSchema(new ClassPathResource("interact-offers.xsd"));
  }
}

请求ayload.xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:nba="http://schemas.datacontract.org/2004/07/NBAInteract.DataContracts">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:StartSessionGetOffers>
         <!--Optional:-->
         <tem:request>
            <!--Optional:-->
            <nba:EmployeeId xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <!--Optional:-->
            <nba:LMCustId></nba:LMCustId>
            <nba:LMHouseholdId>/nba:LMHouseholdId>
            <nba:SessionId></nba:SessionId>
            <!--Optional:-->
            <nba:CdiHouseholdId></nba:CdiHouseholdId>
            <!--Optional:-->
            <nba:EventName></nba:EventName>
            <!--Optional:-->
            <nba:LMInteractionChannel></nba:LMInteractionChannel>
            <!--Optional:-->
            <nba:OfferCount></nba:OfferCount>
            <!--Optional:-->
            <nba:UserAuxCode xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
         </tem:request>
      </tem:StartSessionGetOffers>
   </soapenv:Body>
</soapenv:Envelope>

测试日志:

INFO  DefaultTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener]
INFO  DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@445629, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@1b9a632, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@1d250c6, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1f50bcc, org.springframework.test.context.support.DirtiesContextTestExecutionListener@126e945, org.springframework.test.context.transaction.TransactionalTestExecutionListener@1a65a25, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@c562f7, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@18ba8c8, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@1bb137d, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@9d0b9d, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@1301423, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@1112965]
INFO  GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@1c758ac: startup date [Sat May 04 21:25:01 PDT 2019]; root of context hierarchy
INFO  PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'webServiceConfig' of type [com.lmig.dragon.WebServiceConfig$$EnhancerBySpringCGLIB$$9e2d774] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO  PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$8ca20d2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO  AnnotationActionEndpointMapping - Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
INFO  SaajSoapMessageFactory - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
INFO  SaajSoapMessageFactory - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
WARN  EndpointNotFound - No endpoint mapping found for [SaajSoapMessage {http://tempuri.org/}StartSessionGetOffers]
ERROR MockWebServiceClient - Could not send request
org.springframework.ws.NoEndpointFoundException: No endpoint can be found for request [SaajSoapMessage {http://tempuri.org/}StartSessionGetOffers]
    at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:217) ~[spring-ws-core-3.0.0.RELEASE.jar:na]
    at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176) ~[spring-ws-core-3.0.0.RELEASE.jar:na]
    at org.springframework.ws.test.server.MockWebServiceClient.sendRequest(MockWebServiceClient.java:178) ~[spring-ws-test-3.0.7.RELEASE.jar:na]
    at com.lmig.dragon.controller.test.InteractProxyEndpointTest.interactEndpointTest(InteractProxyEndpointTest.java:60) [test-classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_161]
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12]
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12]
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206) [.cp/:na]
INFO  GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@1c758ac: startup date [Sat May 04 21:25:01 PDT 2019]; root of context hierarchy

完整的应用程序启动日志(当服务按预期工作时):

INFO  PropertySourceBootstrapConfiguration - Located property source: CompositePropertySource {name='vault', propertySources=[LeaseAwareVaultPropertySource {name='secret/np/us-consumer-markets/uscm-contact-center-technology/trove/test/test/trove-credentials'}, LeaseAwareVaultPropertySource {name='secret/np/us-consumer-markets/uscm-contact-center-technology/trove/test/test/application'}]}
INFO  Application - No active profile set, falling back to default profiles: default
INFO  AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@10d6318: startup date [Fri May 03 13:44:03 PDT 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@959ece
INFO  GenericScope - BeanFactory id=3c934013-f2bf-3e58-ac35-c5b28f255634
INFO  PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'webServiceConfig' of type [com.lmig.dragon.WebServiceConfig$$EnhancerBySpringCGLIB$$2cbed7af] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO  PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$2ba6210d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO  AnnotationActionEndpointMapping - Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
INFO  PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a3285f0b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO  TomcatWebServer - Tomcat initialized with port(s): 443 (http)
INFO  Http11NioProtocol - Initializing ProtocolHandler ["http-nio-443"]
INFO  StandardService - Starting service [Tomcat]
INFO  StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.28
INFO  AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files (x86)\Java\jre1.8.0_161\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files (x86)/Java/jre1.8.0_161/bin/client;C:/Program Files (x86)/Java/jre1.8.0_161/bin;C:/Program Files (x86)/Java/jre1.8.0_161/lib/i386;C:\Program Files (x86)\Nice Systems\NICE Player Codec Pack\\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Java\jdk1.8.0_102\bin;C:\Program Files (x86)\Java\jre1.8.0_161\bin;C:\Program Files (x86)\RSA SecurID Token Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Citrix\System32\;C:\Program Files\Citrix\ICAService\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Avaya\IC73\Java\bin;C:\Program Files (x86)\Avaya\IC73\bin\;C:\Users\n0230962\Desktop\apache-maven-3.5.0\bin\;C:\Program Files (x86)\GitExtensions\;C:\Program Files (x86)\Cntlm;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\NICE Systems\NICE Player Release 6\\;C:\Program Files\nodejs;C:\Program Files\Citrix\Virtual Desktop Agent\;C:\Program Files\nodejs\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Git\cmd;C:\Users\n0230962\AppData\Local\Microsoft\WindowsApps;;C:\Users\n0230962\AppData\Local\Programs\Fiddler;C:\Users\n0230962\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\n0230962\AppData\Roaming\npm;C:\Users\n0230962\AppData\Local\Microsoft\WindowsApps;C:\Users\n0230962\AppData\Local\Yarn\bin;C:\Users\n0230962\Desktop\sts-bundle\sts-3.9.1.RELEASE;;.]
INFO  [/] - Initializing Spring embedded WebApplicationContext
INFO  ContextLoader - Root WebApplicationContext: initialization completed in 1250 ms
INFO  ServletRegistrationBean - Servlet messageDispatcherServlet mapped to [/soapWebService/*]
INFO  ServletRegistrationBean - Servlet dispatcherServlet mapped to [/]
INFO  FilterRegistrationBean - Mapping filter: 'characterEncodingFilter' to: [/*]
INFO  FilterRegistrationBean - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
INFO  FilterRegistrationBean - Mapping filter: 'httpPutFormContentFilter' to: [/*]
INFO  FilterRegistrationBean - Mapping filter: 'requestContextFilter' to: [/*]
INFO  RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@10d6318: startup date [Fri May 03 13:44:03 PDT 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@959ece
[org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
INFO  AnnotationMBeanExporter - Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
INFO  AnnotationMBeanExporter - Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=10d6318,type=ConfigurationPropertiesRebinder]
INFO  Http11NioProtocol - Starting ProtocolHandler ["http-nio-443"]
INFO  NioSelectorPool - Using a shared selector for servlet write/read
INFO  TomcatWebServer - Tomcat started on port(s): 443 (http) with context path ''
INFO  Application - Started Application in 4.705 seconds (JVM running for 5.539)

共有1个答案

拓拔富
2023-03-14
@EnableWs
@Configuration
@ComponentScan
public class WebServiceConfig extends WsConfigurerAdapter 
{
....
}
 类似资料:
  • 我正在尝试如何在使用Eureka的Spring Boot应用程序上构建集成测试。说我有考试 我的代码路径中有该 api 调用: 这将NPE。发现客户端返回为空。如果我直接启动 Spring 启动应用程序并自己使用 API,代码工作正常。我在任何地方都没有特定的个人资料用法。我需要为发现客户端配置一些特殊的 wrt Eureka 以进行测试吗?

  • 像组件一样,服务通常需要依赖,Angular通过服务类的构造函数注入。由于我们在Angular的引导过程之外初始化这些类,我们必须自己显式注入这些依赖。这是通过使用TestBed配置测试模块传回所需的依赖项(如HTTP模块)来实现的。

  • 我已经发送了一个soap服务,我必须发送基本的身份验证(用户名和密码)以及qaf中的请求和头值。我尝试在应用程序中添加用户名和密码。属性文件,但服务引发内部服务器错误。请指导我怎么做。

  • 我试图开发一个快速的SOAP服务器,以便在使用Spring-Boot和Spring-WS进行测试时使用。首先是合同,因为我有现有的WSDL和XSD文件,并在构建时从它们生成java类。但是,当我通过使用或SOAPUI发送请求时,我会得到以下错误: (亮点: 这个问题的答案是肯定的,我的endpoint是用注释的。完整设置如下: Build.Gradle mocksoapconfig.java 因此

  • 我在测试我的Spring Cloud stream服务(写入Kafka流)时遇到问题。它基于以下baeldung介绍 这是服务代码(具体省略) 这是测试 非常直接,但是在执行测试时,我得到一个NullPointerException,因为轮询返回一个Null。 知道问题是什么吗? 谢谢