• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EmbeddedServletContainerException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.boot.context.embedded.EmbeddedServletContainerException的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedServletContainerException类的具体用法?Java EmbeddedServletContainerException怎么用?Java EmbeddedServletContainerException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EmbeddedServletContainerException类属于org.springframework.boot.context.embedded包,在下文中一共展示了EmbeddedServletContainerException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Override
public void start() throws EmbeddedServletContainerException {
    ServerBootstrap b = new ServerBootstrap();
    groups(b);
    servletExecutor = new DefaultEventExecutorGroup(50);
    b.childHandler(new NettyEmbeddedServletInitializer(servletExecutor, context));

    // Don't yet need the complexity of lifecycle state, listeners etc, so tell the context it's initialised here
    context.setInitialised(true);

    ChannelFuture future = b.bind(address).awaitUninterruptibly();
    //noinspection ThrowableResultOfMethodCallIgnored
    Throwable cause = future.cause();
    if (null != cause) {
        throw new EmbeddedServletContainerException("Could not start Netty server", cause);
    }
    logger.info(context.getServerInfo() + " started on port: " + getPort());
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:19,代码来源:NettyEmbeddedServletContainer.java


示例2: configureSslTrustStore

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private void configureSslTrustStore(SslContextFactory factory, Ssl ssl) {
	if (ssl.getTrustStorePassword() != null) {
		factory.setTrustStorePassword(ssl.getTrustStorePassword());
	}
	if (ssl.getTrustStore() != null) {
		try {
			URL url = ResourceUtils.getURL(ssl.getTrustStore());
			factory.setTrustStoreResource(Resource.newResource(url));
		}
		catch (IOException ex) {
			throw new EmbeddedServletContainerException(
					"Could not find trust store '" + ssl.getTrustStore() + "'", ex);
		}
	}
	if (ssl.getTrustStoreType() != null) {
		factory.setTrustStoreType(ssl.getTrustStoreType());
	}
	if (ssl.getTrustStoreProvider() != null) {
		factory.setTrustStoreProvider(ssl.getTrustStoreProvider());
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:JettyEmbeddedServletContainerFactory.java


示例3: configureSslKeyStore

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private void configureSslKeyStore(SslContextFactory factory, Ssl ssl) {
	try {
		URL url = ResourceUtils.getURL(ssl.getKeyStore());
		factory.setKeyStoreResource(Resource.newResource(url));
	}
	catch (IOException ex) {
		throw new EmbeddedServletContainerException(
				"Could not find key store '" + ssl.getKeyStore() + "'", ex);
	}
	if (ssl.getKeyStoreType() != null) {
		factory.setKeyStoreType(ssl.getKeyStoreType());
	}
	if (ssl.getKeyStoreProvider() != null) {
		factory.setKeyStoreProvider(ssl.getKeyStoreProvider());
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:17,代码来源:JettyEmbeddedServletContainerFactory.java


示例4: stop

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Override
public void stop() throws EmbeddedServletContainerException {
    try {
        if (null != bossGroup) {
            bossGroup.shutdownGracefully().await();
        }
        if (null != workerGroup) {
            workerGroup.shutdownGracefully().await();
        }
        if (null != servletExecutor) {
            servletExecutor.shutdownGracefully().await();
        }
    } catch (InterruptedException e) {
        throw new EmbeddedServletContainerException("Container stop interrupted", e);
    }
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:17,代码来源:NettyEmbeddedServletContainer.java


示例5: start

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Override
    public void start() throws EmbeddedServletContainerException {
        ServerBootstrap b = new ServerBootstrap();
        groups(b);
//        servletExecutor = new DefaultEventExecutorGroup(50);
//        b.childHandler(new NettyEmbeddedServletInitializer(servletExecutor, context));
        b.childHandler(new ChannelInitializer() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ch.pipeline().addLast(new DispatcherInbound(address, context));
            }
        });
        // Don't yet need the complexity of lifecycle state, listeners etc, so tell the context it's initialised here


        ChannelFuture future = b.bind(address).awaitUninterruptibly();
        //noinspection ThrowableResultOfMethodCallIgnored
        Throwable cause = future.cause();
        if (null != cause) {
            throw new EmbeddedServletContainerException("Could not start Netty server", cause);
        }
        logger.info(context.getServerInfo() + " started on port: " + getPort());
        context.setInitialised(true);
        context.addFilter(HessianConstant.HESSIAN_PATH,new HessianFilter(context));
        ServletNettyHttpSessionManager.start();
    }
 
开发者ID:paullyphang,项目名称:nebo,代码行数:27,代码来源:NettyEmbeddedServletContainer.java


示例6: configureSslTrustStore

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private void configureSslTrustStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {

		if (ssl.getTrustStore() != null) {
			try {
				protocol.setTruststoreFile(
						ResourceUtils.getURL(ssl.getTrustStore()).toString());
			}
			catch (FileNotFoundException ex) {
				throw new EmbeddedServletContainerException(
						"Could not load trust store: " + ex.getMessage(), ex);
			}
		}
		protocol.setTruststorePass(ssl.getTrustStorePassword());
		if (ssl.getTrustStoreType() != null) {
			protocol.setTruststoreType(ssl.getTrustStoreType());
		}
		if (ssl.getTrustStoreProvider() != null) {
			protocol.setTruststoreProvider(ssl.getTrustStoreProvider());
		}
	}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:TomcatEmbeddedServletContainerFactory.java


示例7: stop

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Override
public void stop() throws EmbeddedServletContainerException {
	synchronized (this.monitor) {
		if (this.started) {
			try {
				this.started = false;
				this.manager.stop();
				this.undertow.stop();
			}
			catch (Exception ex) {
				throw new EmbeddedServletContainerException("Unable to stop undertow",
						ex);
			}
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:UndertowEmbeddedServletContainer.java


示例8: initialize

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private void initialize() {
	synchronized (this.monitor) {
		try {
			// Cache and clear the connectors to prevent requests being handled before
			// the application context is ready
			this.connectors = this.server.getConnectors();
			this.server.setConnectors(null);

			// Start the server so that the ServletContext is available
			this.server.start();
			this.server.setStopAtShutdown(false);
		}
		catch (Exception ex) {
			// Ensure process isn't left running
			stopSilently();
			throw new EmbeddedServletContainerException(
					"Unable to start embedded Jetty servlet container", ex);
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:JettyEmbeddedServletContainer.java


示例9: primaryConnectorPortClashThrowsIllegalStateException

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Test
public void primaryConnectorPortClashThrowsIllegalStateException()
		throws InterruptedException, IOException {
	doWithBlockedPort(new BlockedPortAction() {

		@Override
		public void run(int port) {
			TomcatEmbeddedServletContainerFactory factory = getFactory();
			factory.setPort(port);

			try {
				TomcatEmbeddedServletContainerFactoryTests.this.container = factory
						.getEmbeddedServletContainer();
				TomcatEmbeddedServletContainerFactoryTests.this.container.start();
				fail();
			}
			catch (EmbeddedServletContainerException ex) {
				// Ignore
			}
		}

	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:24,代码来源:TomcatEmbeddedServletContainerFactoryTests.java


示例10: specificPortsViaPropertiesWithClash

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Test
public void specificPortsViaPropertiesWithClash() throws Exception {
	int managementPort = ports.get().management;
	ServerSocket serverSocket = new ServerSocket();
	serverSocket.bind(new InetSocketAddress(managementPort));
	try {
		EnvironmentTestUtils.addEnvironment(this.applicationContext,
				"server.port:" + ports.get().server,
				"management.port:" + ports.get().management);
		this.applicationContext.register(RootConfig.class, EndpointConfig.class,
				BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
				ErrorMvcAutoConfiguration.class);
		this.thrown.expect(EmbeddedServletContainerException.class);
		this.applicationContext.refresh();
	}
	finally {
		serverSocket.close();
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:EndpointWebMvcAutoConfigurationTests.java


示例11: initialize

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private synchronized void initialize() {
	try {
		// Cache and clear the connectors to prevent requests being handled before
		// the application context is ready
		this.connectors = this.server.getConnectors();
		this.server.setConnectors(null);

		// Start the server so that the ServletContext is available
		this.server.start();
		this.server.setStopAtShutdown(false);
	}
	catch (Exception ex) {
		// Ensure process isn't left running
		stopSilently();
		throw new EmbeddedServletContainerException(
				"Unable to start embedded Jetty servlet container", ex);
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:19,代码来源:JettyEmbeddedServletContainer.java


示例12: initialize

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private synchronized void initialize() throws EmbeddedServletContainerException {
	TomcatEmbeddedServletContainer.logger
			.info("Tomcat initialized with port(s): " + getPortsDescription(false));
	try {
		addInstanceIdToEngineName();

		// Remove service connectors to that protocol binding doesn't happen yet
		removeServiceConnectors();

		// Start the server to trigger initialization listeners
		this.tomcat.start();

		// We can re-throw failure exception directly in the main thread
		rethrowDeferredStartupExceptions();

		// Unlike Jetty, all Tomcat threads are daemon threads. We create a
		// blocking non-daemon to stop immediate shutdown
		startDaemonAwaitThread();
	}
	catch (Exception ex) {
		throw new EmbeddedServletContainerException("Unable to start embedded Tomcat",
				ex);
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:25,代码来源:TomcatEmbeddedServletContainer.java


示例13: start

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Override
public void start() throws EmbeddedServletContainerException {
	try {
		addPreviouslyRemovedConnectors();
		Connector connector = this.tomcat.getConnector();
		if (connector != null && this.autoStart) {
			startConnector(connector);
		}
		// Ensure process isn't left running if it actually failed to start
		if (connectorsHaveFailedToStart()) {
			stopSilently();
			throw new IllegalStateException("Tomcat connector in failed state");
		}
		TomcatEmbeddedServletContainer.logger
				.info("Tomcat started on port(s): " + getPortsDescription(true));
	}
	catch (Exception ex) {
		throw new EmbeddedServletContainerException(
				"Unable to start embedded Tomcat servlet container", ex);
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:22,代码来源:TomcatEmbeddedServletContainer.java


示例14: configureSslTrustStore

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private void configureSslTrustStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
	if (ssl.getTrustStore() != null) {
		try {
			protocol.setTruststoreFile(
					ResourceUtils.getURL(ssl.getTrustStore()).toString());
		}
		catch (FileNotFoundException ex) {
			throw new EmbeddedServletContainerException(
					"Could not load trust store: " + ex.getMessage(), ex);
		}
	}
	protocol.setTruststorePass(ssl.getTrustStorePassword());
	if (ssl.getTrustStoreType() != null) {
		protocol.setTruststoreType(ssl.getTrustStoreType());
	}
	if (ssl.getTrustStoreProvider() != null) {
		protocol.setTruststoreProvider(ssl.getTrustStoreProvider());
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:20,代码来源:TomcatEmbeddedServletContainerFactory.java


示例15: createTempDir

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
/**
 * Returns the absolute temp dir for given web server.
 * @param prefix webserver name
 * @return The temp dir for given web server.
 */
protected File createTempDir(String prefix) {
	try {
		File tempFolder = File.createTempFile(prefix + ".", "." + getPort());
		tempFolder.delete();
		tempFolder.mkdir();
		tempFolder.deleteOnExit();
		return tempFolder;
	}
	catch (IOException ex) {
		throw new EmbeddedServletContainerException(
				"Unable to create Tomcat tempdir. java.io.tmpdir is set to "
						+ System.getProperty("java.io.tmpdir"),
				ex);
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:21,代码来源:TomcatEmbeddedServletContainerFactory.java


示例16: start

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Override
public synchronized void start() throws EmbeddedServletContainerException {
	try {
		if (!this.autoStart) {
			return;
		}
		if (this.undertow == null) {
			this.undertow = createUndertowServer();
		}
		this.undertow.start();
		this.started = true;
		UndertowEmbeddedServletContainer.logger
				.info("Undertow started on port(s) " + getPortsDescription());
	}
	catch (ServletException ex) {
		throw new EmbeddedServletContainerException(
				"Unable to start embdedded Undertow", ex);
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:20,代码来源:UndertowEmbeddedServletContainer.java


示例17: primaryConnectorPortClashThrowsIllegalStateException

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Test
public void primaryConnectorPortClashThrowsIllegalStateException()
		throws InterruptedException, IOException {
	final int port = SocketUtils.findAvailableTcpPort(40000);

	doWithBlockedPort(port, new Runnable() {

		@Override
		public void run() {
			TomcatEmbeddedServletContainerFactory factory = getFactory();
			factory.setPort(port);

			try {
				TomcatEmbeddedServletContainerFactoryTests.this.container = factory
						.getEmbeddedServletContainer();
				TomcatEmbeddedServletContainerFactoryTests.this.container.start();
				fail();
			}
			catch (EmbeddedServletContainerException ex) {
				// Ignore
			}
		}

	});

}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:27,代码来源:TomcatEmbeddedServletContainerFactoryTests.java


示例18: specificPortsViaPropertiesWithClash

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
@Test
public void specificPortsViaPropertiesWithClash() throws Exception {
	int managementPort = ports.get().management;
	ServerSocket serverSocket = new ServerSocket();
	serverSocket.bind(new InetSocketAddress(managementPort));
	try {
		EnvironmentTestUtils.addEnvironment(this.applicationContext,
				"server.port:" + ports.get().server,
				"management.port:" + ports.get().management);
		this.applicationContext.register(RootConfig.class, EndpointConfig.class,
				BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
				ErrorMvcAutoConfiguration.class);
		this.thrown.expect(EmbeddedServletContainerException.class);
		this.applicationContext.refresh();
		this.applicationContext.close();
	}
	finally {
		serverSocket.close();
		assertAllClosed();
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:22,代码来源:EndpointWebMvcAutoConfigurationTests.java


示例19: startConnector

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private void startConnector(Connector connector) {
	try {
		for (Container child : this.tomcat.getHost().findChildren()) {
			if (child instanceof TomcatEmbeddedContext) {
				((TomcatEmbeddedContext) child).deferredLoadOnStartup();
			}
		}
	}
	catch (Exception ex) {
		TomcatEmbeddedServletContainer.logger.error("Cannot start connector: ", ex);
		throw new EmbeddedServletContainerException(
				"Unable to start embedded Tomcat connectors", ex);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:TomcatEmbeddedServletContainer.java


示例20: configureSslKeyStore

import org.springframework.boot.context.embedded.EmbeddedServletContainerException; //导入依赖的package包/类
private void configureSslKeyStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
	try {
		protocol.setKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString());
	}
	catch (FileNotFoundException ex) {
		throw new EmbeddedServletContainerException(
				"Could not load key store: " + ex.getMessage(), ex);
	}
	if (ssl.getKeyStoreType() != null) {
		protocol.setKeystoreType(ssl.getKeyStoreType());
	}
	if (ssl.getKeyStoreProvider() != null) {
		protocol.setKeystoreProvider(ssl.getKeyStoreProvider());
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:TomcatEmbeddedServletContainerFactory.java



注:本文中的org.springframework.boot.context.embedded.EmbeddedServletContainerException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PsiAnnotationParameterList类代码示例发布时间:2022-05-23
下一篇:
Java Header类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap