我们有一个SpringBoot应用程序,该应用程序应在Docker容器中的Tomcat实例中运行,问题是Spring应用程序无法在我的MacOS主机上启动,但可以在Ubuntu主机上成功启动。
编辑:tomcat服务器上运行相同的战争(在我的Mac上-没有docker)很好,但是在docker容器中它不起作用!
登录Spring Application开始:
2018-06-20 13:28:12.123 INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1073 ms
2018-06-20 13:28:12.176 WARN 7 --- [ost-startStop-1] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletRegistrationBean' defined in class path resource [frontend/spring/report/BirtEngineServletConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.ServletRegistrationBean]: Factory method 'servletRegistrationBean' threw exception; nested exception is java.lang.ExceptionInInitializerError
基本上,每次都会发生这种类型的错误,即使我删除了应用程序的整个Birt堆栈,错误的类也只会是其他一些。
这使我怀疑我的环境可能会导致错误,因为我的日志与同事的日志之间的区别是以下内容仅出现在我的主机上,而不出现在其他主机上:
13:28:10.333 [localhost-startStop-1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletConfigInitParams' with lowest search precedence
13:28:10.336 [localhost-startStop-1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletContextInitParams' with lowest search precedence
13:28:10.341 [localhost-startStop-1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'jndiProperties' with lowest search precedence
13:28:10.342 [localhost-startStop-1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
13:28:10.342 [localhost-startStop-1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
13:28:10.342 [localhost-startStop-1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [StubPropertySource@354020215 {name='servletConfigInitParams', properties=java.lang.Object@5420df83}, StubPropertySource@825691136 {name='servletContextInitParams', properties=java.lang.Object@51372fd5}, JndiPropertySource@196027607 {name='jndiProperties', properties=org.springframework.jndi.JndiLocatorDelegate@59a13ee6}, MapPropertySource@1350532830 {name='systemProperties', properties={java.runtime.name=Java(TM) SE Runtime Environment, java.protocol.handler.pkgs=org.apache.catalina.webresources, sun.boot.library.path=/usr/lib/jvm/jre8/lib/amd64, java.vm.version=25.161-b12, shared.loader=, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, path.separator=:, tomcat.util.buf.StringCache.byte.enabled=true, java.util.logging.config.file=/opt/tomcat/conf/logging.properties, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding.pkg=sun.io, user.country=US, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=unknown, tomcat.util.scan.StandardJarScanFilter.jarsToScan=log4j-web*.jar,log4j-taglib*.jar,log4javascript*.jar,slf4j-taglib*.jar, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/opt/tomcat, java.runtime.version=1.8.0_161-b12, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.endorsed.dirs=/usr/lib/jvm/jre8/lib/endorsed, os.arch=amd64, java.io.tmpdir=/opt/tomcat/temp, line.separator=
, java.vm.specification.vendor=Oracle Corporation, java.naming.factory.url.pkgs=org.apache.naming, java.util.logging.manager=org.apache.juli.ClassLoaderLogManager, os.name=Linux, ignore.endorsed.dirs=, sun.jnu.encoding=ANSI_X3.4-1968, java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib, java.specification.name=Java Platform API Specification, java.class.version=52.0, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, os.version=4.9.87-linuxkit-aufs, java.util.concurrent.ForkJoinPool.common.threadFactory=org.apache.catalina.startup.SafeForkJoinWorkerThreadFactory, user.home=/root, catalina.useNaming=true, user.timezone=Etc/UTC, java.awt.printerjob=sun.print.PSPrinterJob, file.encoding=ANSI_X3.4-1968, java.specification.version=1.8, tomcat.util.scan.StandardJarScanFilter.jarsToSkip=bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,jaspic-api.jar,catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-storeconfig.jar,catalina-tribes.jar,jasper.jar,jasper-el.jar,ecj-*.jar,tomcat-api.jar,tomcat-util.jar,tomcat-util-scan.jar,tomcat-coyote.jar,tomcat-dbcp.jar,tomcat-jni.jar,tomcat-websocket.jar,tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,tomcat-jdbc.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl.jar,taglibs-standard-spec-*.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,junit.jar,junit-*.jar,hamcrest-*.jar,easymock-*.jar,cglib-*.jar,objenesis-*.jar,ant-launcher.jar,cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,xom-*.jar, catalina.home=/opt/tomcat, java.class.path=/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar, user.name=root, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.naming.,org.apache.tomcat., java.vm.specification.version=1.8, sun.java.command=org.apache.catalina.startup.Bootstrap start, java.home=/usr/lib/jvm/jre8, sun.arch.data.model=64, user.language=en, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.X11.XToolkit, java.vm.info=mixed mode, java.version=1.8.0_161, java.ext.dirs=/usr/lib/jvm/jre8/lib/ext:/usr/java/packages/lib/ext, sun.boot.class.path=/usr/lib/jvm/jre8/lib/resources.jar:/usr/lib/jvm/jre8/lib/rt.jar:/usr/lib/jvm/jre8/lib/sunrsasign.jar:/usr/lib/jvm/jre8/lib/jsse.jar:/usr/lib/jvm/jre8/lib/jce.jar:/usr/lib/jvm/jre8/lib/charsets.jar:/usr/lib/jvm/jre8/lib/jfr.jar:/usr/lib/jvm/jre8/classes, server.loader=, java.vendor=Oracle Corporation, catalina.base=/opt/tomcat, jdk.tls.ephemeralDHKeySize=2048, file.separator=/, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar", sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.tomcat., sun.cpu.isalist=}}, SystemEnvironmentPropertySource@945732227 {name='systemEnvironment', properties={PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tomcat/bin, TOMCAT_VERSION=8.5.24, HOSTNAME=1dac3826ef98, JAVA_HOME=/usr/lib/jvm/jre8, CATALINA_HOME=/opt/tomcat, JDK_JAVA_OPTIONS= --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED, PWD=/opt/tomcat, HOME=/root, SHLVL=0}}]
13:28:10.345 [localhost-startStop-1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Replacing PropertySource 'servletContextInitParams' with 'servletContextInitParams'
(这在Spring应用程序启动之前发生)
我已经尝试从ubuntu尝试使用手动安装了oracle java和tomcat的docker镜像以及官方的tomcat镜像。
答案 0 :(得分:0)
从日志中:
Caused by: java.lang.SecurityException: class "org.apache.commons.logging.LogConfigurationException"'s signer information does not match signer information of other classes in the same packag
e`
似乎服务器类路径中有两个apache-commons组件的JAR,并且这些JAR文件具有使用不同证书签名的签名。
检查您的类路径并删除其中一个JAR或从冲突的JAR清单中删除签名。
看到您使用对apache-commons
具有运行时依赖性的Apache Axis,我将尝试专门从构建中排除jar。