Tomcat vs Weblogic JNDI Lookup

前端 未结 8 1920
死守一世寂寞
死守一世寂寞 2020-11-28 07:23

The Weblogic servers we are using have been configured to allow JNDI datasource names like \"appds\".

For development (localhost), we might be running Tomcat and whe

8条回答
  •  春和景丽
    2020-11-28 07:47

    My application also had a similar problem and this is how I solved it:

    1) WEB-INF/classes/application.properties contains the entry:

    ds.jndi=java:comp/env/jdbc/tcds
    

    2) On the WLS machine, I have an entry in the /etc/sysenv file:

    ds.jndi=wlsds
    

    3) I configured spring to lookup the JNDI vis the property ${ds.jndi}, using a PropertyPlaceholderConfigurer bean with classpath:application.properties and file:/etc/sysenv as locations. I also set the ignoreResourceNotFound to true so that developers need not have /etc/sysenv on their machines.

    4) I run an integration test using Cargo+Jetty and I could not properly set up a JNDI environment there. So I have a fallback BasicDataSource configured too using the defaultObject property of JndiObjectFactoryBean.

提交回复
热议问题