Showing posts with label Finds. Show all posts
Showing posts with label Finds. Show all posts

Tuesday, October 11, 2011

View stale Instances in SOA 10g/11g - Update

I just had a comment from one of my readers. The comment had a question if the instances could be recovered by deploying the same version of the composite. I had another blog post on the state of bpel instances.

I tried changing the state from 9 to 5 in the CUBE_INSTANCE and could see the instance become active. I tried this in 11g and it worked. This can be used in 10g to recover the stale instances.


Cheers,
-AR

Wednesday, December 29, 2010

FOTY0001: Type Error

I have encountered the below error during runtime many a time:

ORABPEL-09500
XPath expression failed to execute.
Error while processing xpath expression, the expression is "ora:processXSLT('Transformation_5.xsl',bpws:getVariableData('inputVariable','payload'))", the reason is FOTY0001: type error. Please verify the xpath query.

This error, though mentions the reason for failure was due to a xpath expression, when one executes the xslt using xalan or test option of Jdeveloper, the xslt works fine. I later found that the part name was missing in the transformation node where the xsl was used. This could be because, the bpel file was edited prematurely even before the details of the node were loaded or could be an actual issue with the schema (in case of first timers)!

Always check if the part name in the transformation node are present and are correct before debugging further on this error. I found the this link useful when I was debugging.

Please note this is only one such FOTY0001 error (most common) and one such solution which worked for me. There could be many other reasons for the error in different scenarios and hence different resolutions.

Cheers,
-AR

Thursday, September 30, 2010

Re-generation of facts fail when Java facts originating from same Schema exits

Re-generation of facts in a dictionary in Oracle Business Rules 11g is a simple step. One needs to just update the schema and reload the facts from the options available in the Fact tab of the dictionary. Unfortunately, I had been struggling for more than two weeks on this simple step and any change in schema, be it addition/deletion of an element or change in an element's type, the facts in the dictionary were so glued to the dictionary that, they refused to update !

I pondered over a lot of options and tried a lot of workarounds/suggestions:

  • Re-created the schema and imported the schema again into Jdeveloper
  • Cleaned the temporary files in windows which Jdeveloper creates, stores and uses, available under an user's profile
  • Reloaded the facts in the dictionary in a different package (not the default). This updated the facts but all the existing reference in the dictionary had errors in them
  • I even re-designed the schema based on one of my earlier posts
 All my efforts were futile and we had in the meanwhile a SR open with Oracle and we were getting some directions from them. Finally, Oracle found that we had been using a java fact created from the same schema  and imported via a jar, which was the issue!

Since the jaxb objects were the same, they was issue in refreshing the xml facts when a java fact belonging to same schema existed in the same dictionary. Below are the steps to be followed when a xml fact has to be refreshed (as in the case mentioned above):

  1. Exit Jdeveloper
  2. Remove the jar referenced to import the java fact (from hard disk)
  3. Start Jdeveloper, remove the jar from project reference
  4. Update the schema (preferably, open the schema and update contents instead of a replace of .xsd file)
  5. Save all artifacts and run a clean up (not necessary, just a feel good factor) from Build>CleanAll
  6. Reload facts from updated Schema and check for the same (in case not refreshed, close Jdeveloper and try cleaning workspace)
  7. Update the jar with the update schema and reference it in the project properties
Good to move on now !!

Peace!

Cheers,
-AR

Sunday, September 5, 2010

Schema design - when Schema is to be used for dictionary

Quite recently, I was struggling with an issue that Tree Mode in Oracle Business Rules was not working. This was not definitely the first time I was working with Tree Mode and I had used it before successfully. In the project where I noticed the issue, the tree mode expression assigned by JDeveloper was weird. Usually its the dots and slashes that you notice in a tree mode, but here, it was dollars.

For instance, consider an order having many order lines. When you refer to orderlinenumber within the order line, the tree mode in my project with issues looked like $Order$OrderLine$OrderLineNumber. In an usual case, it would have been Order/OrderLine.OrderLineNumber.

