private static RuntimeInstance initialize() {
    try{
      RuntimeInstance ri = new RuntimeInstance();
      final Class<?>[] interfaces = ResourceManagerImpl.class.getInterfaces();
      if (interfaces.length != 1 || !interfaces[0].equals(ResourceManager.class)) {
        throw new IllegalStateException("Incorrect velocity version in the classpath" +
                                        ", ResourceManager in " + PathManager.getJarPathForClass(ResourceManager.class) +
                                        ", ResourceManagerImpl in " + PathManager.getJarPathForClass(ResourceManagerImpl.class));
      }

      ri.setProperty(RuntimeConstants.RUNTIME_LOG_INSTANCE, NOPLogger.NOP_LOGGER);
      ri.setProperty(RuntimeConstants.INPUT_ENCODING, FileTemplate.ourEncoding);
      ri.setProperty(RuntimeConstants.PARSER_POOL_SIZE, 3);

      ri.setProperty(RuntimeConstants.UBERSPECT_CLASSNAME, "org.apache.velocity.util.introspection.SecureUberspector");
      ri.setProperty(RuntimeConstants.INTROSPECTOR_RESTRICT_PACKAGES, "java.lang.reflect");
      ri.setProperty(RuntimeConstants.INTROSPECTOR_RESTRICT_CLASSES, "java.lang.Compiler," +
                                                                           "java.lang.InheritableThreadLocal," +
                                                                           "java.lang.Package," +
                                                                           "java.lang.Process," +
                                                                           "java.lang.Runtime," +
                                                                           "java.lang.RuntimePermission," +
                                                                           "java.lang.SecurityManager," +
                                                                           "java.lang.System," +
                                                                           "java.lang.Thread," +
                                                                           "java.lang.ThreadGroup," +
                                                                           "java.lang.ThreadLocal," +
                                                                           "java.lang.Class," +
                                                                           "java.lang.ClassLoader");

      ri.setProperty(RuntimeConstants.RESOURCE_LOADER, "includes");
      ri.setProperty("includes.resource.loader.instance", new ResourceLoader() {
        @Override
        public void init(ExtProperties configuration) {
        }

        @Override
        public Reader getResourceReader(String resourceName, String encoding) throws ResourceNotFoundException {
          FileTemplateManager templateManager = VelocityTemplateContext.getFromContext();
          final FileTemplate include = templateManager.getPattern(resourceName);
          if (include == null) {
            throw new ResourceNotFoundException("Template not found: " + resourceName);
          }
          final String text = include.getText();
          try {
            return new InputStreamReader(new ByteArrayInputStream(text.getBytes(FileTemplate.ourEncoding)), FileTemplate.ourEncoding);
          }
          catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
          }
        }

        @Override
        public boolean isSourceModified(Resource resource) {
          return true;
        }

        @Override
        public long getLastModified(Resource resource) {
          return 0L;
        }
      });

      ri.init();
      return ri;
    }
    catch (Exception e){
      LOG.error("Unable to init Velocity", e);
      return null;
    }
  }
private static RuntimeInstance initialize()