Weblogic datasource disappears from JNDI tree

寵の児 提交于 2019-12-17 18:35:14

问题


We are using weblogic version 12C. Steps to reproduce the issue: -

  1. Create the datasource.
  2. Deploy the application to weblogic.
  3. Application works fine.
  4. Update the deployed ear with the new one.
  5. Application is not able to connect the datasource.
  6. Datasource not available in the JNDI tree.

We need to create either a new datasource everytime or save the datasource setting again.

Can someone please check and let me know if you know some solution for this?


回答1:


I had the same problem. Adding destroyMethod="" fixed it for me.

Apparently if there is no destroyMethod, Spring tries to determine what the destroy method is. This is apparently causing the datasource to be closed and the JNDI key to be removed from the tree. Changing it to "" forces it to not look for a destroyMethod.

@Bean(destroyMethod = "")
public DataSource dataSource() throws NamingException{
    Context context = new InitialContext();
    return (DataSource)context.lookup("jdbc.mydatasource");
}



回答2:


WebLogic Server: Most Recent Configuration Changes get Rolled Back after an Admin Server Restart (Doc ID 1479592.1) To BottomTo Bottom

In this Document Symptoms Cause Solution APPLIES TO:

Oracle Weblogic Server - Version 9.2.3 and later Information in this document applies to any platform. SYMPTOMS

The most recent domain configuration changes get rolled back after an admin server restart.

After setting debug level logging, you can also see the following messages in the server logs at the time of the issue:

<> <000000>

ervers/domain_bak/config_prev_bak' to: /data/bea92/user_projects/domains/ko_webapp_domain/servers/domain_bak/config_prev>

CAUSE

A config_bak directory is present in the domain_bak directory. This causes the previous config.xml to replace the current config.xml.

SOLUTION

Remove the config_Bak directory.



来源:https://stackoverflow.com/questions/19158837/weblogic-datasource-disappears-from-jndi-tree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!