I then compared the project which worked fine with my current project. The issue was with the facts generated and hence the XSDs created in both the projects. The first project had a complex type defined for every element and that element had in its type the complex type definition. However, in the current project, there was no complex type defined and elements were defined individually and referenced within each other. This is still valid as per W3C standards. The XSD in both cases were as below:











The change in XSD also changed the way the facts were created. The facts in the first case were created based on the elements where as in the second case, it was the Complex types that was used by the Jaxb to create the facts !

Peace !

Cheers,
-AR

Tuesday, August 10, 2010

The rete network does not update the modified data

This is a case where there is a dictionary D1 which is being invoked from BPEL. A set of facts F1, is passed to D1 and the same is returned from D1. There also exists D2, which uses the same set of facts as D1. D2 is invoked from the decision function of D1 (after D2 has been linked to D1, obviously !). I get F1 into D1 and I make a call to D2. D2 modifies F1 to F1.1 and returns call to D1. However, D1 does not understand F1 has changed to F1.1 and since it has been initialized with F1, continues to process the rules with F1 and F1.1 is not all considered.

This has been confirmed to be an inconsistent behavior from the rete network and rules engine and it has been identified as a bug. It would be fixed in the future releases (not sure of the release). Till if you face the same issue, you can survive with two workarounds:

A: Make call outs to rules from BPEL
  1. Call D1 from BPEL, execute rules in D1
  2. Instead of calling D2 from D1, call D2 from BPEL
  3. Then call D1 again. The rete network in this case initializes D1 with facts available in Step2
B: Assert the facts in D2 before returning control to D1
  1. Call D1, then D2 from decision function of D1
  2. Modify F1 to F1.1 in D2
  3. Using advanced functions do a assert and return of F1.1 (this makes the rete refresh the facts)
  4. Return control to D1 and proceed

Keep tracking this thread for the update on the bug and fix for the same !

Peace!

Cheers,
- AR

Monday, August 9, 2010

Reducing the size of dictionaries

I was working on a case study where I had to create close to 10 dictionaries, each of them having the same facts being passed to them. The XSD I was using was of a considerable size, say 27KB and the XML generated from it was 15KB. When the facts were created the dictionary size came to 1.3 MB. So since each of these dictionaries had facts imported in them, each was about 1.3 MB and so the entire .jar file post compiling was about 15 MB.

This was a simple 10 dictionaries in a project case. Consider 50-60 dictionaries and each of size 1 MB. The project would take about 20 minutes to deploy, considering my case study took 6 minutes to deploy. Maintenance becomes an issue here and SOA server after deployment becomes slow and unstable.

Alternative is, have the facts in one dictionary. Link this dictionary to all other dictionaries using the same facts and use the imported facts in rules. This reduces the size of the dictionaries considerably. Statistically, for my case study, the size of one of the dictionary (where facts were present) remained the same. The size of the others came down to 500KB (depends on decision table number, no.of rules etc) approx. The size of the entire deployable was halved.

Peace !

Cheers,
- AR

Wednesday, June 23, 2010

Fields with type int and decimal when sent in the input to Rules do not out come as in input

I created a BPEL Process which receives a XML payload which has fields of type int as well as decimal, as defined in the XSD that the payload is derived from. These fields, part of the payload, are sent in the input to Rules Dictionary using decision service activity from BPEL. In the input to rules, the XML has a couple of fields of type "int" and couple of fields of type "decimal" and the three of them are sent as empty/null. In the output from the rules however, the fields of type "int" have value of zero and fields of type "decimal" do not come out at all, even though they were empty/null and present in the input.

In the below sample, <client:DuplicateMobile/> , <client:DuplicateLan/> and  <client:DuplicateBill/> are sent as null. DuplicateMobile and DuplicateLan are of type "int" and DuplicateBill is of type "decimal". No actions are performed on these fields/facts within the rules. The input and output looks like below:


################################### Input ########################
Facts_To_BPEL_Var

