我怎么知道jndi查找是否在Spring Boot中工作

时间:2016-08-26 03:40:55

标签: oracle web-services spring-boot tomcat7 jndi

在我的Spring Boot Web应用程序中,我在application.properties(src / main / resources)中指定了jndi数据源名称以及其他数据库参数。

spring.datasource.jndi-name=jdbc/ristoreDataService
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect

在我在Apache Tomcat中部署之前,我在{apache-tomcat} / conf中编辑了context.xml,添加了以下内容:

<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Resource name="jdbc/ristoreDataSource" auth="Container"
          type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
          url="jdbc:oracle:thin:@ldap://mdaoid.xxx.org:389/risstg3, cn=OracleContext,dc=xxcc,dc=tmc,dc=org"
          username="db_owner" password="dbpass" maxActive="20" maxIdle="10"
          maxWait="-1"/>

然而,部署失败。我在catalina.log文件中发现以下错误,表明数据库连接不成功。

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ristoreService]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

我把它设置得对吗?我怎么知道jdni查找是否有效?

此行<WatchedResource>WEB-INF/web.xml</WatchedResource>最初位于context.xml中。但Spring Boot应用程序没有web.xml,这可能导致问题吗?

0 个答案:

没有答案