<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Últimas mensagens do tópico "erro inclusao na segunda tentativa"]]></title>
		<link>http://www.guj.com.br/posts/list/6.java</link>
		<description><![CDATA[Últimas mensagens enviadas no tópico "erro inclusao na segunda tentativa"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>erro inclusao na segunda tentativa</title>
				<description><![CDATA[ [color=darkblue][/color]<br /> <br /> ola pessoal, estou fazendo um cadastro pela primeira vez - estou depurando pelo eclipse - quando incluo pela primeira vez funciona perfeitamente, ao tentar incluir novamente dah o seguinte erro:<br /> <br /> [i]Source not found for ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 271<br /> [/i]<br /> <br /> [list]<br /> *pacotes que tenho na pasta lib do meu projeto<br /> xrecesimpl.jar<br /> xalan.jar<br /> standard.jar<br /> saxpath.jar<br /> sax.jar<br /> postgresql-8.0.310.jdbc2ee.jar<br /> jstl.jar<br /> jdbc2.0-stext.jar<br /> jaxp-api.jar<br /> jaxen-full.jar<br /> dom.jar<br /> [/list]<br /> <br /> ps: este erro acontece na linha<br /> return cnn.save("insert into task (tasdescription) values ('" + strDescription + "')");<br /> pelo que parece  <br /> <br /> classe Conexao<br /> [code]<br /> package br.metasolucoes;<br /> <br /> import java.sql.Connection;<br /> import java.sql.DriverManager;<br /> import java.sql.ResultSet;<br /> import java.sql.SQLException;<br /> import java.sql.Statement;<br /> <br /> /*<br />  * Created on Oct 11, 2004<br />  * @author darlan<br />  */<br /> <br /> public class Conexao {<br /> 	//conexao ao banco<br /> 	private Connection cnn = null;<br /> 	private final String sUrl = "jdbc:postgresql://localhost:5432/pso";<br /> 	private final String sUser = "darlan";<br />     private final String sPwd = "123";<br />     private String sQuery;<br />     private Statement st;<br />     <br />     /**<br />      * metodo construtor da conexao <br />      */<br />     public Conexao (){<br /> 		try	{		<br /> 			Class.forName("org.postgresql.Driver"); <br /> 			cnn = DriverManager.getConnection(sUrl, sUser, sPwd);			<br /> 		} catch (ClassNotFoundException cnfex) {<br /> 			System.err.println("Falha ao carregar o driver JDBC/PostgreSQL");<br />             cnfex.printStackTrace();<br />             System.exit(1);  // termina o programa<br /> 		} catch (SQLException sqlex){<br />             System.err.println( "Nao foi possivel conectar" );<br />             sqlex.printStackTrace();<br />             System.exit(1);  // termina o programa<br />         }	<br /> 	}<br /> 	<br /> 	public synchronized boolean save(String strQuery) {	    	    	   	    <br /> 	    try {	        <br /> 	        st =  cnn.createStatement();	        <br /> 	        st.executeUpdate(strQuery);	 <br /> 	        //st.close();<br /> 	        return true;<br /> 		} catch (SQLException e){		    		     <br /> 		    System.err.println( "erro no metodo de inclusao" );<br />             e.printStackTrace();<br />             return false;<br /> 		}<br /> 	    <br /> 	}<br /> 	<br /> 	/**<br /> 	 * metodo de exclusao<br /> 	 * @param sString sql para exclusao<br /> 	 * @return return true se sucesso<br /> 	 */<br /> 	<br /> 	public synchronized boolean delete(String strQuery){	<br /> 	    return save(strQuery);	     <br /> 	}<br /> 	<br /> 	public synchronized ResultSet query(String strQuery)<br /> 	{		         				<br /> 		ResultSet rs;<br /> 		try	{			<br /> 			<br /> 			Statement stm =  cnn.createStatement();			<br /> 			rs = stm.executeQuery(strQuery);			<br /> 			<br /> 			boolean moreRecords = rs.next();<br /> 			if (!moreRecords){<br /> 				//JOptionPane.showMessageDialog(null, "Nao foi encontrado nenhum registro");								<br /> 			}<br /> 			return rs;<br /> 		}catch (SQLException sqlex){<br /> 			System.err.println( "consulta: string conexao invalida" );<br /> 			sqlex.printStackTrace();<br /> 			<br /> 			return null;			<br /> 		}			<br /> 	}	<br /> 	<br /> 	public void close(){<br /> 		 try {		    <br /> 		     if (st!=null){<br /> 		         st = null;		     <br /> 		         cnn.close();<br /> 		     }<br />         } catch (Exception e) {<br />             e.printStackTrace();<br />         } <br /> 	}<br /> }<br /> [/code]<br /> <br /> classe TaskServlet<br /> [code]/**<br />  * Created on 12/04/2005<br />  * servlet responsavel pelo cadastro das tarefas<br />  */<br /> <br /> import java.io.IOException;<br /> import javax.servlet.ServletException;<br /> import javax.servlet.http.HttpServlet;<br /> import javax.servlet.http.HttpServletRequest;<br /> import javax.servlet.http.HttpServletResponse;<br /> <br /> import br.metasolucoes.Conexao;<br /> <br /> public class TaskServlet extends HttpServlet{<br />     <br />     private Conexao cnn = new Conexao();<br />     <br />     /**<br /> 	 * variables fields<br /> 	 */<br /> 	private String strDescription, strAcao; <br /> 	<br /> 	/*<br /> 	 * propriedades 	 <br /> 	 */<br /> 	<br /> 	/**<br /> 	 * propriedade descricao<br /> 	 */<br /> 	public void setDescription(String strDescription){<br /> 		this.strDescription = strDescription;<br /> 	}<br /> 	public String getDescription(){return strDescription;}<br /> 	<br /> 	// fim propriedades<br />    <br /> 	/*<br />     <br /> 	public void doGet(HttpServletRequest req, HttpServletResponse res)<br />     throws IOException, ServletException{<br /> 	    //	  define o tipo de conteudo que sera devolvido<br />         res.setContentType("text/html");        <br />         PrintWriter out = res.getWriter();<br />                         <br />     }<br />     */<br />     <br />     public void doPost(HttpServletRequest req, HttpServletResponse res)<br />     throws IOException, ServletException{<br />         res.setContentType("text/plain");<br />         <br />         strDescription = req.getParameter("tasdescription");<br />         strAcao = req.getParameter("setAcao");<br />         <br />         if (action(strAcao)==true) {<br />             res.sendRedirect("ok.jsp");<br />         }else{           <br />             res.sendRedirect("errobd.jsp");<br />         }<br />         //doGet(req, res);<br />         destroy();<br />     }<br />        <br />     public void destroy(){<br />         if (cnn!=null){<br />             cnn.close();<br />             cnn=null;<br />         }<br />         <br />     }<br />     <br />     /**<br />      * metodo de acao (inclui, exclui, edita)     <br />      */<br />     <br /> 	public boolean action(String strAcao){<br /> 	    System.out.println("valor descricao:" + strDescription);<br /> 	    if (strAcao.equals("1")) {<br /> 	        return cnn.save("insert into task (tasdescription) values ('" + strDescription + "')");	        <br /> 	    } else if (strAcao.equals("2")) {<br /> 	        return cnn.save("update task set tasdescription = '" + strDescription + "'");<br /> 	    } else if (strAcao.equals("3")) {	        <br /> 	    }		    <br /> 	    return true;<br /> 	    <br /> 	}<br />     	<br /> }<br /> [/code]<br /> <br /> chamada<br /> task.jsp<br /> <br /> &lt;form name="task" method="post" action="TaskServlet?setAcao=1" &gt;<br /> <br /> desde ja agradeço!]]></description>
				<guid isPermaLink="true">http://www.guj.com.br/prepost/23189/123614/erro-inclusao-na-segunda-tentativa
</guid>
				<link>http://www.guj.com.br/prepost/23189/123614/erro-inclusao-na-segunda-tentativa
</link>
				<pubDate><![CDATA[Wed, 20 Apr 2005 03:44:38]]> GMT</pubDate>
				<author><![CDATA[ darlan]]></author>
			</item>
			<item>
				<title>erro inclusao na segunda tentativa</title>
				<description><![CDATA[ Clica com o botao direito do mouse no nome do projeto, vai em Properties -&gt; Java build Path -&gt; Source<br /> <br /> entao adiciona o diretorio com codigo fonte na lista (a raiz do teu package)<br /> <br /> Rafael]]></description>
				<guid isPermaLink="true">http://www.guj.com.br/prepost/23189/123767/erro-inclusao-na-segunda-tentativa
</guid>
				<link>http://www.guj.com.br/prepost/23189/123767/erro-inclusao-na-segunda-tentativa
</link>
				<pubDate><![CDATA[Wed, 20 Apr 2005 12:27:18]]> GMT</pubDate>
				<author><![CDATA[ Rafael Steil]]></author>
			</item>
			<item>
				<title>Re: erro inclusao na segunda tentativa</title>
				<description><![CDATA[ Uma vez eu tive um problema parecido que foi por inconcistencia de chave primaria ... <br /> <br /> De uma olhada la ... <img src="http://www.guj.com.br/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif" border="0">]]></description>
				<guid isPermaLink="true">http://www.guj.com.br/prepost/23189/123778/re-erro-inclusao-na-segunda-tentativa
</guid>
				<link>http://www.guj.com.br/prepost/23189/123778/re-erro-inclusao-na-segunda-tentativa
</link>
				<pubDate><![CDATA[Wed, 20 Apr 2005 12:42:43]]> GMT</pubDate>
				<author><![CDATA[ fmeyer]]></author>
			</item>
			<item>
				<title>erro inclusao na segunda tentativa</title>
				<description><![CDATA[ "Source not found for XXX" acontece quando voce esta debugando no Eclipse e esta com algum problema na configuracao do projeto. Ele tenta pegar o .java do .class que esta com o breakpoint e falha. <br /> <br /> Rafael]]></description>
				<guid isPermaLink="true">http://www.guj.com.br/prepost/23189/123792/erro-inclusao-na-segunda-tentativa
</guid>
				<link>http://www.guj.com.br/prepost/23189/123792/erro-inclusao-na-segunda-tentativa
</link>
				<pubDate><![CDATA[Wed, 20 Apr 2005 13:18:19]]> GMT</pubDate>
				<author><![CDATA[ Rafael Steil]]></author>
			</item>
			<item>
				<title>Re: erro inclusao na segunda tentativa</title>
				<description><![CDATA[ Meim vi o erro do eclipse ... achei que poderia ser um erro de Chave ...]]></description>
				<guid isPermaLink="true">http://www.guj.com.br/prepost/23189/123807/re-erro-inclusao-na-segunda-tentativa
</guid>
				<link>http://www.guj.com.br/prepost/23189/123807/re-erro-inclusao-na-segunda-tentativa
</link>
				<pubDate><![CDATA[Wed, 20 Apr 2005 13:39:44]]> GMT</pubDate>
				<author><![CDATA[ fmeyer]]></author>
			</item>
			<item>
				<title>Re: erro inclusao na segunda tentativa</title>
				<description><![CDATA[ opa,<br /> não eh problema de chave. fiz um teste, criei uma tabela sem chave primaria<br /> soh com o campo tasdescription e da o mesmo erro<br /> <br /> outra coisa que aparece tambem(abre uma janela)<br /> <br /> The project: projeto which is referenced by the classpath, does not <br /> <br /> 'projeto' eh o nome do meu projeto<br /> <br /> quando reinicio o tomcat ele volta a funcionar, tanto faz se testo por dentro do eclipse ou não<br /> exist.  <img src="http://www.guj.com.br/images/smilies/9d71f0541cff0a302a0309c5079e8dee.gif" border="0"> <br /> <br /> [quote]entao adiciona o diretorio com codigo fonte na lista (a raiz do teu package) <br /> <br /> Rafael <br /> [/quote]<br /> diretorio com o codigo fonte de que??]]></description>
				<guid isPermaLink="true">http://www.guj.com.br/prepost/23189/123859/re-erro-inclusao-na-segunda-tentativa
</guid>
				<link>http://www.guj.com.br/prepost/23189/123859/re-erro-inclusao-na-segunda-tentativa
</link>
				<pubDate><![CDATA[Wed, 20 Apr 2005 15:43:30]]> GMT</pubDate>
				<author><![CDATA[ darlan]]></author>
			</item>
	</channel>
</rss>