<dsIn>
<part name="payload">
<callFunctionStateless name="Sample1_DecisionService_1">
<parameterList>
<Person>
<client:Name>
<client:firstName>A</client:firstName>
<client:lastName>A</client:lastName>
</client:Name>
<client:address>
<client:lineOne>1</client:lineOne>
<client:lineTwo>2</client:lineTwo>
<client:city>3</client:city>
</client:address>
<client:Phone>
<client:Mobile>4455</client:Mobile>
<client:Lan>4466</client:Lan>
<client:DuplicateMobile/>
<client:DuplicateLan/>
<client:DuplicateBill/>
<client:Bill>500</client:Bill>
</client:Phone>
<client:Status>Open</client:Status>
</Person>
</parameterList>
</callFunctionStateless>
</part>
</dsIn>
################################### End Input ########################

################################### Output ########################
replyOutput

<RulesInput>
<Person>
<Name>
<firstName>A</firstName>
<lastName>A</lastName>
</Name>
<address>
<lineOne>1</lineOne>
<lineTwo>2</lineTwo>
<city>3</city>
</address>
<Phone>
<Mobile>4455</Mobile>
<Lan>4466</Lan>
<Bill>500</Bill>
<DuplicateMobile>0</DuplicateMobile>
<DuplicateLan>0</DuplicateLan>
</Phone>
<Status>Approved</Status>
</Person>
</RulesInput>
################################### End Output ########################


I have raised a Service Request with Oracle and they have confirmed it to be a be a bug (Bug 9794889: BLANK DECIMAL FIELD INPUT TO RULES ENGINE GETS REMOVED). I do not have the resolution yet and I will update as and when I have one. If somebody is facing the same issue, workaround the issue by modifying the output from rules using a XSLT, before it is processes further !

Peace !

Cheers,
-AR

Monday, June 21, 2010

Expose Dictionaries as Composite Service

I had the discussed cases where decision services were exposed as web services, that could be consumed by BPEL or a Java Client. The dictionary itself, can be exposed as a Composite Service by checking the option as shown below, meaning, you do not need a BPEL to invoke the rules and the consumer can directly pass the payload to the decision service/dictionary and get the output.















I worked on such a case, and I had some issues in hitting the Composite Service. Once the project has been developed and deployed, you can use any web service testing tool to test it. I used SoapUI in this case. I imported the WSDL, created a request and hit the web service using the option of "callFunctionStateless" (the SoapUI created two methods - callFunctionStateless and callFunctionStateful). I got an error as below:


<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <env:Fault xmlns:fpre="http://xmlns.oracle.com/bpel/rules">
         <faultcode>fpre:operationErroredFault</faultcode>
         <faultstring/>
         <faultactor/>
         <detail>
            <errorInfo xmlns="http://xmlns.oracle.com/bpel/rules">
               <errorMessage>RulesWithoutBPEL</errorMessage>
            </errorInfo>
         </detail>
      </env:Fault>
   </env:Body>
</env:Envelope>

I then realized that under the soap:Body, there is a method by name <orac:callFunctionStateless name="">. In the attribute, the name of the decision service which has been exposed as web service should be given. It worked after that !


Peace!

Cheers,
-AR

Friday, June 18, 2010

Special Characters like !,@,#,& in Bucket Sets not supported

Its been quite sometime that I had been working on Oracle Business Rules. I noticed that when configuring aliases in the project with the use of bucket sets, few of the characters were not supported in the bucket set. When these characters were used in bucket sets, and when choosing the alias in decision table actions, the alias was not available, but the value of that alias was only available. I have shown the issue below.

However, this should does not stop one from using these characters. The alias may not be available in the decision table actions, but the decision table works alright. Also, this issue is not spotted when we use the bucket set in conditions and we can choose the alias in conditions. So you can go ahead and use it, compromising on the fact that, the alias would not be available in the decision table.

Bucket Set defined:
 









Bucket Set used in Decision Table Actions:











Bucket Set used in Decision Table Conditions:











Note: I had raised an Oracle SR and what is stated above was confirmed in the SR. Have pasted the SR update below:

