gpt4 book ai didi

java - 部署 war 在 docker 中抛出类未找到异常

转载 作者:行者123 更新时间:2023-11-28 23:16:33 24 4
gpt4 key购买 nike

我在 tomcat 中部署一个 war 文件,我得到 java.lang.ClassNotFoundException: oracle.i18n.util.LocaleMapper 异常。

Tomcat Dockerfile 定义了类路径

ENV JAVA_HOME /usr/jdk1.8.0_161
ENV CLASSPATH ${JAVA_HOME}/lib/orai18n-11.2.0.3.jar

在 Docker 实例中,类路径被接受:

root@aa649d0d1b5e:/usr/local/tomcat# export
.....
declare -x CLASSPATH="/usr/jdk1.8.0_161/lib/orai18n-11.2.0.3.jar"
.....

下面是docker实例异常

tomcat_1    | 06-Feb-2018 05:39:34.138 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:             
tomcat_1 | org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/abc]]
tomcat_1 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
tomcat_1 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
tomcat_1 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
tomcat_1 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
tomcat_1 | at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
tomcat_1 | at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
tomcat_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
tomcat_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
tomcat_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
tomcat_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
tomcat_1 | at java.lang.Thread.run(Thread.java:748)
tomcat_1 | Caused by: java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper
tomcat_1 | at oracle.xml.parser.v2.XMLReader.setEncoding(XMLReader.java:985)
tomcat_1 | at oracle.xml.parser.v2.XMLReader.checkXMLDecl(XMLReader.java:3367)
tomcat_1 | at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:575)
tomcat_1 | at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:279)
tomcat_1 | at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:240)
tomcat_1 | at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1521)
tomcat_1 | at org.apache.tomcat.util.descriptor.web.WebXmlParser.parseWebXml(WebXmlParser.java:119)
tomcat_1 | at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1114)
tomcat_1 | at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:775)
tomcat_1 | at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
tomcat_1 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
tomcat_1 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5105)
tomcat_1 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
tomcat_1 | ... 10 more
tomcat_1 | Caused by: java.lang.ClassNotFoundException: oracle.i18n.util.LocaleMapper
tomcat_1 | at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1291)
tomcat_1 | at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
tomcat_1 | ... 23 more
tomcat_1 |
tomcat_1 | 06-Feb-2018 05:39:34.153 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/usr/loca
/tomcat/webapps/abc.war]
tomcat_1 | java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina
.StandardHost[localhost].StandardContext[/abc]]
tomcat_1 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
tomcat_1 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
tomcat_1 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
tomcat_1 | at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
tomcat_1 | at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
tomcat_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
tomcat_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
tomcat_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
tomcat_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
tomcat_1 | at java.lang.Thread.run(Thread.java:748)
tomcat_1 |
tomcat_1 | 06-Feb-2018 05:39:34.157 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/to
cat/webapps/abc.war] has finished in [8,864] ms
tomcat_1 | 06-Feb-2018 05:39:34.160 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/loca
/tomcat/webapps/host-manager]

任何解决问题的帮助将不胜感激。

最佳答案

您必须在库中包含 orai18n-mapping.jar。

查看此博客: http://tomacree.blogspot.pe/2010/09/running-oracle-mapviewer-in-apache.html

你可以在JDev 11.2版本中找到orai18n-mapping.jar(你可以下载Java版,它是一个112MB的zip文件,不需要安装)。

Jar 位置:../modules/oracle.nlsrtl_11.1.0/orai18n-mapping.jar

JDev:http://www.oracle.com/technetwork/developer-tools/jdev/downloads/jdev11124download-1970562.html

这是我的 Google Drive 上的 orai18n-mapping.jar:https://drive.google.com/open?id=1g3C-rEh0iTM6wxtivKueeVAumm04gmV1

关于java - 部署 war 在 docker 中抛出类未找到异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48636250/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com