1

after searching for my problem in weblogic and hibernate I found that the problem happens in the jndi lookup, when you install the app, it runs ok but when you redeploy the app this happens :

javax.naming.NameNotFoundException: Unable to resolve 'ds_c719_002'. Resolved ''; remaining name 'ds_c719_002'

My config file (i'm using java config)

    @Bean 
    public DataSource getDatasourceConfiguration() {
        System.out.println("empezando a buscar jndi-------------");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e1) {

        }
     final JndiDataSourceLookup dsLookup = new JndiDataSourceLookup();
     dsLookup.setResourceRef(true);
     Hashtable<String, String> h = new Hashtable<String, String>(7);
     h.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); 

     InitialContext context=null;
    try {
        context = new InitialContext(h);
    } catch (NamingException e) {
        log.error(e);

    }
     DataSource dataSource;
    try {   
        dataSource = (javax.sql.DataSource) context.lookup("ds_c719_002");      
        this.ds=dataSource;
        context.close();
        return dataSource;
    } catch (NamingException e) {
        log.error(e);

    }
return null;
 }

Regards

user3272931
  • 45
  • 10
  • Not sure if you ever found a solution to this, but this SO answer worked for me just now: http://stackoverflow.com/a/36067760/130468 edit: specifically, I changed my `@Bean` to `@Bean(destroyMethod="")` – Sam Jones Jul 07 '16 at 18:06

0 Answers0