In a decision table you can use either bucket alias or bucket name . If your alias contains special chars then you must use the bucket name . OR Set the bucket alias to contain only letters and number and there will be no problems at all . This is not yet in any doc - is just the update to the bug that will be merged to official documentation.


Peace !

Cheers,
-AR

Wednesday, June 16, 2010

Decision Table changes become slow with Tree Mode on

I had a post on Tree Mode in OBR recently. I also did notice that the Jdeveloper became slow, sometimes unresponsive to changes being done in the dictionary when the option of Tree Mode was selected in the decision functions, that existed in the dictionary. I was able to work around that problem and I am now doing the below, when working with decision functions that use tree mode:
  1. In the decision function of the decision table, uncheck the option tree mode temporarily
  2. Make the changes in the decision table. The speed with which the changes reflect now will be the same as what it was initially
  3. Make Sure, once the changes are done, the tree mode option is checked in the decision function
Even if you forget to check the option again in the decision table, no worries. Rule engine will not validate the dictionary and would not let the project to be deployed. The reason why the changes become slow when the tree mode is selected is not yet known officially, but my guess is that, the rule engine tries to validate the payload for changes in the tree mode, which means it has to iterate through all the elements. In the other case, the payload and definition must have been cached.

Peace!

Cheers,
-AR

Monday, June 14, 2010

View stale Instances in SOA 10g/11g

If you had re-deployed a BPEL Process in 10g, the instances that were available before the re-deployment, would have become stale (grayed out) and you would not be able to see the Flow/Audit Trail. There will be an error stating "revision for the instance # was not loaded by the domain...XXProcess revision 1.0 may have been deleted from the domain manually; in this case the domain would not have been able to mark all instances belonging to the process as stale". You can however, view the instance by clicking on "View Raw XML" from the audit table, in the XML form.

In 11g, this problem seems to have been overcome. The instances of the composite can be viewed from the Audit Trail/Flow tab even though the instance has been marked "Stale", like seeing any active instance of a composite.

Peace!

Cheers,
-AR

Friday, June 11, 2010

Unable to copy rules within decision table – Table locked error

Decision table is an easy to understand and the best means to depict your conditions when you are validating against many facts and asserting more than fact, as a result. But, if there too many rules that you need to configure, it becomes a mundane task to create rules in a decision table. The simplest way we all know to replicate something is a copy-paste and rules is no different. The decision table has an option "copy" when you right click on a rule. But when try to copy and paste a rule, you get an error:









I had raised a SR with Oracle and I was informed that this option would be removed from Rules UI, in the future releases of OBR.

I found another easier option to replicate rules. For instance, if you have configured a rule asserting/modifying many facts in the actions based on a boolean condition and you would want to replicate the actions for other condition of boolean expression, try selecting both true/false in conditions and then split the cell (right click on condition to find the option "Split Selected Cell"). This will create two rules identical to each other, one for boolean expression true and other, false !

Peace!

Cheers,
-AR

Thursday, June 10, 2010

Tree Mode in Oracle Business Rules 11g

I was struggling sometime last week with an issue in using the "Tree Mode" option in the decision table of a dictionary in Oracle Business Rules 11g (OBR). I selected the tree mode option in the decision table and selected the root for the tree mode also. I configured my decision table as required and that did not have any errors. However, there was some error in dictionary validation like:

RUL-05162: The rule set "ACU" requires fact type "ServiceType", but this type is not part of the input.
TEST/Data Model/Decision Function(TEST_DecisionService_1)
RUL-05162: The rule set "UCS" requires fact type "ServiceType", but this type is not part of the input.
TEST/Data Model/Decision Function(TEST_DecisionService_1)
RUL-05162: The rule set "AMB" requires fact type "ServiceType", but this type is not part of the input.
TEST/Data Model/Decision Function(TEST_DecisionService_1)
RUL-05162: The rule set "ALG" requires fact type "ServiceType", but this type is not part of the input.
TEST/Data Model/Decision Function(TEST_DecisionService_1)
RUL-05164: The fact type "ServiceType" is referenced, but is not asserted nor input.
TEST/Data Model/Decision Function(TEST_DecisionService_1)


