1 Reply Latest reply on Oct 30, 2005 2:38 PM by Ales Justin

    exception with jboss/spring

    kanna k7 Newbie

      Hi,
      Hi,
      I am getting a new exception which i have never faced before.kindly help me.I am using spring in jsp.This program works well if i run as stand alone program.i.e using main method .I have given my code and the exception is below:
      <%@page import="java.util.*,javax.sql.*,javax.naming.*,org .springframework.jdbc.core.*" %>
      <%@page import="org.springframework.jdbc.support.rowset.Sq lRowSet"%>
      <%@page import="org.springframework.jdbc.support.rowset.Sq lRowSetMetaData" %>
      <%!public List doSelect(String query)throws NamingException {
      Properties env = new Properties();
      env.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

      Context ctx = new InitialContext(env);
      DataSource datasource= (DataSource) ctx.lookup("OracleDS");

      JdbcTemplate jt = new JdbcTemplate(datasource);
      SqlRowSet rowset = jt.queryForRowSet(query);
      SqlRowSetMetaData rsmd = rowset.getMetaData();
      int colCount = rsmd.getColumnCount();
      System.out.println("colCount: " + colCount);

      ArrayList rows = new ArrayList();
      ArrayList list;
      while (rowset.next()) {
      list = new ArrayList();
      for (int i = 1; i <= colCount; i++) {
      list.add(rowset.getObject(i));
      }
      rows.add(list);
      }
      return rows;
      }
      %>



      JSP Page



      <h1 align="center">Welcome Admin</h1>

      <%
      List rows=doSelect("select * from tab where tabtype like 'SYNONYM'");

      Iterator it=rows.iterator();
      while(it.hasNext()){
      ArrayList disp=(ArrayList)it.next();
      Iterator it1=disp.iterator();
      while(it1.hasNext()){
      String str = (String)it1.next();
      out.println("" + it1.next() + "str1"+ "");
      }
      }
      %>




      OUTPUT:
      org.apache.jasper.JasperException
      org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:370)
      org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:81)


      root cause

      java.util.NoSuchElementException
      java.util.AbstractList$Itr.next(AbstractList.java: 422)
      org.apache.jsp.AdminUI_jsp._jspService(org.apache. jsp.AdminUI_jsp:107)
      org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
      org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:322)
      org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:81)