当我从 Gradle 任务运行它们时,我的集成测试失败了。
org.springframework.data.solr.UncategorizedSolrException: **SolrCore 'collection1' is not available due to init failure: Error opening new searcher; nested exception is org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Error opening new searcher**
at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:122)
at org.springframework.data.solr.core.SolrTemplate.saveDocuments(SolrTemplate.java:206)
at org.springframework.data.solr.core.SolrTemplate.saveDocuments(SolrTemplate.java:201)
Run Code Online (Sandbox Code Playgroud)
org.apache.lucene.store.LockObtainFailedException:锁获取超时:NativeFSLock@/opt/solr/example/solr/collection1/data/index/write.lock
当我直接在 Intellij 中运行集成测试时,测试成功运行。这是我对嵌入式服务器的 bean 定义。我添加了 destroyMethod 并且它没有效果。
@Bean(destroyMethod = "shutdown")
public SolrServer solrServer(org.apache.commons.configuration.Configuration configuration) {
EmbeddedSolrServerFactory factory;
try {
factory = new EmbeddedSolrServerFactory(configuration.getString("solr.home"));
} catch (ParserConfigurationException | IOException | SAXException e) {
String errorMsg = "Encountered an exception while …Run Code Online (Sandbox Code Playgroud) **问题解决了,这要归功于neildo。这是从POST获得回复所需要的
我的REST Flow的实现调用一个Java API,该Java API返回一个Java对象。然后,我将该对象转换为JSON文档,并将其返回给客户端。我的Logger步骤正在记录正确的数据,但是客户端只得到200 OK且为空。
我有我的所有流量设置同步和我的HTTP端点,以请求-响应。我想念什么?
谢谢!内森
这是我的XML文件
<apikit:config name="IAMPerson-config" raml="IAMPerson.raml" consoleEnabled="true" consolePath="console" doc:name="Router"/>
<apikit:mapping-exception-strategy name="IAMPerson-apiKitGlobalExceptionMapping">
<apikit:mapping statusCode="404">
<apikit:exception value="org.mule.module.apikit.exception.NotFoundException" />
<set-property propertyName="Content-Type" value="application/json" />
<set-payload value="{ "message": "Resource not found" }" />
</apikit:mapping>
...
</apikit:mapping-exception-strategy>
<flow name="IAMPerson-main" doc:name="IAMPerson-main" processingStrategy="synchronous">
<http:inbound-endpoint address="http://localhost:8081/api" doc:name="HTTP" exchange-pattern="request-response" password="admin" user="admin" contentType="application/json"/>
<apikit:router config-ref="IAMPerson-config" doc:name="APIkit Router"/>
<exception-strategy ref="IAMPerson-apiKitGlobalExceptionMapping" doc:name="Reference Exception Strategy"/>
</flow>
<flow name="post:/person:IAMPerson-config" doc:name="post:/person:IAMPerson-config" processingStrategy="synchronous">
<json:json-to-object-transformer doc:name="JSON to Object" …Run Code Online (Sandbox Code Playgroud) 所有,我向测试 REST 服务发出的每个 HTTP 请求都使用设置为 GET 的方法发送。Tomcat 以 405 - Unsupported Method 拒绝。我将其更改为(POST、PUT 等)无关紧要,Jmeter 总是发送 GET。
我通过创建一个带有 HTTP 请求采样器和查看结果树的线程组来设置最简单的测试用例。我将一个 JSON 正文发送到 REST 服务,该服务仅将请求与 ID 一起回显。与 Google 的 REST 客户端 UI 配合使用非常好。
这是查看结果树的结果:
Response code: 405
Response message: Method Not Allowed
Response headers:
HTTP/1.1 405 Method Not Allowed
Server: Apache-Coyote/1.1
Allow: POST
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 1045
Date: Fri, 18 Jul 2014 21:39:27 GMT
Run Code Online (Sandbox Code Playgroud)
这是来自我的 REST 服务的 RequestMapping
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
Run Code Online (Sandbox Code Playgroud)
这是我的结果的一些屏幕截图。我想知道为什么树中的 HTTP 请求下面有两个 …