简体   繁体   中英

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

<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

Below is sample Java class code

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. I need request object hence can not before jaxws tag

I was able to call Java class and add object in session and was able to retrive same object after service call. But some how it is not working. I have tried multiple things like adding remove variable tag and every thing I know. 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. I

There's a few broken things in your configuration:

  • the jaxws-service element is not closed,
  • it lacks a serviceClass attribute pointing to your service interface,
  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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