Search in sources :

Example 1 with ConfigPopulatorException

use of org.jvnet.hk2.config.ConfigPopulatorException in project Payara by payara.

the class DomainXml method run.

@Override
public void run(ConfigParser parser) throws ConfigPopulatorException {
    LogRecord lr = new LogRecord(Level.FINE, startupClass + this.getClass().getName());
    lr.setLoggerName(getClass().getName());
    EarlyLogHandler.earlyMessages.add(lr);
    ClassLoader parentClassLoader = (registry == null) ? getClass().getClassLoader() : registry.getParentClassLoader();
    if (parentClassLoader == null)
        parentClassLoader = getClass().getClassLoader();
    ServiceLocatorUtilities.addOneConstant(habitat, parentClassLoader, null, ClassLoader.class);
    try {
        parseDomainXml(parser, getDomainXml(env), env.getInstanceName());
    } catch (IOException e) {
        throw new ConfigPopulatorException(localStrings.getLocalString("ConfigParsingFailed", "Failed to parse domain.xml"), e);
    }
    // run the upgrades...
    if ("upgrade".equals(context.getPlatformMainServiceName())) {
        upgrade();
    }
    // run the cleanup.
    for (ServiceHandle<?> cc : habitat.getAllServiceHandles(ConfigurationCleanup.class)) {
        try {
            // run the upgrade
            cc.getService();
            lr = new LogRecord(Level.FINE, successfulCleanupWith + cc.getClass());
            lr.setLoggerName(getClass().getName());
            EarlyLogHandler.earlyMessages.add(lr);
        } catch (Exception e) {
            lr = new LogRecord(Level.FINE, e.toString() + e);
            lr.setLoggerName(getClass().getName());
            EarlyLogHandler.earlyMessages.add(lr);
            lr = new LogRecord(Level.SEVERE, cc.getClass() + cleaningDomainXmlFailed + e);
            lr.setLoggerName(getClass().getName());
            EarlyLogHandler.earlyMessages.add(lr);
        }
    }
    decorate();
}
Also used : LogRecord(java.util.logging.LogRecord) ConfigPopulatorException(org.jvnet.hk2.config.ConfigPopulatorException) IOException(java.io.IOException) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) ConfigPopulatorException(org.jvnet.hk2.config.ConfigPopulatorException)

Aggregations

IOException (java.io.IOException)1 LogRecord (java.util.logging.LogRecord)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ConfigPopulatorException (org.jvnet.hk2.config.ConfigPopulatorException)1