Then I found that the tree mode option had to be selected in the decision function also. If a dictionary makes a call to another dictionary which uses the tree mode option, the dictionary that is making the call should also have the tree mode option chosen !

The selection of tree mode option in the decision table is available in OBR Users Guide (section 4.8). However, check the option in the decision function as below:












Peace !

Cheers,
-AR

Wednesday, June 9, 2010

Error during composite deployment due to lack of space

I have faced this error in 10g and I faced it in 11g yesterday. The composite was not getting deployed and it was throwing the below error. It took sometime for me to re-collect that I had already faced this in 10g. Eventually I did and checked the space in the machine hosting the domain and free space was 0%. I cleared some space and bounced the server. The deployment went just fine..

[06:27:08 PM] Error deploying archive sca_JMSConsumerService_rev2.0.jar to soa_server1 [10.132.214.255:7504] 
[06:27:08 PM] HTTP error code returned [500]
[06:27:08 PM] Error message from server:
Error during deployment: Error occurred during deployment of component: JMS_Consumer to service engine: implementation.bpel, for composite: JMSConsumerService: ORABPEL-05250
Error deploying BPEL suitcase.
error while attempting to deploy the BPEL component file "/opt/apps/wls01/user_projects/domains/soa_domain/deployed-composites/JMSConsumerService_rev2.0/sca_JMSConsumerService_rev2.0/3e5eea29-29c3-426d-94e9-e4263b0d30bd"; the exception reported is: java.lang.RuntimeException: Couldn't make directory /opt/apps/wls01/user_projects/domains/soa_domain/deployed-composites/JMSConsumerService_rev2.0/sca_JMSConsumerService_rev2.0/3e5eea29-29c3-426d-94e9-e4263b0d30bd/SCA-INF/bpel/JMS_Consumer
This error contained an exception thrown by the underlying deployment module.
Verify the exception trace in the log (with logging level set to debug mode).
[06:27:08 PM] Check server log for more details.
[06:27:08 PM] Error deploying archive sca_JMSConsumerService_rev2.0.jar to soa_server1 [10.132.214.255:7504] 
[06:27:08 PM] ####  Deployment incomplete.  ####
[06:27:08 PM] Error deploying archive file:/C:/JDeveloper/mywork/AIAPOC/JMSConsumer/deploy/sca_JMSConsumerService_rev2.0.jar
 (oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)


Check for space in the machine when you face a BPEL suitcase error.

Peace !

Cheers,
-AR

Tuesday, June 8, 2010

Composite Audit Settings

I was trying to tweak the audit settings in SOA 11g from the Enterprise Manager console. I realized that when I chose not to create audit for composite, even the instance of the composite was not created. Choose the audit level to Production when you want the instances to be created with minimal payload artifacts.

Go to the composite > Settings > Composite Audit Level : Inherit > Off.


Detailed read on settings available here. Refer to table by name "Table 1-1 Examples of Order of Precedence" under section 1.4.1.1.

 I had a BPEL flow which was using the function ora:getCompositeInstanceId() to read the composite  instance id. When I set the logging off, the assign node in BPEL gave me an null pointer error. The instance id had not been generated. Also, the ora:getCompositeInstanceId() has to be used in an Assign node. I tried using it in a xslt, but the instance id did not get mapped to the output. So I think we would have no option but to use this function in an assign node.

Even in 10g, the function ora:getInstanceId() did not work in xslt. It worked when used as part of Assign node only.

Peace !

Cheers,
-AR

Friday, May 14, 2010

Interesting Finds

Interesting Finds - I will use this series of posts to share what I  found for the first time. I have a habit of keeping a record of what I learn new everyday and I try to keep a policy to learn something new everyday. It might not be something extraordinary, but even a simple finding as to how to deploy a code quicker by tweaking a parameter, is a new find as per me.

In case, you have some interesting finds that you want to be published here, do drop in a mail to arun.arunramesh@gmail.com and I shall update your find here, of course with your stamp on the find !!

Peace !

Cheers,
- AR
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License