Powered By Blogger

Wednesday, May 30, 2012

The RL function getFactByType found more than one instance of the fact type

In this article we discuss one of rules invocation error we encounter frequently during development.
The error mentioned in post title generally comes because of rules data modeling mistake.

Following are some rules data modeling mistakes we may do
  • Assuming rule firing order, but rules execution order is not predefined by OBR engine
  • Asserting multiple facts of same type 
In OBR, before decision function is about to return, it will check for a fact in the working memory whose type matches the type defined as the output of the decision function. If it finds multiple facts that match the type,then it doesn't know which fact to select and  it will throw an above mentioned exception.
Here magic is input and output facts are matched based on their types but not on names.

Best and bit tedious way to resolve the error is, go back and re visit all your rule actions and make sure your code is not asserting same fact repeatedly and unnecessarly.
Most of asserts can be replaced by modify  which will modify same fact instance.

Second solution would be go to decision function Outputs section and mark  List option.What we are saying is duplicates are allowed and it returns all matching type output facts. It is our BPEL code responsibility to check and use appropriate fact in decision making process.


Thursday, May 17, 2012

ORABPEL-01005 Failed to compile bpel generated classes.The class path setting is incorrect.

This thread  discuss about one issue we got when we deploy SOA 11g BPEL composite from Jdev11g.
build in Jdev  succeeds but deployment on to server is filing.That means Jdev can compile the generated Java classes but server couldn't compile same classes.

When  I mention Java classes that doesn't mean my SOA composite has some dependency on Java classes or BPEL is carrying Jar files in its Libraray and classpath.It means Java classes generated by engine which are representation of our composite and its components.XML representation is converted back to Java and executed on server during run time.

Error in Jdev when we deploy


---->response code=500, error:There was an error deploying the composite on AdminServer: Error occurred during deployoment of component: OrderImport to service engine: implementation.bpel, for composite: OrderProcess: ORABPEL-01005

[deployComposite]

[deployComposite] Failed to compile bpel generated classes.

[deployComposite] failure to compile the generated BPEL classes for BPEL process "OrderproProcess" of composite "default/OrderproProcess!1.0*soa_4556-23d3-4bd3561-97e7a1b14e52"

[deployComposite] The class path setting is incorrect.

[deployComposite] Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly. Also verify that the run time is using the same release/version.

[deployComposite] .

for example I can see error in Adminserver.out  log file
/oracle/domains/soa_domain/servers/AdminServer/dc/soa_968d12a9-7b6d-4ccb-84fa-97d870246c8e/SCA-INF/bpel/OrderProcess/src/orabpel/OrderproProcess/BPEL_BIN.java:253: illegal escape character
When I open above mentioned java file on server at specified location, I can see

__pa.setNSPrefix("tns", "http:\/\/xmlns.oracle.com\/bpel\/workflow\/taskService");


Solution

The reason for above error is, we have added certain third-party jars to server PRE-CLASS PATH in SetSOADomain.sh file, especially we have added them in first line of CLASS-PATH.
The jar file has incompatibe classes for commons-lang which is causing this issue.

Now we have added them at the last place in class path and that resolved this issue.