org.apache.catalina.startup.Tomcat.enableNaming()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.apache.catalina.startup.Tomcat.enableNaming()方法的一些代码示例,展示了Tomcat.enableNaming()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tomcat.enableNaming()方法的具体详情如下:
包路径:org.apache.catalina.startup.Tomcat
类名称:Tomcat
方法名:enableNaming

Tomcat.enableNaming介绍

[英]Enables JNDI naming which is disabled by default. Server must implement Lifecycle in order for the NamingContextListener to be used.
[中]启用默认禁用的JNDI命名。为了使用NamingContextListener,服务器必须实现生命周期。

代码示例

代码示例来源:origin: org.apache.airavata/airavata-embedded-tomcat

/**
 * Enables JNDI naming which is disabled by default. Server must implement
 * {@link org.apache.catalina.Lifecycle} in order for the
 * {@link org.apache.catalina.core.NamingContextListener} to be used.
 */
public void enableNaming() {
  tomcat.enableNaming();
}

代码示例来源:origin: mercyblitz/thinking-in-spring-boot-samples

@Override
  protected TomcatWebServer getTomcatWebServer(Tomcat tomcat) {
    // 激活 JNDI(默认失效)
    tomcat.enableNaming();
    return super.getTomcatWebServer(tomcat);
  }
};

代码示例来源:origin: stackoverflow.com

@Bean
public TomcatEmbeddedServletContainerFactory tomcatFactory() {
  return new TomcatEmbeddedServletContainerFactory() {
    @Override
    protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(
        Tomcat tomcat) {
      tomcat.enableNaming();
      return super.getTomcatEmbeddedServletContainer(tomcat);
    }
  };
}

代码示例来源:origin: wilkinsona/spring-boot-sample-tomcat-jndi

@Override
protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(
    Tomcat tomcat) {
  tomcat.enableNaming();
  return super.getTomcatEmbeddedServletContainer(tomcat);
}

代码示例来源:origin: stackoverflow.com

@Configuration
@EnableAutoConfiguration
@ComponentScan
@ImportResource("classpath:context.xml")
public class Application {

  public static void main(String[] args) throws Exception {
    new SpringApplicationBuilder()
        .showBanner(false)
        .sources(Application.class)
        .run(args);
}

@Bean
public TomcatEmbeddedServletContainerFactory tomcatFactory() {
  return new TomcatEmbeddedServletContainerFactory() {
    @Override
    protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(
        Tomcat tomcat) {
      tomcat.enableNaming();
      return super.getTomcatEmbeddedServletContainer(tomcat);
    }
  };
}

代码示例来源:origin: com.googlecode.jeeunit/jeeunit-tomcat7

private void startServer() {
  try {
    tomcat.enableNaming();
    tomcat.setPort(config.getHttpPort());
    tomcat.start();
    isDeployed = true;
  }
  catch (LifecycleException exc) {
    exc.printStackTrace();
    throw new RuntimeException(exc);
  }
}

代码示例来源:origin: apache/ofbiz-framework

private Tomcat prepareTomcatServer(ContainerConfig.Configuration cc,
    ContainerConfig.Configuration.Property engineConfig) throws ContainerException {
  System.setProperty(Globals.CATALINA_HOME_PROP, System.getProperty("ofbiz.home") + "/" +
        ContainerConfig.getPropertyValue(cc, "catalina-runtime-home", "runtime/catalina"));
  System.setProperty(Globals.CATALINA_BASE_PROP, System.getProperty(Globals.CATALINA_HOME_PROP));
  Tomcat tomcat = new Tomcat();
  tomcat.setBaseDir(System.getProperty("ofbiz.home"));
  Property defaultHostProp = engineConfig.getProperty("default-host");
  if (defaultHostProp == null) {
    throw new ContainerException("default-host element of server property is required for catalina!");
  }
  tomcat.setHostname(defaultHostProp.value);
  if (ContainerConfig.getPropertyValue(cc, "use-naming", false)) {
    tomcat.enableNaming();
  }
  StandardServer server = (StandardServer) tomcat.getServer();
  try {
    server.setGlobalNamingContext(new InitialContext());
  } catch (NamingException e) {
    throw new ContainerException(e);
  }
  return tomcat;
}

代码示例来源:origin: ops4j/org.ops4j.pax.exam2

@Override
public void start() {
  LOG.info("starting Tomcat");
  File tempDir = system.getTempFolder();
  webappDir = new File(tempDir, "webapps");
  webappDir.mkdirs();
  tomcat = new PaxExamTomcat();
  tomcat.setBaseDir(tempDir.getPath());
  tomcat.enableNaming();
  Host host = tomcat.getHost();
  xmlBase = new File(tempDir, "conf");
  xmlBase.mkdirs();
  host.setXmlBase(xmlBase.getAbsolutePath());
  try {
    int httpPort = 9080;
    Connector connector = tomcat.getConnector();
    connector.setPort(httpPort);
    tomcat.start();
    testDirectory.setAccessPoint(new URI("http://localhost:" + httpPort
      + "/Pax-Exam-Probe/"));
  }
  catch (URISyntaxException exc) {
    new TestContainerException(exc);
  }
  catch (LifecycleException exc) {
    new TestContainerException(exc);
  }
}

代码示例来源:origin: stackoverflow.com

protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(
    Tomcat tomcat) {
  tomcat.enableNaming();
  TomcatEmbeddedServletContainer container = 
      super.getTomcatEmbeddedServletContainer(tomcat);

代码示例来源:origin: jsimone/webapp-runner

commandLineParams.enableBasicAuth ||
 commandLineParams.tomcatUsersLocation != null) {
tomcat.enableNaming();

代码示例来源:origin: com.github.jsimone/webapp-runner-main

commandLineParams.enableBasicAuth ||
 commandLineParams.tomcatUsersLocation != null) {
tomcat.enableNaming();

代码示例来源:origin: org.apache.tomcat.maven/tomcat7-war-runner

tomcat.enableNaming();

代码示例来源:origin: apache/tomcat-maven-plugin

tomcat.enableNaming();

代码示例来源:origin: apache/tomcat-maven-plugin

tomcat.enableNaming();

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

server.setPort(port());
server.getHost().setAppBase(webappsDir.getAbsolutePath());
server.enableNaming();

代码示例来源:origin: org.jboss.arquillian.container/arquillian-tomcat-embedded-7

tomcat.enableNaming();

代码示例来源:origin: com.github.mjeanroy/junit-servers-tomcat

private Tomcat initServer() {
  Tomcat tomcat = new Tomcat();
  tomcat.setBaseDir(configuration.getBaseDir());
  tomcat.setPort(configuration.getPort());
  tomcat.getHost().setAutoDeploy(true);
  tomcat.getHost().setDeployOnStartup(true);
  if (configuration.isEnableNaming()) {
    tomcat.enableNaming();
  }
  return tomcat;
}

代码示例来源:origin: apache/tomcat-maven-plugin

embeddedTomcat.enableNaming();

代码示例来源:origin: apache/tomcat-maven-plugin

embeddedTomcat.enableNaming();

代码示例来源:origin: ch.rasc/embeddedtc

this.tomcat.enableNaming();

相关文章