I am creating a customization file for OSB, and I would need to add an alert in this, so whenever it is loaded, the affected resources are modified to include those alerts.
So far I have followed instructions explained in See Example - Adding and Deleting SLA Alert Rules. I have created a customization file with the same structure than the example (actions - add - value), just changing the value for the alert or even using the one shown in the example.
Anyway, when I try to apply this customization file on OSB, I always get the error:
org.apache.xmlbeans.impl.values.XmlAnyTypeImpl cannot be cast to
com.oracle.xmlns.servicebus.monitoring.alert.AlertRuleDocument
My customization file is:
<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes" xmlns:aler="http://www.bea.com/wli/monitoring/alert">
<cus:customization xsi:type="cus:EnvValueActionsCustomizationType">
<cus:description>Alertes Generals de ProxyService</cus:description>
<cus:owners>
<xt:ownerQuery>
<xt:resourceTypes>ProxyService</xt:resourceTypes>
<xt:refsToSearch xsi:type="xt:LocationRefType">
<xt:type>Folder</xt:type>
<xt:path>bus_ver/EA</xt:path>
</xt:refsToSearch>
</xt:ownerQuery>
</cus:owners>
<cus:actions>
<xt:add>
<xt:envValueType>Service SLA Alert Rule</xt:envValueType>
<xt:location>AverageResponse</xt:location>
<xt:value>
<aler:alertRule enabled="true" name="prova"> <aler:description>provades</aler:description> <aler:expirationDate>2016-03-31+02:00</aler:expirationDate>
<aler:startTime>00:00:00.000+01:00</aler:startTime>
<aler:endTime>00:05:00.000+01:00</aler:endTime>
<aler:frequency>every-time</aler:frequency>
<aler:severity>normal</aler:severity>
<aler:stopProcessing>false</aler:stopProcessing>
<aler:condition aggregation-interval="10">
<con1:monCondExpr xmlns:con1="http://xmlns.oracle.com/servicebus/monitoring/alert/condition">
<con1:function>count</con1:function>
<con1:lhs>Operation.peticionSincrona.error-count</con1:lhs>
<con1:operator>=</con1:operator>
<con1:rhs>1</con1:rhs>
</con1:monCondExpr>
</aler:condition>
<aler:alertDestination ref="bus_ver/AlertaProva"/>
</aler:alertRule>
</xt:value>
</xt:add>
</cus:actions>
</cus:customization>
</cus:Customizations>
Does anyone know how to solve this or maybe I am doing something unproperly?
Thanks for your help.
Finally I made work a customization file with an alert like this:
<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes" xmlns:aler="http://xmlns.oracle.com/servicebus/monitoring/alert">
<cus:customization xsi:type="cus:EnvValueActionsCustomizationType">
<cus:description>Alertes Generals de ProxyService</cus:description>
<cus:owners>
<xt:ownerQuery>
<xt:resourceTypes>ProxyService</xt:resourceTypes>
<xt:refsToSearch xsi:type="xt:LocationRefType">
<xt:type>Folder</xt:type>
<xt:path>bus_ver/EA</xt:path>
</xt:refsToSearch>
</xt:ownerQuery>
</cus:owners>
<cus:actions>
<xt:replace>
<xt:envValueType>Service SLA Alert Rule List</xt:envValueType>
<xt:value>
<aler:alertRules>
<aler:alertRule enabled="true" name="prova" xmlns:ser="http://www.bea.com/wli/sb/services" xmlns:con="http://www.bea.com/wli/sb/services/security/config" xmlns:oper="http://xmlns.oracle.com/servicebus/proxy/operations" xmlns:env="http://www.bea.com/wli/config/env" xmlns:tran="http://www.bea.com/wli/sb/transports">
<aler:description>provades</aler:description>
<aler:expirationDate>2016-03-31+02:00</aler:expirationDate>
<aler:startTime>00:00:00.000+01:00</aler:startTime>
<aler:endTime>00:05:00.000+01:00</aler:endTime>
<aler:frequency>every-time</aler:frequency>
<aler:severity>normal</aler:severity>
<aler:stopProcessing>false</aler:stopProcessing>
<aler:condition aggregation-interval="10">
<con1:monCondExpr xmlns:con1="http://xmlns.oracle.com/servicebus/monitoring/alert/condition">
<con1:function>count</con1:function>
<con1:lhs>Operation.peticionSincrona.error-count</con1:lhs>
<con1:operator>=</con1:operator>
<con1:rhs>1</con1:rhs>
</con1:monCondExpr>
</aler:condition>
<aler:alertDestination ref="bus_ver/AlertaProva"/>
</aler:alertRule>
</aler:alertRules>
</xt:value>
</xt:replace>
</cus:actions>
</cus:customization>
Main differences that provoked error in initial XML: