ART#105 - What is nucleus in ATG?



Now before we start.. we must know that this is a very very important topic in ATG, and must be understood very very carefully..

Nucleus is the heart of ATG, around which everything revolves.
Now, in the previous article we understood what components are, and how we create them. But we never understood how to we "execute" or run those components.

Let us, for a moment forget about components and come to basic Java.

The question is, how do we execute a java program..??

We open a notepad, write the following code.

public class Person{
String name;
int age;

   public static void main(String[] args) {
      Person person = new Person(); = "Stephen";
      person.age = 22;
      System.out.println("Name is : ";
      System.out.println("Age is : "+person.age);

Now what exactly did we do here??
We created a class Person, added two variables, name and age to it. Then we created a main() method. Inside the main method we created an object of "Person" class, set the variables, and we printed them on the standard console (your computer screen).

(Disclaimer: If you did not understand the above code.. you may want to spend some money on basic Java tutions..)

Now, post writing the code, we compile this file (, generally using the command


Next, we see that the byte code for this class is generated, and a file "Person.class" is created. Next, we execute this byte code using the "java" keyword.

java Person

Now, the output on our screen is something like:-

Name is : Stephen
Age is : 22      

Now, when we executed the byte code, the code written in the "main()" method was executed. Therefore, whenever we create a simple java class, whatever we write in the main method gets executed. This method is like the "kick start" of your java program.

Now, the way how ATG framework functions is somewhat tricky. In our java class, we manually created an object of "Person" class (see first line in the main method of above program).
In ATG we have something called as nucleus, which does the job of creating objects on a "on-demand" basis. Depending on how you configure your component (we will discuss about this in component scopes), Nucleus services creates objects on need basis and provides a reference for us to use.

Nucleus, being the heart of ATG understands the memory usage and optimization and creates objects ONLY when required/necessary. Just like the "main" method in our simple java classes, nucleus needs a "kick start" for classes which are to be initialized.

When you start up an application, Nucleus reads the configuration path, (a location where we keep our configuration files, which is generally the "config" folder of our ATG module). Within one of those directories is a file called (present in the config path of some out-of-the-box ATG module) that contains the name of the first component to create. The out-of-the-box looks like:-
The initialServiceName property instructs Nucleus to configure and start up its initial service using (which is another configuration file, present in some out-of-the-box module's config path). The looks like:-

Now, in the previous chapter, we created a component, with its configuration file at location:-
which, as per Nucleus, is at the location:-

For nucleus, to start our component at startup time (when ATG server starts), we add our component to initialServices.
For this, we need to create a configuration file anywhere in our config-path. Next we write the following as its contents:-
Now, nucleus combines this configuration file with out-of-the-box and appends the contents. Therefore, it automatically picks up the class mentioned in OOTB configuration file and appends our component (Person) to the initialServices. (see the "+=" sign above). Please note that if we do-not use the "+=" sign in our custom, and simply use "=" sign, the value of initialServices variable will be completely overridden by our configuration file.
We will discuss more about configuration file stuff and how they append later on.

Therefore, adding a component to initialServices, makes sure your component starts-up at the start-up time. (This is the ATG's kick start of the component).
There are other ways to start-up an ATG component, and we will discuss them as we go.

In the previous chapter we created a java class Let us modify the contents of that class to:-
package com.mypackage;
public class Person{
String name;
int age;

    public Person() {
     System.out.println("Constructing Person");
     public String getName() {return name;}
     public void setName(String name) {
      System.out.println("Setting name");;
     public int getAge() {return age;}
     public void setAge(int age) {
      System.out.println("Setting age");
We just added some console printing statements to our constructor and the setter methods. When we re-assemble our atg application, and start our nucleus server (with our modified java class and the entry of our component in initialServices), we should see these console logging statements on our console at the startup time, so see the Nucleus initializing our very own custom component.

Please note that we generally extend the class GenericService in our application. This class has a method doStartService(), which we can override in our components. This is like the "main" method of our component. Whatever we write in this method, will be executed, when this components starts up.
public void doStartService() throws ServiceException {
                // our custom code
                // which we want to execute at startup time
So, to conclude, nucleus is basically an OOTB component, which does the task of managing which component is required to start, and starts that up. Please note that the method depicted above is not the only way nucleus components are initialized. There are many other ways the components are initialized (by Nucleus, of course), and we would be discussing them as we go-on. Now that we know how nucleus functions, let us discuss some more stuff on components and configuration files as we are much more clearer on concepts now..




  1. Hi Monis,
    Can we have a component with parameterized constructor?
    Please give the reason for both if answer is yes or not

    1. I have already answered this question in my last comment here:-

  2. From the explanation given above :
    When you start up an application, Nucleus reads the configuration path (from confgi path).
    My Question is how does the Nucleus itself starts first? From NucleusServlet are we calling the which in turn invokes the Nucleus or is there any thing else going here?

  3. Something like that. Nucleus starts up, reads "" from the config path, and starts running all the components. All the dependent components are also started on need-basis.

  4. hi,
    Thanks for writing such a awesome blog,It would be really great if you can help me with this..
    setting name like statements are not printing up in logs when I start the server,its get printed in logs when I search component named person from dyn/admin.even after making Initial.properites in config.Explain a little please ,why it is not getting printed in logs when server start ups?

    1. If the statements are getting printed when you search via dyn/admin, this means that the component is configured properly.
      Also, there seems to be some problem with You could check the following things:-

      1. The config path where you have overridden is correct (/atg/dynamo/
      2. In the, you define initialServices property. Check if you have written the property name correctly (properties are case sensitive)
      3. Check your custom component's config path present in the initialServices property.

  5. Do you can make some video about it?

  6. Is it possible to get the ATG jars over net?
    I am very new to ATG. I want to learn and practice ATG.
    Please help me over this.



Get All The Latest Updates Delivered Straight Into Your Inbox For Free!