Here is my thread info. Trying to get one problem from JIRA and want to configure this problem identifier in another project. Here I want to use Custom Transformer and configure all objects using JAVA coding.
<jira:config name="Jira" connectionUser="XXXXXXX" connectionPassword="XXXXX" connectionAddress="http://XXXXXXX/rpc/soap/jirasoapservice-v2" doc:name="Jira"> <jira:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/> <reconnect count="3"/> </jira:config> <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> <flow name="jira-pocFlow"> <http:listener config-ref="HTTP_Listener_Configuration" path="/input" doc:name="HTTP"/> <jira:get-issues-from-jql-search config-ref="Jira" jqlSearch="id=MRT-75" maxNumResults="100" doc:name="Jira"/> <set-variable variableName="payload" value="#[payload[0]]" doc:name="Variable"/> <component class="JIRATransformer" doc:name="Java"/> <jira:create-issue-using-object config-ref="Jira" doc:name="Jira" > <jira:issue ref="#[message.payload]"/> </jira:create-issue-using-object> <logger level="INFO" doc:name="Logger"/> </flow>
I am trying to access a JIRA payload object, but it throws me an Error as Type Cast Exception.
@Override public Object transformMessage(MuleMessage message, String outputEncoding) throws org.mule.api.transformer.TransformerException { ArrayList<com.atlassian.jira.rpc.soap.beans.RemoteIssue> list = new ArrayList(Arrays.asList(message.getPayload())); for(RemoteIssue q : (List<RemoteIssue>) list){ System.out.println("Print AssigneeInfo:->"+q.getAssignee()); } }

I get the following errors.
ERROR 2015-04-15 19:58:59,526 [[jira-poc].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Component that caused exception is: DefaultJavaComponent{jira-pocFlow.component.887693985}. Message payload is of type: Arrays$ArrayList Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. java.util.Arrays$ArrayList cannot be cast to com.atlassian.jira.rpc.soap.beans.RemoteIssue (java.lang.ClassCastException) JIRATransformer:29 (null) 2. Component that caused exception is: DefaultJavaComponent{jira-pocFlow.component.887693985}. Message payload is of type: Arrays$ArrayList (org.mule.component.ComponentException) org.mule.component.DefaultComponentLifecycleAdapter:348 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/component/ComponentException.html) -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to com.atlassian.jira.rpc.soap.beans.RemoteIssue at JIRATransformer.transformMessage(JIRATransformer.java:29) at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:141) at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:69) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ********************************************************************************
I tried to follow this documentation url but couldn't figure it out. http://mulesoft.imtqy.com/jira-connector/java/com/atlassian/jira/rpc/soap/beans/RemoteIssue.html
I want to access this payload and want to update some details from the payload object here. I can access the payload using the expression MEL # [payload [0]] and it automatically hides it until com.atlassian.jira.rpc.soap.beans.RemoteIssue, but using Java code, I cannot type it .
Could you help me apply this object correctly so that I can access the payload here?
Thanks.
source share