title: glassfish 4 & MySQL & JSTL
body: <p>I'm using Netbeanse 7.3.1 + Glassfish 4. I wrote simple web application using JSTL</p>
  
  <pre><code>&lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%&gt;
  
          &lt;sql:query var="txt" dataSource="jdbc/mrm_db"&gt;
              SELECT * FROM T2
          &lt;/sql:query&gt;
  
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;JSP Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;table&gt;
          &lt;c:forEach var="row" items="${txt.rows}"&gt;
              &lt;tr&gt;&lt;td&gt;&lt;c:out value="${row.txt}"/&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;/c:forEach&gt;
          &lt;/table&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Also i have added Galssfish JDBC Resource and configured connection pool and JDBC Resource. Added web.xml and config resource references.</p>
  
  <p>And when i trying start my applicatio a get error</p>
  
  <pre><code>Type Exception report
  
  messageInternal Server Error
  
  descriptionThe server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  
  javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused."
  
  root cause
  
  javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused."
  
  note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.0 logs.
  </code></pre>
  
  <p>It's looks like that Glassfish try use jdbc/__default, but not my datasource.</p>
  
  <p>If i'm create this project into Netbeans 7.2 and Glassfish 3.2, it's work fine.</p>
  
  <p>Can you help me, what am i doing wrong?</p>
  
  <p>Thanks!</p>