Erro ao conectar com websphere

0 respostas
RiQuInHo_

Galera bom dia, poderiam me ajudar com esse problema, já estou quebrando a cabeça.
valeu obrigado!

error

04/10/2013 20:38:36 null null
WARNING: WSVR0072W
04/10/2013 20:38:37 null null
WARNING: WSVR0072W
04/10/2013 20:38:37 null null
WARNING: WSVR0072W
04/10/2013 20:38:37 null null
WARNING: WSVR0072W
04/10/2013 20:38:37 null null
INFO: Client code attempting to load security configuration
Exception in thread "P=915506:O=0:CT" java.lang.Exception: Falha na conexão com o SISE: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object.
	at br.com.sise.model.conexao.Conexao.getDS(Conexao.java:50)
	at br.com.sise.model.conexao.Conexao.getConnection(Conexao.java:92)
	at br.com.sise.controller.util.ConnectionFactory.getConnection(ConnectionFactory.java:26)
	at br.com.sise.controller.webservice.Teste.main(Teste.java:22)

codigo

public class Conexao {

	private PreparedStatement pstm;
	private Connection conn;
	private DataSource ds = null;
	private boolean isConexaoInterna = true;
	private static Conexao instance = null;

	public Conexao(Connection conexao) 
	{
		conn = conexao;
		isConexaoInterna = false;
	}

	public Conexao() {
		conn = null;
		isConexaoInterna = true;
	}

	protected void finalize() throws Exception {
		desconectar();
	}

	private DataSource getDS() throws Exception 
	{
		if(ds==null)
		{
			synchronized(DataSource.class)
			{
				try 
				{
					Context initialContext = new InitialContext();
					ResourceBundle  properties = ResourceBundle.getBundle("br/com/projeto/model/conexao/config_database");
					String conexao_nome = properties.getString("conexao_nome");
					ds = (DataSource)initialContext.lookup(conexao_nome);
				}
				catch (Exception e)
				{
					throw new Exception("Falha na conexão com o banco: " +  e.getMessage());
				}
			}
		}
		return ds;
	}

	//Abrir a Conexão
	public Connection getConexao() throws Exception {
		if (conn==null) conn = getDS().getConnection();
		return conn;
	}
	public void liberarStatement() throws Exception {
		if (this.pstm != null) {
			try {
				this.pstm.close();
			} catch (SQLException sQLException) {
			}
			this.pstm = null;
		}
	}

	//Fechar Conexão
	public void desconectar() throws Exception {
		liberarStatement();
		if (isConexaoInterna && this.conn!=null) {
			try {
				this.conn.close();
			} catch (SQLException sQLException) {
			}
			this.conn = null;
		}
	}
	
	public static synchronized Conexao getInstance() {
		if (instance == null) {
			instance = new Conexao();
		}
		return instance;
	}
	
	public Connection getConnection() throws Exception {
		return getDS().getConnection();
	}

}
Criado 4 de outubro de 2013
Respostas 0
Participantes 1