Monday, May 21, 2018

Setting JTA timeout on weblogic

JTA timeout is configure by default to be 30 seconds, so heavy loads will require more time than this.

You will se an exception like this when time out is not enough fir your application,

[Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 31 seconds]

Weblogic allows you to change the JTA timeout inside the admin console, this can be done by going to JTA Page and change the setting.


Image and video hosting by TinyPic
Changing this will not require a restart, since weblogic apply this on the current servers that are running.
  • Just go to admin console 
  • Click on Lock & Edit
  • Click on Services - JTA
  • Update Timeout Seconds property
  • Save and Apply changes

This is documented at https://docs.oracle.com/cd/E23095_01/Platform.93/ATGInstallGuide/html/s0406settingthetransactiontimeoutonwe01.html



Thursday, December 21, 2017

Scenarios missing a subject

Scenarios in OC can be created to do actions based on the People/Profile properties

However you might face a problem when the scenario is waiting for a profile property and there is not a user in the scenario process execution context.

When this happen an exception like this will be thrown:

**** Error      Wed Dec 20 11:11:25 -07:00 2017 1513793485829   /atg/dynamo/messaging/MessagingManager  An error occurred while MessageSink with nucleus name "/atg/scenario/ScenarioManager" was receiving a Message from input port "IndividualEvents": javax.jms.JMSException: atg.process.ProcessException: Cannot obtain a subject required for an individual process execution context, from either the current request or message bean mycompany.commerce.messaging.ConfirmOrderStateMessage@79fbc732     javax.jms.JMSException: atg.process.ProcessException: Cannot obtain a subject required for an individual process execution context, from either the current request or message bean mycompany.commerce.messaging.ConfirmOrderStateMessage@79fbc732
**** Error      Wed Dec 20 11:11:25 -07:00 2017 1513793485829   /atg/dynamo/messaging/MessagingManager          at atg.process.ProcessManagerService.receiveMessage(ProcessManag
erService.java:11348)
.....

This is because there is not a profile that can be used to apply the Scenario, usually there is one, but when you create a custom event it might not be the case.

In order to avoid this you just need to make sure your Custom Message set the Profile you want to use as follows:
This is documented at https://docs.oracle.com/cd/E55783_02/Platform.11-2/ATGPersProgGuide/html/s2402associatingprofileswithindividua01.html


Thursday, August 31, 2017

Oracle Commerce - Create custom Derivation method


ATG Repositories have a feature called Derivations, that allow you to derive the value of a property based on other values.

This si a great way to help you design your repository definition and avoid duplicate data.

Here is an example of what you can do with an OOTB derivation:

Now, you can create your own Derivation method to do what you want.

Just do the following:
Create a Class that extends DerivationMethodImpl.

Override derivePropertyValue method

And in order to user it:
Now you can reuse this derivation to get the first element of a collection by just configuring the collection in the expression

There are several derivations already, just make sure that the one you want to implement is not already created OOTB https://docs.oracle.com/cd/E41069_01/Platform.11-0/ATGRepositoryGuide/html/s0612derivationmethods01.html

Thursday, May 4, 2017

Create Rest Service on Oracle Commerce ATG11.0, 11.1 and 11.2

Oracle Commerce does provide with a rest service module that we can use to expose services. it is very easy to do, in this diagram is explained in high level how this can be done.
Let's say we are gonna create a Service that returns the review for a particular product.
We need to create a service component that will get the Reviews, that will be as follows:


Then, we need to register that new service as an Actor as follows:






Then register that new service chain url into ActorChainRestRegistry.properties, OOTB that already exist and holds the configuration for all the services.

Everything on how to do this is documented at http://docs.oracle.com/cd/E52191_03/Platform.11-1/ATGWSFrameGuide/html/s0502restmvcserviceflowexample01.html

And in the top of this you can add a new layer for cache the data using Cache Adapter.
That will looks like this.
In order to do implement the cache, you can use this page that is a very useful guide https://www.sparkred.com/blog/writing-a-custom-atg-cache/
The Actor chain definition will change a little bit to use the cache instead of the service, that will look like:


Give it a try.

Friday, December 30, 2016

ScenarioManager is not accepting new scenarios

I was creating new scenarios and those were not reflected on the ScenarioManager, I have listed all the OOTB scenearios, but not my custom ones.

I found this Warning on the Logs:

/atg/scenario/ScenarioManager   Unable to declare this instance as the default ProcessEditorServer. Another instance has already been run against this schema, and has declared itself as the default ProcessEditorServer. This instance will be started as an individual server. To declare this instance as the ProcessEditorServer, either configure the /atg/scenario/scenarioManager.xml file, or remove the applicable row from the dss_server_id table. The first option is the recommended one, since it will prohibit this problem from occurring in the future. Turn on debug logging for this component to see further details (server restart may be required).

So I turned on logging debug on Scneario Manager, and found that all my custom Scmearios were not considered at all.

The problem was that the table dss_server_id was having a record for another computer (an other VM) I just updated this to use the actual name for the processEditor Server and that fixed the problem.

This is a common problem that you could face if you get a database dump from other computer.