oracle数据库的tomcat上下文初始化失败

我在 Linux 环境中部署应用程序,我必须成功安装 tomcat 和 Oracle 数据库,之后我生成我的表并得到一个在 Windows 环境中运行良好的 .war 文件(模块)


我将它部署在 /tomcat/webapps 下,并正确配置了我的服务器 xml


    <Resource name="UserDatabase" auth="Container"

              type="org.apache.catalina.UserDatabase"

              description="User database that can be updated and saved"

              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"

              pathname="conf/tomcat-users.xml" />


    <Resource   auth="Container" 

            driverClassName="oracle.jdbc.driver.OracleDriver"

        factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" 

        global="jdbc/vimsDs"            

        initialSize="10" maxActive="100" maxWait="10000" minIdle="10" 

        username="****"

        name="jdbc/vimsDs"          

        password="*****" 

        removeAbandoned="true" removeAbandonedTimeout="36000" 

        type="javax.sql.DataSource" 

        url="jdbc:oracle:thin:@localhost:1521:XE"/>

之后我从tomcat管理器应用程序启动应用程序,它对我说无法启动应用程序


FAILED - 无法启动上下文/休息室路径的应用程序


它向我显示我的应用程序记录了这个错误


日志


2019-02-25 15:04:47.120 [http-bio-8080-exec-32] ERROR o.s.web.context.ContextLoader - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationConfig': Initialization of bean failed; nested exception is 


.....

陪伴而非守候
浏览 165回答 2
2回答

人到中年有点甜

您需要将 JNDI 名称添加到context.xml您的 WAR 文件中。文件:/META-INF/context.xml内容:<?xml version="1.0" encoding="utf-8" ?><Context>&nbsp; &nbsp; <ResourceLink name="jdbc/vimsDs"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; global="jdbc/vimsDs"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type="javax.sql.DataSource" /></Context>

萧十郎

在将 JNDI 添加到 context.xml 之后,我们还需要将 OracleJDBC.jar 添加到此文件 /tomcat/lib
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java