meta data for this page
  •  

How to load a new cockpit configuration without updating the system

The usual way to update the cockpit configuration is click on “Create Project Data” on the extension with the configuration. And then update the system. This may take some time. Here is a faster way.

  • Go to HAC and then to Console > Scripting Languages Console, select Bean Shell and past this code:
import de.hybris.platform.core.initialization.SystemSetupContext;
import de.hybris.platform.cockpit.systemsetup.CockpitImportConfig;
import de.hybris.platform.core.Registry;
import java.io.PrintStream;
final String extensionName = "myextension";
 
try {
//We use the context to store the name of the extension.
SystemSetupContext context = new SystemSetupContext(null, null, null, extensionName);
//We get the bean from the application context to have it autowired.
CockpitImportConfig importer = (CockpitImportConfig) Registry.getApplicationContext().getBean("cockpitImportConfig");
importer.importCockpitConfig(context);
} catch (Exception e) {
  System.err.println("There was an error:");
  e.printStackTrace(System.err);
  return "Error, please see the console of the app server";
}
return "OK"
  • Change myextension with the name of the extension which contains the configuration you want to import.
  • Click on the rollback button and change it to commit. This script doesn't require transsantions.
  • Click on execute

If you have errors in your configuration, you may turn on the logging of the importer adding the following line to the file local.properties:

log4j.logger.de.hybris.platform.cockpit.systemsetup.CockpitImportConfig=TRACE

–Based on SAP Hybris 6.1

Discussion

Enter your comment. Wiki syntax is allowed: