简体   繁体   English

ule子-调用Java类时出错

[英]Mule - Error calling Java class

I am getting error 我遇到错误

java.lang.IllegalArgumentException: object is not an instance of declaring class”

When I place any Java component like below 当我将任何Java组件放置如下

<cxf:jaxws-service>
<component class="packageName.util.Test" doc:name="Java"/>
<component doc:name="ServiceName" doc:description="Retrieves details from database">
  <spring-object bean="beanService" />
</component>

I get error java.lang.IllegalArgumentException: object is not an instance of declaring class 我收到错误java.lang.IllegalArgumentException: object is not an instance of declaring class

Below is sample Java class code 以下是示例Java类代码

public class Test implements Callable {

  @Override
  public Object onCall(MuleEventContext eventContext) throws Exception {
    // TODO Auto-generated method stub
    return eventContext.getMessage().getPayload();
  }

Java component calls works perfect outside jaxws tag. Java组件调用在jaxws标记之外非常有效。 I need request object hence can not before jaxws tag 我需要请求对象,因此不能在jaxws标签之前

I was able to call Java class and add object in session and was able to retrive same object after service call. 我能够调用Java类并在会话中添加对象,并且能够在服务调用后检索相同的对象。 But some how it is not working. 但是有些不起作用。 I have tried multiple things like adding remove variable tag and every thing I know. 我已经尝试了多种方法,例如添加了remove variable标签以及我所知道的每件事。 But not sure why I am getting this error. 但不确定为什么我会收到此错误。 Please help. 请帮忙。 Please let me know if you need any additional information. 如果您需要任何其他信息,请告诉我。 I am new to Mule so please advice if i am missing any basics here. 我是Mule的新手,如果我在这里缺少任何基础知识,请提出建议。 I 一世

There's a few broken things in your configuration: 您的配置中有一些坏处:

  • the jaxws-service element is not closed, jaxws-service元素未关闭,
  • it lacks a serviceClass attribute pointing to your service interface, 它缺少指向您的服务接口的serviceClass属性,
  • it has two components while only one should be present, ie the actual implementation of your service. 它有两个组成部分,而只有一个组成部分,即服务的实际实现。

Reference: http://developer.mulesoft.com/docs/display/current/Building+Web+Services+with+CXF 参考: http : //developer.mulesoft.com/docs/display/current/Building+Web+Services+with+CXF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM