Hi Imesh,

It didn't solve the problem. Now the exception comes is as follows.

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
Expected a string but was BEGIN_OBJECT at line 1 column 125

The result string is as follows.

[{"category":"data","description":"tomcat1
Cartridge","displayName":"tomcat1","host":"tomcat1.stratos.org
","metadataKeys":[{"@xsi.nil":"true"}],"multiTenant":false,"provider":"apache","public":false,"type":"tomcat1","version":7}]

I think it is expecting an array of Strings not objects.

Thanks.

On Mon, Mar 9, 2015 at 2:48 PM, Imesh Gunaratne <[email protected]> wrote:

> Adding a new property to the following arrayKeys definition would solve
> this problem:
>
> <bean id="jsonProvider" 
> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>     ...
>     <property name="arrayKeys">
>         <list>
>             <value>partitions</value>
>             <value>property</value>
>             <value>hostNames</value>
>             <value>memberMap</value>
>             <value>portMap</value>
>             <value>partitionGroup</value>
>             <value>partition</value>
>             <value>member</value>
>             <value>hostNames</value>
>             <value>portMappings</value>
>             <value>volumes</value>
>             <value>domains</value>
>             <value>kubernetesHost</value>
>             <value>cartridges</value>
>             <value>subGroups</value>
>             <value>groups</value>
>             <value>clusters</value>
>             <value>startupOrders</value>
>             <value>childPolicies</value>
>             <value>childLevelNetworkPartition</value>
>             <value>childLevelPartitions</value>
>             <value>networkPartition</value>
>             <value>partitions</value>
>             <value>dependencyAliases</value>
>             <value>groupInstances</value>
>             <value>clusterInstances</value>
>             <value>applicationInstances</value>
>             <value>accessUrls</value>
>             <value>kubernetesServices</value>
>             <value>publicIPs</value>
>             <value>ports</value>
>
>         </list>
>     </property>
> </bean>
>
>
> On Mon, Mar 9, 2015 at 12:28 PM, Vishanth Balasubramaniam <
> [email protected]> wrote:
>
>> Hi Dinithi,
>>
>> The output of the metadataKeys is a string array or an object array?
>>
>> Please refer [1] and check if that is the issue
>> [1] -
>> http://stackoverflow.com/questions/21374603/com-google-gson-jsonsyntaxexception-java-lang-illegalstateexception-in-android
>>
>> Thank you,
>> Vishanth.
>>
>> On Mon, Mar 9, 2015 at 12:09 PM, Imesh Gunaratne <[email protected]>
>> wrote:
>>
>>> May be "metadataKeys" property is not marked as an array in CXF
>>> configuration in REST API web application. When there is only one element
>>> available, CXF does not return an array unless this configuration is there.
>>>
>>> On Mon, Mar 9, 2015 at 12:04 PM, Dinithi De Silva <[email protected]>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> While listing the available cartridges using CLI command
>>>> "list-cartridges" I got the following exception.
>>>>
>>>> com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
>>>> Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 112
>>>>
>>>> The response string was as follows.
>>>>
>>>> [{"category":"data","description":"php
>>>> Cartridge","displayName":"php","host":"php.stratos.org
>>>> ","metadataKeys":{"@xsi.nil":"true"},"multiTenant":false,"provider":"apache","public":false,"type":"php","version":7}]
>>>>
>>>> The expected output for metadataKeys is an array.
>>>>
>>>> What could be the reason for this?
>>>>
>>>>
>>>> --
>>>> *Dinithi De Silva*
>>>> Associate Software Engineer, WSO2 Inc.
>>>> m:+94716667655 | e:[email protected] | w: www.wso2.com
>>>> | a: #20, Palm Grove, Colombo 03
>>>>
>>>
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>>
>> --
>> *Vishanth Balasubramaniam*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94771737718*
>> about me: *http://about.me/vishanth <http://about.me/vishanth>*
>>
>>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>



-- 
*Dinithi De Silva*
Associate Software Engineer, WSO2 Inc.
m:+94716667655 | e:[email protected] | w: www.wso2.com
| a: #20, Palm Grove, Colombo 03

Reply via email to