我在Mule 3.4 CE下运行一个非常基本的REST服务,使用运行时的默认包。与使用相同技术的其他几个服务不同,此服务会引发无法解释的错误。我试图添加object-to-string,object-to-json和custom transformers。但这些补充都没有帮助。我在这里或在Mule论坛上看到的其他帖子都没有看到这个问题。我已将Java代码替换为其他工作服务的副本并获得相同的错误。
有什么想法吗?
JSON:
{
"createDate" : "",
"createdBy" : "RESTClient",
"entry" : "RESTClient Work Log",
"lastUpdate" : "",
"lastUpdatedBy" : "",
"requestTypeId" : 1003,
"resourceId" : 5666,
"workLogId" : 0
}
POJO:
@JsonAutoDetect
public class WorkLog {
private String createDate;
private String createdBy;
private String entry;
private String lastUpdate;
private String lastUpdatedBy;
private Integer requestTypeId;
private Integer resourceId;
private Integer workLogId;
// snip
}
REST服务:
@Path("/worklogs")
public interface WorkLogWadlResource {
@POST
@Path("/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createWorkLog(@Context HttpHeaders hdr, @Payload final WorkLog log) throws Exception;
}
流程:
<flow name="worklog-flow" doc:name="worklog-flow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" path="rest/worklogs" />
<logger message="Work Log request, payload: #[message.payload]" level="DEBUG" doc:name="Logger" category="work_log_service" />
<jersey:resources doc:name="Work Log REST Service">
<component>
<spring-object bean="restService" />
</component>
</jersey:resources>
</flow>
&#13;
错误:
ERROR 2015-01-23 15:53:40,906 [[worklog-mule-1.0.0].connector.http.mule.default.receiver.02]
org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message: Failed to invoke JerseyResourcesComponent{worklog-flow.component.5062}.
Component that caused exception is: JerseyResourcesComponent{worklog-flow.component.5062}.
Message payload is of type: ContentLengthInputStream
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. String index out of range: -1 (java.lang.StringIndexOutOfBoundsException)
java.lang.String:1875 (null)
2. Failed to invoke JerseyResourcesComponent{worklog-flow.component.5062}.
Component that caused exception is: JerseyResourcesComponent{worklog-flow.component.5062}.
Message payload is of type: ContentLengthInputStream (org.mule.component.ComponentException)
org.mule.component.AbstractComponent:144
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1875)
at com.sun.jersey.spi.container.ContainerRequest.getEncodedPath(ContainerRequest.java:365)
at com.sun.jersey.spi.container.ContainerRequest.getPath(ContainerRequest.java:358)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
答案 0 :(得分:0)
这纯粹是一个没有明确记录的泽西岛路径错误。操作员错误....
顺便说一句 - 在这种情况下,Mule详细记录没有添加任何细节。