Re: [Dev] "Method threw 'java.lang.LinkageError' exception" while calling a stub method

2015-09-17 Thread Kasun Bandara
Hi Chamila,

Can you please attach the error stack-trace you are getting ?


Thanks.

On Thu, Sep 17, 2015 at 9:43 AM, Chamila Wijayarathna 
wrote:

> Hi all,
>
> Currently I am trying to call some methods of BPS-HumanTaskClientAPIAdmin
> from an IS back end component. To do this I have added
> "HumanTaskClientAPIAdmin.wsdl", "ws-humanyask-types.xsd" and "xml.xsd"
> files to currently existing service stub at IS, which is 
> org.wso2.carbon.identity.workflow.mgt.bps.stub
> [1]. I took the HumanTaskClientAPIAdmin.wsdl from a latest BPS pack and
> other 2 files from [2].
> I newly added following task to the pom.xml of the service stub.
>
>
>
>
>
>
>
> * line="-uri src/main/resources/HumanTaskUploader.wsdl -u -uw -o 
> target/generated-code -p org.wso2.carbon.humantask.stub.upload -ns2p 
> http://services.deployer.humantask.carbon.wso2.org 
> =org.wso2.carbon.humantask.stub.upload,http://services.deployer.humantask.carbon.wso2.org/xsd=org.wso2.carbon.humantask.stub.upload.types
>  
> "/>
>  refid="maven.compile.classpath"/> refid="maven.runtime.classpath"/>*
>
> In my backend component where I need to call the methods of this stub, we
> already had a dependency to the stub.
>
>
> **
>
>
>
> *org.wso2.carbon.identity
> org.wso2.carbon.identity.workflow.mgt.bps.stub*
>
> Then I added following code to call the service through the stub.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *int tenantId = 
> CarbonContext.getThreadLocalCarbonContext().getTenantId();List 
> bpsProfiles = 
> bpsProfileDAO.listBPSProfiles(tenantId);HumanTaskClientAPIAdminStub stub = 
> null;TSimpleQueryInput input = new TSimpleQueryInput();TStatus readyState = 
> new TStatus();//TSimpleQueryCategory queryCategory = new 
> TSimpleQueryCategory("ALL_TASKS", 
> true);readyState.setTStatus("READY");input.addStatus(readyState);input.setPageSize(10);input.setPageNumber(0);input.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);for
>  (int i = 0; i < bpsProfiles.size(); i++) {String host = 
> bpsProfiles.get(i).getHost();URL servicesUrl = new URL(new URL(host), 
> "services/HumanTaskClientAPIAdmin");stub = new 
> HumanTaskClientAPIAdminStub(servicesUrl.toString());ServiceClient client 
> = stub._getServiceClient();authenticate(client, 
> bpsProfiles.get(i).getUsername(), bpsProfiles.get(i).getUsername());
> TTaskSimpleQueryResultSet results = stub.simpleQuery(input);}*
>
> But when I call the stub.simpleQuery() method I am getting an error without 
> any details and when I debugged the code, I found out that it gives a *Method 
> threw 'java.lang.LinkageError' exception. Cannot evaluate 
> org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
> error at auto generated stub method while creating the SOAP envelope.
> Following is the auto generated code for above method.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *public  
> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TTaskSimpleQueryResultSet
>  simpleQuery(
> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TSimpleQueryInput 
> simpleQueryInput587)throws 
> java.rmi.RemoteException
> ,org.wso2.carbon.humantask.stub.upload.IllegalStateFault
> ,org.wso2.carbon.humantask.stub.upload.IllegalArgumentFault{  
> org.apache.axis2.context.MessageContext _messageContext = null;  try{ 
>   org.apache.axis2.client.OperationClient _operationClient = 
> _serviceClient.createClient(_operations[22].getName());  
> _operationClient.getOptions().setAction("http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803/simpleQuery
>  
> ");
>   _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);  
> 
> addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
> // create a message context  _messageContext = new 
> org.apache.axis2.context.MessageContext();// create SOAP envelope 
> with that payload  org.apache.axiom.soap.SOAPEnvelope env = null; 
>org.oasis_open.docs.ns.bpel4people.ws_humantask.api._200803.SimpleQuery 
> dummyWrappedType = null;env = 
> toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), 
>simpleQueryInput587,   
>  dummyWrappedType,   

Re: [Dev] "Method threw 'java.lang.LinkageError' exception" while calling a stub method

2015-09-17 Thread Thusitha Thilina Dayaratne
Hi Chamila,

Linkage error occur due to class loading issues. Most probably same class
might be exported by 2 bundles. Can you check on that?

Thanks
/Thusitha

On Thu, Sep 17, 2015 at 12:52 PM, Chamila Wijayarathna 
wrote:

> Hi Kasun,
>
> I am not getting any error stack-trace.
> When I am remote debugging the code, it assigns
>
> *Method threw 'java.lang.LinkageError' exception. Cannot evaluate 
> org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
>
> as the value of env.
>
> Thanks
>
>
> On Thu, Sep 17, 2015 at 12:46 PM, Kasun Bandara  wrote:
>
>> Hi Chamila,
>>
>> Can you please attach the error stack-trace you are getting ?
>>
>>
>> Thanks.
>>
>> On Thu, Sep 17, 2015 at 9:43 AM, Chamila Wijayarathna 
>> wrote:
>>
>>> Hi all,
>>>
>>> Currently I am trying to call some methods of
>>> BPS-HumanTaskClientAPIAdmin from an IS back end component. To do this I
>>> have added "HumanTaskClientAPIAdmin.wsdl", "ws-humanyask-types.xsd" and
>>> "xml.xsd" files to currently existing service stub at IS, which is 
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub
>>> [1]. I took the HumanTaskClientAPIAdmin.wsdl from a latest BPS pack and
>>> other 2 files from [2].
>>> I newly added following task to the pom.xml of the service stub.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *>> line="-uri src/main/resources/HumanTaskUploader.wsdl -u -uw -o 
>>> target/generated-code -p org.wso2.carbon.humantask.stub.upload -ns2p 
>>> http://services.deployer.humantask.carbon.wso2.org 
>>> =org.wso2.carbon.humantask.stub.upload,http://services.deployer.humantask.carbon.wso2.org/xsd=org.wso2.carbon.humantask.stub.upload.types
>>>  
>>> "/>
>>> >> refid="maven.compile.classpath"/>>> refid="maven.runtime.classpath"/>*
>>>
>>> In my backend component where I need to call the methods of this stub,
>>> we already had a dependency to the stub.
>>>
>>>
>>> **
>>>
>>>
>>>
>>> *org.wso2.carbon.identity
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub*
>>>
>>> Then I added following code to call the service through the stub.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *int tenantId = 
>>> CarbonContext.getThreadLocalCarbonContext().getTenantId();List
>>>  bpsProfiles = 
>>> bpsProfileDAO.listBPSProfiles(tenantId);HumanTaskClientAPIAdminStub stub = 
>>> null;TSimpleQueryInput input = new TSimpleQueryInput();TStatus readyState = 
>>> new TStatus();//TSimpleQueryCategory queryCategory = new 
>>> TSimpleQueryCategory("ALL_TASKS", 
>>> true);readyState.setTStatus("READY");input.addStatus(readyState);input.setPageSize(10);input.setPageNumber(0);input.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);for
>>>  (int i = 0; i < bpsProfiles.size(); i++) {String host = 
>>> bpsProfiles.get(i).getHost();URL servicesUrl = new URL(new URL(host), 
>>> "services/HumanTaskClientAPIAdmin");stub = new 
>>> HumanTaskClientAPIAdminStub(servicesUrl.toString());ServiceClient 
>>> client = stub._getServiceClient();authenticate(client, 
>>> bpsProfiles.get(i).getUsername(), bpsProfiles.get(i).getUsername());
>>> TTaskSimpleQueryResultSet results = stub.simpleQuery(input);}*
>>>
>>> But when I call the stub.simpleQuery() method I am getting an error without 
>>> any details and when I debugged the code, I found out that it gives a 
>>> *Method threw 'java.lang.LinkageError' exception. Cannot evaluate 
>>> org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
>>> error at auto generated stub method while creating the SOAP envelope.
>>> Following is the auto generated code for above method.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *public  
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TTaskSimpleQueryResultSet
>>>  simpleQuery(
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TSimpleQueryInput 
>>> simpleQueryInput587)throws 
>>> java.rmi.RemoteException
>>> ,org.wso2.carbon.humantask.stub.upload.IllegalStateFault
>>> ,org.wso2.carbon.humantask.stub.upload.IllegalArgumentFault{  
>>> org.apache.axis2.context.MessageContext _messageContext = null;  try{   
>>> org.apache.axis2.client.OperationClient _operationClient = 
>>> _serviceClient.createClient(_operations[22].getName());  
>>> 

Re: [Dev] "Method threw 'java.lang.LinkageError' exception" while calling a stub method

2015-09-17 Thread Chamila Wijayarathna
Hi Kasun,

I am not getting any error stack-trace.
When I am remote debugging the code, it assigns

*Method threw 'java.lang.LinkageError' exception. Cannot evaluate
org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*

as the value of env.

Thanks


On Thu, Sep 17, 2015 at 12:46 PM, Kasun Bandara  wrote:

> Hi Chamila,
>
> Can you please attach the error stack-trace you are getting ?
>
>
> Thanks.
>
> On Thu, Sep 17, 2015 at 9:43 AM, Chamila Wijayarathna 
> wrote:
>
>> Hi all,
>>
>> Currently I am trying to call some methods of BPS-HumanTaskClientAPIAdmin
>> from an IS back end component. To do this I have added
>> "HumanTaskClientAPIAdmin.wsdl", "ws-humanyask-types.xsd" and "xml.xsd"
>> files to currently existing service stub at IS, which is 
>> org.wso2.carbon.identity.workflow.mgt.bps.stub
>> [1]. I took the HumanTaskClientAPIAdmin.wsdl from a latest BPS pack and
>> other 2 files from [2].
>> I newly added following task to the pom.xml of the service stub.
>>
>>
>>
>>
>>
>>
>>
>> *> line="-uri src/main/resources/HumanTaskUploader.wsdl -u -uw -o 
>> target/generated-code -p org.wso2.carbon.humantask.stub.upload -ns2p 
>> http://services.deployer.humantask.carbon.wso2.org 
>> =org.wso2.carbon.humantask.stub.upload,http://services.deployer.humantask.carbon.wso2.org/xsd=org.wso2.carbon.humantask.stub.upload.types
>>  
>> "/>
>> > refid="maven.compile.classpath"/>> refid="maven.runtime.classpath"/>*
>>
>> In my backend component where I need to call the methods of this stub, we
>> already had a dependency to the stub.
>>
>>
>> **
>>
>>
>>
>> *org.wso2.carbon.identity
>> org.wso2.carbon.identity.workflow.mgt.bps.stub*
>>
>> Then I added following code to call the service through the stub.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *int tenantId = 
>> CarbonContext.getThreadLocalCarbonContext().getTenantId();List
>>  bpsProfiles = 
>> bpsProfileDAO.listBPSProfiles(tenantId);HumanTaskClientAPIAdminStub stub = 
>> null;TSimpleQueryInput input = new TSimpleQueryInput();TStatus readyState = 
>> new TStatus();//TSimpleQueryCategory queryCategory = new 
>> TSimpleQueryCategory("ALL_TASKS", 
>> true);readyState.setTStatus("READY");input.addStatus(readyState);input.setPageSize(10);input.setPageNumber(0);input.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);for
>>  (int i = 0; i < bpsProfiles.size(); i++) {String host = 
>> bpsProfiles.get(i).getHost();URL servicesUrl = new URL(new URL(host), 
>> "services/HumanTaskClientAPIAdmin");stub = new 
>> HumanTaskClientAPIAdminStub(servicesUrl.toString());ServiceClient client 
>> = stub._getServiceClient();authenticate(client, 
>> bpsProfiles.get(i).getUsername(), bpsProfiles.get(i).getUsername());
>> TTaskSimpleQueryResultSet results = stub.simpleQuery(input);}*
>>
>> But when I call the stub.simpleQuery() method I am getting an error without 
>> any details and when I debugged the code, I found out that it gives a 
>> *Method threw 'java.lang.LinkageError' exception. Cannot evaluate 
>> org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
>> error at auto generated stub method while creating the SOAP envelope.
>> Following is the auto generated code for above method.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *public  
>> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TTaskSimpleQueryResultSet
>>  simpleQuery(
>> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TSimpleQueryInput 
>> simpleQueryInput587)throws 
>> java.rmi.RemoteException
>> ,org.wso2.carbon.humantask.stub.upload.IllegalStateFault
>> ,org.wso2.carbon.humantask.stub.upload.IllegalArgumentFault{  
>> org.apache.axis2.context.MessageContext _messageContext = null;  try{
>>org.apache.axis2.client.OperationClient _operationClient = 
>> _serviceClient.createClient(_operations[22].getName());  
>> _operationClient.getOptions().setAction("http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803/simpleQuery
>>  
>> ");
>>   _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); 
>>  
>> addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
>> // create a message context   

Re: [Dev] "Method threw 'java.lang.LinkageError' exception" while calling a stub method

2015-09-17 Thread Hasunie Adikari
Hi Chamila,

You likely included jars multiple times. The linkageErrors you see are from
the same name class being loaded in two different ways by two different
loaders on the same name. Make sure you don't include any extra jars.If you
can find what is the exact dependency,you can modify it with the scope
provided.so Maven doesn't try to multiple-load it.



On Thu, Sep 17, 2015 at 1:24 PM, Thusitha Thilina Dayaratne <
thusit...@wso2.com> wrote:

> Hi Chamila,
>
> Linkage error occur due to class loading issues. Most probably same class
> might be exported by 2 bundles. Can you check on that?
>
> Thanks
> /Thusitha
>
> On Thu, Sep 17, 2015 at 12:52 PM, Chamila Wijayarathna 
> wrote:
>
>> Hi Kasun,
>>
>> I am not getting any error stack-trace.
>> When I am remote debugging the code, it assigns
>>
>> *Method threw 'java.lang.LinkageError' exception. Cannot evaluate 
>> org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
>>
>> as the value of env.
>>
>> Thanks
>>
>>
>> On Thu, Sep 17, 2015 at 12:46 PM, Kasun Bandara  wrote:
>>
>>> Hi Chamila,
>>>
>>> Can you please attach the error stack-trace you are getting ?
>>>
>>>
>>> Thanks.
>>>
>>> On Thu, Sep 17, 2015 at 9:43 AM, Chamila Wijayarathna 
>>> wrote:
>>>
 Hi all,

 Currently I am trying to call some methods of
 BPS-HumanTaskClientAPIAdmin from an IS back end component. To do this I
 have added "HumanTaskClientAPIAdmin.wsdl", "ws-humanyask-types.xsd" and
 "xml.xsd" files to currently existing service stub at IS, which is 
 org.wso2.carbon.identity.workflow.mgt.bps.stub
 [1]. I took the HumanTaskClientAPIAdmin.wsdl from a latest BPS pack
 and other 2 files from [2].
 I newly added following task to the pom.xml of the service stub.







 *>>> line="-uri src/main/resources/HumanTaskUploader.wsdl -u -uw -o 
 target/generated-code -p org.wso2.carbon.humantask.stub.upload -ns2p 
 http://services.deployer.humantask.carbon.wso2.org 
 =org.wso2.carbon.humantask.stub.upload,http://services.deployer.humantask.carbon.wso2.org/xsd=org.wso2.carbon.humantask.stub.upload.types
  
 "/>
 >>> refid="maven.compile.classpath"/>>>> refid="maven.runtime.classpath"/>*

 In my backend component where I need to call the methods of this stub,
 we already had a dependency to the stub.


 **



 *org.wso2.carbon.identity
 org.wso2.carbon.identity.workflow.mgt.bps.stub*

 Then I added following code to call the service through the stub.




















 *int tenantId = 
 CarbonContext.getThreadLocalCarbonContext().getTenantId();List
  bpsProfiles = 
 bpsProfileDAO.listBPSProfiles(tenantId);HumanTaskClientAPIAdminStub stub = 
 null;TSimpleQueryInput input = new TSimpleQueryInput();TStatus readyState 
 = new TStatus();//TSimpleQueryCategory queryCategory = new 
 TSimpleQueryCategory("ALL_TASKS", 
 true);readyState.setTStatus("READY");input.addStatus(readyState);input.setPageSize(10);input.setPageNumber(0);input.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);for
  (int i = 0; i < bpsProfiles.size(); i++) {String host = 
 bpsProfiles.get(i).getHost();URL servicesUrl = new URL(new URL(host), 
 "services/HumanTaskClientAPIAdmin");stub = new 
 HumanTaskClientAPIAdminStub(servicesUrl.toString());ServiceClient 
 client = stub._getServiceClient();authenticate(client, 
 bpsProfiles.get(i).getUsername(), bpsProfiles.get(i).getUsername());
 TTaskSimpleQueryResultSet results = stub.simpleQuery(input);}*

 But when I call the stub.simpleQuery() method I am getting an error 
 without any details and when I debugged the code, I found out that it 
 gives a *Method threw 'java.lang.LinkageError' exception. Cannot evaluate 
 org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
 error at auto generated stub method while creating the SOAP envelope.
 Following is the auto generated code for above method.























































































































 *public  

Re: [Dev] "Method threw 'java.lang.LinkageError' exception" while calling a stub method

2015-09-17 Thread Kasun Bandara
Hi Chamila,

AFAIK, Linkage error prompts when two classloaders loading the same class
and one component in one classloader wants to talk to other component in
other classloader using this common class. To fix the issue, ensure that
the required class you are referring is loaded only by one classloader.

Thanks,
KasunB.





On Thu, Sep 17, 2015 at 12:52 PM, Chamila Wijayarathna 
wrote:

> Hi Kasun,
>
> I am not getting any error stack-trace.
> When I am remote debugging the code, it assigns
>
> *Method threw 'java.lang.LinkageError' exception. Cannot evaluate 
> org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
>
> as the value of env.
>
> Thanks
>
>
> On Thu, Sep 17, 2015 at 12:46 PM, Kasun Bandara  wrote:
>
>> Hi Chamila,
>>
>> Can you please attach the error stack-trace you are getting ?
>>
>>
>> Thanks.
>>
>> On Thu, Sep 17, 2015 at 9:43 AM, Chamila Wijayarathna 
>> wrote:
>>
>>> Hi all,
>>>
>>> Currently I am trying to call some methods of
>>> BPS-HumanTaskClientAPIAdmin from an IS back end component. To do this I
>>> have added "HumanTaskClientAPIAdmin.wsdl", "ws-humanyask-types.xsd" and
>>> "xml.xsd" files to currently existing service stub at IS, which is 
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub
>>> [1]. I took the HumanTaskClientAPIAdmin.wsdl from a latest BPS pack and
>>> other 2 files from [2].
>>> I newly added following task to the pom.xml of the service stub.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *>> line="-uri src/main/resources/HumanTaskUploader.wsdl -u -uw -o 
>>> target/generated-code -p org.wso2.carbon.humantask.stub.upload -ns2p 
>>> http://services.deployer.humantask.carbon.wso2.org 
>>> =org.wso2.carbon.humantask.stub.upload,http://services.deployer.humantask.carbon.wso2.org/xsd=org.wso2.carbon.humantask.stub.upload.types
>>>  
>>> "/>
>>> >> refid="maven.compile.classpath"/>>> refid="maven.runtime.classpath"/>*
>>>
>>> In my backend component where I need to call the methods of this stub,
>>> we already had a dependency to the stub.
>>>
>>>
>>> **
>>>
>>>
>>>
>>> *org.wso2.carbon.identity
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub*
>>>
>>> Then I added following code to call the service through the stub.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *int tenantId = 
>>> CarbonContext.getThreadLocalCarbonContext().getTenantId();List
>>>  bpsProfiles = 
>>> bpsProfileDAO.listBPSProfiles(tenantId);HumanTaskClientAPIAdminStub stub = 
>>> null;TSimpleQueryInput input = new TSimpleQueryInput();TStatus readyState = 
>>> new TStatus();//TSimpleQueryCategory queryCategory = new 
>>> TSimpleQueryCategory("ALL_TASKS", 
>>> true);readyState.setTStatus("READY");input.addStatus(readyState);input.setPageSize(10);input.setPageNumber(0);input.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);for
>>>  (int i = 0; i < bpsProfiles.size(); i++) {String host = 
>>> bpsProfiles.get(i).getHost();URL servicesUrl = new URL(new URL(host), 
>>> "services/HumanTaskClientAPIAdmin");stub = new 
>>> HumanTaskClientAPIAdminStub(servicesUrl.toString());ServiceClient 
>>> client = stub._getServiceClient();authenticate(client, 
>>> bpsProfiles.get(i).getUsername(), bpsProfiles.get(i).getUsername());
>>> TTaskSimpleQueryResultSet results = stub.simpleQuery(input);}*
>>>
>>> But when I call the stub.simpleQuery() method I am getting an error without 
>>> any details and when I debugged the code, I found out that it gives a 
>>> *Method threw 'java.lang.LinkageError' exception. Cannot evaluate 
>>> org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
>>> error at auto generated stub method while creating the SOAP envelope.
>>> Following is the auto generated code for above method.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *public  
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TTaskSimpleQueryResultSet
>>>  simpleQuery(
>>> org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TSimpleQueryInput 
>>> simpleQueryInput587)throws 
>>> java.rmi.RemoteException
>>> ,org.wso2.carbon.humantask.stub.upload.IllegalStateFault
>>> ,org.wso2.carbon.humantask.stub.upload.IllegalArgumentFault{  
>>> org.apache.axis2.context.MessageContext _messageContext 

[Dev] "Method threw 'java.lang.LinkageError' exception" while calling a stub method

2015-09-16 Thread Chamila Wijayarathna
Hi all,

Currently I am trying to call some methods of BPS-HumanTaskClientAPIAdmin
from an IS back end component. To do this I have added
"HumanTaskClientAPIAdmin.wsdl", "ws-humanyask-types.xsd" and "xml.xsd"
files to currently existing service stub at IS, which is
org.wso2.carbon.identity.workflow.mgt.bps.stub
[1]. I took the HumanTaskClientAPIAdmin.wsdl from a latest BPS pack and
other 2 files from [2].
I newly added following task to the pom.xml of the service stub.







*
http://services.deployer.humantask.carbon.wso2.org
=org.wso2.carbon.humantask.stub.upload,http://services.deployer.humantask.carbon.wso2.org/xsd=org.wso2.carbon.humantask.stub.upload.types
"/>
   *

In my backend component where I need to call the methods of this stub, we
already had a dependency to the stub.


**



*org.wso2.carbon.identity
org.wso2.carbon.identity.workflow.mgt.bps.stub*

Then I added following code to call the service through the stub.




















*int tenantId =
CarbonContext.getThreadLocalCarbonContext().getTenantId();List
bpsProfiles = 
bpsProfileDAO.listBPSProfiles(tenantId);HumanTaskClientAPIAdminStub
stub = null;TSimpleQueryInput input = new TSimpleQueryInput();TStatus
readyState = new TStatus();//TSimpleQueryCategory queryCategory = new
TSimpleQueryCategory("ALL_TASKS",
true);readyState.setTStatus("READY");input.addStatus(readyState);input.setPageSize(10);input.setPageNumber(0);input.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);for
(int i = 0; i < bpsProfiles.size(); i++) {String host =
bpsProfiles.get(i).getHost();URL servicesUrl = new URL(new
URL(host), "services/HumanTaskClientAPIAdmin");stub = new
HumanTaskClientAPIAdminStub(servicesUrl.toString());ServiceClient
client = stub._getServiceClient();authenticate(client,
bpsProfiles.get(i).getUsername(), bpsProfiles.get(i).getUsername());
 TTaskSimpleQueryResultSet results = stub.simpleQuery(input);}*

But when I call the stub.simpleQuery() method I am getting an error
without any details and when I debugged the code, I found out that it
gives a *Method threw 'java.lang.LinkageError' exception. Cannot
evaluate org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl.toString()*
error at auto generated stub method while creating the SOAP envelope.
Following is the auto generated code for above method.























































































































*public  
org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TTaskSimpleQueryResultSet
simpleQuery(
org.wso2.carbon.identity.workflow.mgt.bps.stub.types.TSimpleQueryInput
simpleQueryInput587)throws
java.rmi.RemoteException
,org.wso2.carbon.humantask.stub.upload.IllegalStateFault
 ,org.wso2.carbon.humantask.stub.upload.IllegalArgumentFault{
org.apache.axis2.context.MessageContext _messageContext = null;
try{   org.apache.axis2.client.OperationClient _operationClient =
_serviceClient.createClient(_operations[22].getName());
_operationClient.getOptions().setAction("http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803/simpleQuery
");
 _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
   // create a message context  _messageContext = new
org.apache.axis2.context.MessageContext();// create SOAP
envelope with that payload  org.apache.axiom.soap.SOAPEnvelope env
= null;
org.oasis_open.docs.ns.bpel4people.ws_humantask.api._200803.SimpleQuery
dummyWrappedType = null;
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
   simpleQueryInput587,
dummyWrappedType,
  optimizeContent(new
javax.xml.namespace.QName("http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803
",
  "simpleQuery")));
//adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);// set the message context
with that soap envelope_messageContext.setEnvelope(env);// add the
message contxt to the operation
client_operationClient.addMessageContext(_messageContext);//execute
the operation client_operationClient.execute(true);
org.apache.axis2.context.MessageContext _returnMessageContext =
_operationClient.getMessageContext(
org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv =
_returnMessageContext.getEnvelope();
 java.lang.Object object = fromOM(