Ver Mensaje Individual
  #8 (permalink)  
Antiguo 10/10/2016, 16:57
Japrendo
 
Fecha de Ingreso: noviembre-2013
Mensajes: 147
Antigüedad: 10 años, 5 meses
Puntos: 1
Respuesta: weblogic datasource

Bien, ya despues de mucho leer, me he acercado a lo que parece ser la solucion :

Código Java:
Ver original
  1. public static synchronized Connection getConexion() {
  2.        Context ctx = null;
  3.        Hashtable ht = new Hashtable();
  4.        ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
  5.        ht.put(Context.PROVIDER_URL,"t3://127.0.0.1:7001");//hostname:port");
  6.        Connection conn = null;
  7.        Statement stmt = null;
  8.        ResultSet rs = null;
  9.        try {
  10.          ctx = new InitialContext(ht);
  11.          javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("jdbc/ConexionFV");
  12.          conn = ds.getConnection();
  13.        }catch (Exception e) {
  14.          System.out.println("Error --> " + e);
  15.          conn = null;
  16.        }
  17.        return conn;
  18.     }

Pero me genera un error :

javax.naming.NamingException: Lookup failed for 'jdbc/ConexionFV' in SerialContext[myEnv={java.naming.provider.url=t3://127.0.0.1:7001, java.naming.factory.initial=weblogic.jndi.WLInitia lContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.pr esentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.na ming} [Root exception is javax.naming.NameNotFoundException: ConexionFV not found]

No se si el que falla es el contexto o el Datasource en si...pero cuando lo cree el test funciono bien....alguien que me pueda ayudar?