Tag: 春季引导

如何将春季启动应用程序部署到docker工人

我正在尝试将一个Spring-Boot应用程序部署到Docker 。 最初我有应用程序编译成一个jar ,所以我有@SpringBootApplication注释的主类。 本地,一切工作正常。 我更改了应用程序,以便通过将<packaging>war</packaging>到我的pom.xml来创build一个war文件。 我也跟着这个post:部署Spring Boot应用到Docker来创buildinitalizer: import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; public class MyFirstBootApp extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(MyFirstBootApp.class); } } 现在,当我将应用程序部署到Docker它不执行任何操作,当我导航到根url时,出现404错误。 我还有什么遗漏? 我检查了服务器日志,没有错误或失败,所以我不知道还有什么地方看。 使用的工具是: docker工17.06 jdk 1.8 Maven 3.5.0 Sping Boot 1.5.7

Spring Boot 1.4.1 SSL trustAnchorsexception

我正在运行Docker容器(docker-compose)内的Spring Boot微服务进行testing,最近试图从Spring Boot 1.4.0升级到1.4.1(也试过1.4.2),但是服务启动失败 InvalidAlgorithmParameterException:trustAnchors参数必须是非空exception。 我没有遇到任何运行Spring Boot 1.4.0的问题。 下面提供了用于其中一个服务的Dockerfile(一些敏感值已被replace,尝试1.4.2,结果相同。 当我在命令行上运行服务时会发生同样的行为,下面的Dockerfile中列出了所有的环境variables和Java参数。 这里是日志的摘录: 2016-11-10 08:10:06.645 ERROR [sbsa-account-om-service,,,] 1 — [ main] o.apache.catalina.core.StandardService : Failed to start connector [Connector[HTTP/1.1-8762]] org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8762]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5] at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:233) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:178) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) […]

seleniumtesting在当地工作,但不在Gitlab CI中

我目前正在开发一个涉及经典后端/前端架构的Java Spring Boot项目。 我正在尝试使用Selenium WebDriver来编写一些基本的集成testing。 问题是我写的testing在我的本地开发机器上没有任何问题,但通过持续集成设置(Gitlab CI)运行时没有通过。 示例testing的代码如下: @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") public class ExampleTest { @LocalServerPort private int port; WebDriver wd; @Test public void successfulLogin(){ String url = "http://localhost:" + port; wd = new HtmlUnitDriver(); wd.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS); wd.get(url); } } 相对的gitlab-ci.yml部分是: stages: – test maven-test: image: maven:3.5.0-jdk-8 stage: test script: "mvn test -B […]

docker工的春季启动无法find有效的证书path来请求目标错误

我正在使用spring引导,并试图用Docker进行设置。 我尝试了一切,我可以find谷歌,似乎没有让我去。 我在跑 mvn clean package docker:build 运行这个命令将执行spring-boottesting,运行数据库迁移,构buildJAR,然后在构buildDocker镜像时出现以下错误: Failed to execute goal com.spotify:docker-maven-plugin:0.4.9:build (default-cli) on project app: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1] 这里是我使用的Dockerfile: FROM java:8-jdk export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.100:2376" export DOCKER_CERT_PATH="/Users/james/.docker/machine/machines/default" export DOCKER_MACHINE_NAME="default" EXPOSE 8080 VOLUME /tmp […]