Javax.servlet.ServletException: Unable to get connection,DataSource invalid

Can somebody explain this error to me please
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception:
'java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)'.
** BEGIN NESTED EXCEPTION **
java.security.AccessControlException
MESSAGE: access denied (java.net.SocketPermission localhost resolve)
STACKTRACE:
java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)
     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
     at java.security.AccessController.checkPermission(AccessController.java:427)
     at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
     at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031)
     at java.net.InetAddress.getAllByName0(InetAddress.java:1117)
     at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
     at java.net.InetAddress.getAllByName(InetAddress.java:1061)
     at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:138)
     at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:277)
     at com.mysql.jdbc.Connection.createNewIO(Connection.java:2817)
     at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
     at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
     at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
     at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
     at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
     at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
     at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
     at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:274)
     at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
     at org.apache.jsp.index_jsp._jspx_meth_sql_query_0(index_jsp.java:100)
     at org.apache.jsp.index_jsp._jspService(index_jsp.java:58)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
     at java.security.AccessController.doPrivileged(Native Method)
     at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
     at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
     at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
     at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:177)
     at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
     at java.security.AccessController.doPrivileged(Native Method)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
     at java.lang.Thread.run(Thread.java:595)
** END NESTED EXCEPTION **
Attempted reconnect 3 times. Giving up.)"
     org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
     org.apache.jasper.runtime.PageContextImpl.access$11(PageContextImpl.java:781)
     org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:763)
     java.security.AccessController.doPrivileged(Native Method)
     org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:761)
     org.apache.jsp.index_jsp._jspService(index_jsp.java:81)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     java.lang.reflect.Method.invoke(Method.java:585)
     org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
     java.security.AccessController.doPrivileged(Native Method)
     javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
     org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
     org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

The URL url="jdbc:mysql://localhost:3306/wroxcatalog" looks right to me...wroxcatalog is the MySQL database.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ include file="include.jsp"%>
<sql:setDataSource
     var="datasource"
     driver="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost:3306/wroxcatalog"
     user="wroxuser"
     password="wrox" />
<sql:query var="books" dataSource="${datasource}">
     select id, name, description, price from products order by id
</sql:query>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TryDB</title>
</head>
<body>
<table border="1">
     <tr>
          <td>ID</td><td>Name</td><td>Description</td><td>Price</td>
     </tr>
          <c:forEach items="${books.rows}" var="row">
               <tr>
                    <td><c:out value="${row.id}"/></td>
                    <td><c:out value="${row.name}"/></td>
                    <td><c:out value="${row.description}"/></td>
                    <td><c:out value="${row.price}"/></td>
               </tr>
          </c:forEach>
</table>
</body>
</html>

Similar Messages

  • Problem: Unable to get connection

    I have a jsp page that allow user to upload excel file and at the same page retrieve the data from the uploaded excel file.
    the problem is when i click the upload button, i got this error:
    org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "java.sql.SQLException: [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine cannot open the file '(unknown)'.  It is already opened exclusively by another user, or you need permission to view its data."but after i refresh the page, it display the page that is expected (which display the data retrieve from uploaded excel file)
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <!-- Connect to ms excel -->
    <sql:setDataSource var="mp"
    driver="sun.jdbc.odbc.JdbcOdbcDriver"
    url="jdbc:odbc:mp-list" />
    <sql:query var="rs" dataSource="${mp}">
        SELECT * FROM [MP$]
    </sql:query>
    <html>
      <body>
          <form action="upload.jsp" enctype="multipart/form-data" method="post">       
             <b>File : </b><input type=file size=20 name="fname"/>
             <INPUT TYPE="Submit" NAME="Submit" VALUE="Upload">                     
          </form>
          <form name="planForm" action="updateDeviceInfo.jsp" method="post" onsubmit="return validate_form(this)">
            <b><font color="#0000CC">Plan ID: </font></b>
            <input name="planId" type="text" size="8" value="${param.planId}" /></p>
            <table> 
                <tr>
                    <td><b>Device <b></td>
                    <td><b>Qty</b></td>
                </tr>  
                <c:forEach var="Row" items="${rs.rows}">
                <tr>
                    <td><input name="partId" type="text" size="25" value="${Row.PartId}" /></td>
                    <td><input name="qty" type="text" size="12" value="${Row.Qty}" /></td>
                </tr>
                </c:forEach>
            </table>
            <input type="reset" name="reset" value="Clear">
            <input type="submit" name="submit" value=" Submit "/>
          </form>
      </body>
    </html>
    <%@ page import="java.util.*,
                     java.io.*,
                                 java.sql.*,
                     org.apache.commons.fileupload.*,
                     org.apache.commons.fileupload.servlet.*,
                     org.apache.commons.fileupload.disk.*,
                     org.apache.commons.fileupload.util.*"
    %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <html>
    <body>
    <%
      boolean isMultipart = ServletFileUpload.isMultipartContent(request);
      if(isMultipart)
                   String fileName = "";
                   DiskFileItemFactory factory = new DiskFileItemFactory();
                   ServletFileUpload upload = new ServletFileUpload(factory);
                   List items = upload.parseRequest(request);
                   Iterator iter = items.iterator();
                   String name = "";
                   String value = "";
                   InputStream stream = null;
                   //check any field to pass in
           while (iter.hasNext())
                            FileItem item = (FileItem) iter.next();
                         name = item.getFieldName();//field name
                                     value = item.getString();//field value
                         if (!item.isFormField()) {
                         name = item.getName();
                         if(name != null ){
                                                    //Upload file --start
                                                    fileName = new File(item.getName()).getName();
                                                    //Get upload diectory from xml
                                                    String uploadDirectoty="C://Program Files//Apache Software Foundation//Tomcat 5.5//webapps//QFN_Planning//uploadFiles//";
                                                    File file = new File(uploadDirectoty + fileName);
                                                    File dir = new File(uploadDirectoty);
                                                    if (!dir.exists())
                                                         new File(uploadDirectoty).mkdirs();
                                                    FileOutputStream fos = new FileOutputStream(file);
                                                    stream = item.getInputStream();
                                                    int c;
                                                    while(( c = stream.read()) != -1 )
                                                         fos.write( c );
                                                    stream.close();                    
      %>
    <c:redirect url="planForm.jsp"/>Above is my coding..
    Please point out the problem and suggest solution..
    Thanks and regards
    cavern

    If you have the file open via some other application such as Microsoft Excel when you run your java code, your java code will fail because Microsoft Excel has exclusive access to the file. Close Microsoft Excel and run your code again.
    If you still have problems, right click on the file icon in WindowsXP, select properties, and make sure the 'read only' checkbox isn't checked. If you're running in linux/unix, you will have to check the file permissions (read/write rights).

  • Unable to resolve this exception :javax.servlet.ServletException: No getter

    The source code I am having is
    1> Login.jsp
    2>LoginForm.java
    3>LoginAction.java
    4>web.xml
    5>struts-config.xml
    1>Login.jsp
    <%@ page language="java"%>
    <%@ page import="java.io.*"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <html:html>
    <center><IMG SRC="E:\jboss-4.0.3SP1\server\default\deploy\TestApplication.war\image\welcome.jpg" HEIGHT=233 WIDTH=282 ALT="WELCOME TO DATAMATICS"></center>
    <center><h1 style="color:blue"><hr>WELCOME TO DATAMATICS</hr></h1></center>
    <h2 style="color:green">LOGIN FORM</h2>
    <html:errors/>
    <center>
    <body>
         <html:form  action="/login.do"  >
         <table width="20%" border="0">
         <td>
              <tr><h4 style="color:red">USER ID:<h4></tr>
              <tr><html:text property="username" size="30"/></tr>
         <hr>
         </td>
         <td>
              <tr><h4 style="color:red">PASSWORD:</h4></tr>
              <tr><html:password property="password" size="30" /></tr>
         <hr>     
              <tr><html:submit>SUBMIT </html:submit></tr><hr>
              <tr><html:reset/></tr>
              <tr></tr>
         </td>
    </table>
    </body>
         </html:form>
    </center>
    </html:html>------------------------------------------------------
    2>LoginForm.java
    package com.MyPack.Datamatics;
    import com.MyPack.Datamatics.LoginAction;
    import javax.servlet.http.*;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action.*;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionError.*;
    //import java.util.*;
    //import java.io.*;
    public class LoginForm extends ActionForm
         private String username=null;
         private String password=null;
         public void setUserName(String username)
              this.username=username;
         public String getUserName()
              return username;
         public void setPassword(String password)
              this.password=password;
         public String getPassword()
              return password;
         public void reset(ActionMapping am,HttpServletRequest req)
              this.username="";
              this.password="";
         public ActionErrors validate(ActionMapping am, HttpServletRequest req)
              ActionErrors ae = new ActionErrors();
              if ( (username==null) || (username.length()==0))
         //     ae.add("username" , new ActionMessage("errors.username.required") );
              if( (password==null) || (password.length()==0))
         //     ae.add("password" , new ActionMessage("errors.password.required") );
         return ae;          
    3>LoginAction.java
    package com.MyPack.Datamatics;
    import com.MyPack.Datamatics.LoginForm;
    import javax.servlet.http.*;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    import javax.servlet.ServletException;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionError;
    public class LoginAction extends Action
         public ActionForward execute(ActionMapping am,
                                             ActionForm af,
                                             HttpServletRequest req,
                                             HttpServletResponse res)throws IOException, ServletException
              String target= new String("success");
              if(af!=null)
              LoginForm loginForm = (LoginForm)af;
              String userName = loginForm.getUserName();
              String password = loginForm.getPassword();
              if (userName.equalsIgnoreCase("Datamatics") && password.equalsIgnoreCase("12345"))
                   req.setAttribute("UserName",userName);
              else
                        target = new String("failure");          
         return am.findForward(target);
    4>web.xml
    <web-app>
         <servlet>
              <servlet-name>ActionServlet</servlet-name>
              <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
         <init-param>
              <param-name>config </param-name>
              <param-value>/WEB-INF/struts-config.xml</param-value>
         </init-param>
         <init-param>
              <param-name>application </param-name>
              <param-value>ApplicationResources</param-value>
         </init-param>
         <load-on-startup>2</load-on-startup>
         </servlet>
         <servlet-mappings>
              <servlet-name>ActionServlet</servlet-name>
              <url-mapping>*.do</url-mapping>
         </servlet-mappings>
         <taglib>
             <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
             <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
           </taglib>
        <taglib>
           <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
           <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
       <taglib>
          <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
          <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
       </taglib>
    </web-app>-----------------------
    5>Struts-config.xml
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <struts-config>
         <form-beans>
              <form-bean name="loginForm" type="com.MyPack.Datamatics.LoginForm"  />
              <form-bean name="uploadForm" type="com.MyPack.Datamatics.UploadForm" />
         </form-beans>
         <global-forwards>
              <forward name="success" path="/index.jsp"/>
         </global-forwards>
         <action-mappings>
              <action path="/login"
                        type="com.MyPack.Datamatics.LoginAction"
                        name="loginForm"
                        scope="request"
                        input="/login.jsp">
                   <forward name="success" path="/upload.jsp" />
                   <forward name="fail" path="/index.jsp" />
              </action>
              <action path="/upload"
                        type="com.MyPack.Datamatics.UploadAction"
                        name="uploadForm"
                        scope="request"
                        input="/upload.jsp">
                   <forward name="success" path="/successUpload.jsp" />
                   <forward name="fail" path="/index.jsp" />
              </action>
         </action-mappings>
    <controller
    processorClass="org.apache.struts.action.RequestProcessor"/>
    </struts-config>Kindly help where i am going wrong ..... I have mapped every property, even though I am getting this error
    :::::::>> javax.servlet.ServletException: No getter

    Error come from your LogonForm.
    Field: username So getter must be getUsername() and not getUserName() ("N" is lower case).

  • Getting  javax.servlet.ServletException: General error

    Someone pls help me....
    I am getting General Error while inserting a row in database.I am not able to solve this error...I would really appreciate your help...Thanks in advance...
    Following is my Code ::
    <%! int countBts,countBts1,mmm; %>
    <%! String msg; %>
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String dataSourceName = "ProjData";
    String dbURL = "jdbc:odbc:" + dataSourceName;
    Connection conn = DriverManager.getConnection(dbURL, "","");
    int dataMgx= Integer.parseInt(request.getParameter("allocMgxId"));
    int dataFrsm=Integer.parseInt(request.getParameter("allocFrsmSlotNo"));
    int dataPort=Integer.parseInt(request.getParameter("allocPortNo"));
    int dataBts=Integer.parseInt(request.getParameter("bts1"));
    int dataRpm=Integer.parseInt(request.getParameter("allocRpmNo"));
    int dataMultiLink=Integer.parseInt(request.getParameter("allocMultiLinkNo"));
    String dataPortStatus= "vacant";
    Statement myStat1 = conn.createStatement();
    myStat1.execute("select count(BTS_ID) from MGX where BTS_ID=" + dataBts);
    ResultSet result1 = myStat1.getResultSet();
    if(result1.next())
         countBts=Integer.parseInt(result1.getString(1));
    countBts1=countBts+1;
    if(countBts > 6)
         msg="Configuration of more than 6 spans not allowed";
    %>
    <h3><%=msg %></h3>
    <%}
    else
    PreparedStatement stmt1 =
    conn.prepareStatement(("Insert into MGX (BTS_ID,Port_Status,MGX_Num,Port_No,FRSM_No,RPM_Card,Multi_Link) values ("+dataBts+",'"+dataPortStatus+"',"+dataMgx+","+dataPort+","+dataFrsm+","+dataRpm+","+dataMultiLink+")"));
    mmm =     stmt1.executeUpdate();
    stmt1.close();
    if(mmm == 1)
    msg="One SpanRecord successfully added in the Database ";
    else
    msg="Failure in Update Operation";     
         result1.close();
         myStat1.close();
         conn.close();           
    %>
    The error I am getting is as follows::
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: General error
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
         org.apache.jsp._5_jsp._jspService(_5_jsp.java:179)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause
    java.sql.SQLException: General error
         sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
         sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
         sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
         sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
         org.apache.jsp._5_jsp._jspService(_5_jsp.java:121)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    Pls Help me

    Thanks for the reply buddy...
    As per your reply....I have tried modifying my Preparedstatement properly with ? and then binding values...
    But even after doing this i am still getting the same error....
    I am clueless...
    Following is my modified Prepared Statement ::
    conn.prepareStatement(("Insert into MGX (BTS_ID,MGX_Num,Port_No,FRSM_No,RPM_Card,Multi_Link,Port_Status) values (?,?,?,?,?,?,?)"));
    stmt1.setInt(1,Integer.parseInt(request.getParameter("bts1")));
    stmt1.setInt(2,Integer.parseInt(request.getParameter("allocMgxId")));
    stmt1.setInt(3,Integer.parseInt(request.getParameter("allocPortNo")));
    stmt1.setInt(4,Integer.parseInt(request.getParameter("allocFrsmSlotNo")));
    stmt1.setInt(5,Integer.parseInt(request.getParameter("allocRpmNo")));
    stmt1.setInt(6,Integer.parseInt(request.getParameter("allocMultiLinkNo")));
    stmt1.setString(7,"Allocated");
    Awaiting for a solution....

  • Javax.servlet.ServletException: Connection reset by peer....Help needed..

    Initially, when I clicked on my JSPs, everything was fine. I was able to retrieve data successfully from all the JSPs. However, after much clicking through the JSPs. I was not able to access the JSPs and the Internal Servlet Error was shown.
    Below is my Tomcat.log:
    Context log: path="/Aedge" Error in jsp service() : Connection reset by peer: socket write error
    javax.servlet.ServletException: Connection reset by peer: socket write error
         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:375)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
         at org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:163)
         at org.apache.tomcat.servlets.DefaultServlet.doGet(DefaultServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
         at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
         at java.lang.Thread.run(Unknown Source)
    Context log: path="/Aedge" <b>Internal Servlet Error:</b><br>.....
    What is the problem here? How can I solve this as I had to restart my Tomcat once a while due to this problem.

    ok.. I have db classes where all my sql statements methods are being displayed.. In each db class, there will be a getInstance() method to create the connection. Below is one of my db class.. How to I modified the things you had mentioned in my codes..
    package aedgeSoft.access;
    import aedgeSoft.business.*;
    import java.sql.*;
    import java.util.*;
    import java.util.Date;
    import java.io.*;
    public class DBMemberType
         private Connection con;
         private static DBMemberType instance = null;
         public static DBMemberType getInstance()
              try
                   if(instance==null)
                        instance = new DBMemberType();
              catch(SQLException e)
                   System.out.println("Problems with loading database in DBMemberType");
              catch(ClassNotFoundException e)
                   System.out.println("Problems with loading db driver in DBMemberType");
              finally
                   return instance;
         private DBMemberType() throws SQLException, ClassNotFoundException
              try{
              Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
              con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;user=username;password=password;DatabaseName=db");
              catch(InstantiationException e)
                   e.printStackTrace();
              catch(IllegalAccessException e)
                   e.printStackTrace();
         //add memberType
         public boolean addMemberType(MemberType mt)
    ..........

  • Trying to run, getting javax.servlet.ServletException: No fa

    Hallo -- I have written a simple test application in Nitrox (using JSF), and am having some trouble getting it running.
    I beleive I have set up the run parameters correctly (using Tomcat), but am getting the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: No faces context?!
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.pages.welcome_jsp._jspService(org.apache.jsp.pages.welcome_jsp:77)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: No faces context?!
         org.apache.myfaces.taglib.core.LoadBundleTag.doStartTag(LoadBundleTag.java:91)
         org.apache.jsp.pages.welcome_jsp._jspx_meth_f_loadBundle_0(org.apache.jsp.pages.welcome_jsp:94)
         org.apache.jsp.pages.welcome_jsp._jspService(org.apache.jsp.pages.welcome_jsp:64)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    [/code:1:48585cacb8]
    Can anybody shed any light on what might be wrong?
    Any & all help gratefully received,
       doug.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Please check your web.xml file for the URL pattern defined for Faces Servlet. And you need to access the JSF pages based on this definition.
    Ex:
    * <servlet-mapping>
         <servlet-name>FacesServlet</servlet-name>
         <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    - the url "http://localhost/chooselocale.faces"
    * <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/guess/*</url-pattern>
    </servlet-mapping>
    - the url "http://localhost/guess/greeting.jsp"
    Refer to the bookStore & guessNumber JSF sample applications.

  • What to do if i get Error 500: javax.servlet.ServletException: Filter [HSBC Filter]: filter is unavailable but at same time it opens from other IPad

    What to do if i get Error 500: javax.servlet.ServletException: Filter [HSBC Filter]: filter is unavailable but at same time it opens from other IPad

    Clear any HSBC related cookies from your browser cache and reload the page.

  • Getting Error: javax.servlet.ServletException: Cannot find ActionMappings o

    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:88)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
         org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:711)
         org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
         org.apache.jsp.index_jsp._jspx_meth_html_form_0(org.apache.jsp.index_jsp:139)
         org.apache.jsp.index_jsp._jspx_meth_html_html_0(org.apache.jsp.index_jsp:114)
         org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:81)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
    This is my web.xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app     PUBLIC "-//SUN Microsystem, //"
         "http://java.sun.com/j2ee/dtds/web-app_2.2/dtd">
    <web-app>
         <!--Action Servlet Configuration -->
         <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
              <!-- Resource Bundle base class -->
              <init-param>
                   <param-name>application</param-name>
                   <param-value>ApplicationResources</param-value>
              </init-param>
              <!-- Context Relative Path to the XML resource containing Struts Configuration -->
              <init-param>
                   <param-name>config</param-name>
                   <param-value>/WEB-INF/struts-config.xml</param-value>
              </init-param>
              <!-- The Debugging detail level for this servlet, which controls how much information -->
              <init-param>
                   <param-name>debug</param-name>
                   <param-value>2</param-value>
              </init-param>
              <load-on-startup>2</load-on-startup>
         </servlet>
         <!-- Action Servlet Mapping -->
         <servlet-mapping>
              <servlet-name>action</servlet-name>
              <url-pattern>*.do</url-pattern>
         </servlet-mapping>
         <!-- The welcome File List -->
         <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
         <!-- Application Tag Library Descriptor -->
         <taglib>
              <taglib-uri>/WEB-INF/app.tld</taglib-uri>
              <taglib-location>/WEB-INF/app.tld</taglib-location>
         </taglib>
         <!-- Struts Tag Lib Descriptors -->
         <taglib>
              <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
         </taglib>     
         <taglib>
              <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
         </taglib>     
         <taglib>
              <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
         </taglib>
    </web-app>
    ==================================================================================================================
    This is my Struts-config.xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE struts-config     PUBLIC "-//SUN Microsystem, //"
         "http://java.sun.com/j2ee/dtds/struts-config_1_0/dtd">
    <struts-config>
         <form-beans>
              <!-- Logon Form Bean -->
              <form-bean name="loginForm"     type="LoginForm" />
         </form-beans>
         <global-forwards>
              <forward name="mainmenu"      path="/mainmenu.jsp" />
         </global-forwards>
         <action-mappings>
              <!-- Process a user logon -->
              <action      path="/login"     type="LoginAction"     
                        name="loginForm"     scope="session"          input="/index.jsp">
              </action>
         </action-mappings>
         </struts-config>
    ==================================================================================================================
    This is my LoginForm.java file
    package src;
    import org.apache.struts.action.ActionForm;
    public class LoginForm extends ActionForm {
         private String login;
         private String password;
         public String getLogin() {
              return login;
         public void setLogin(String login) {
              this.login = login;
         public String getPassword() {
              return password;
         public void setPassword(String password) {
              this.password = password;
    ==================================================================================================================
    This is my LoginAction.java file
    package src;
    import java.io.IOException;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.struts.action.*;
    import org.apache.struts.action.Action;
    public class LoginAction extends Action {
         public ActionForward execute( ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException
              return (mapping.findForward("mainmenu"));
    ==================================================================================================================
    This is my index.jsp file
    <%@ page language ="java" %>
    <%@ taglib uri ="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri ="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri ="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html:html>
    <head>
         <title> My First Struts Application! </title>
    </head>
    <body>
         <html:form action="/login">
              LOGIN : <html:text property="login" />
              PASSWORD : <html:password property="password" />
              <html:submit> Login </html:submit>
              <html:reset> Reset </html:reset>
         </html:form>
    </body>
    </html:html>
    ==================================================================================================================
    and finally This is my mainmenu.jsp file
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld"      prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld"      prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld"      prefix="logic" %>
    <html:html>
    <head>
         <title>Main Menu</title>
    </head>
    <body>
         This is the MainMenu !
    </body>
    </html:html>
    ==================================================================================================================
    Kindly solve my problem........
    try to run on your machine...........
    I am using Tomcat 5.5.9 and my Project name is MyAppli

    Hey guys,
    Even I was frustrated for a long time with all the Struts errors for which Google returned loads of results but no particular solutions. All these solutions were all based on hit and trial and only work on some cases. Let me tell you that Struts (and most other frameworks) have a general approach to consume the actual error message and throw an exception which is light years away from the actual cause. So whats' the solution?
    Enable logging.... LOG4J to be precise...
    ...and see that it (log4j) is configured properly. You will see the actual cause there and not on the consoles of your servers (whichever you use).
    In my case, it was a host not found exception in the logs because I was sitting behind a firewall and the validator could not locate struts.apache.org
    (Wish this thread had some duke dollars)
    Regards,
    The Correspondent
    http://www.araneidae.org

  • Javax.servlet.ServletException: runtime failure in custom tag 'content'

    Hi When iam trying to click on a link which takes to an another JSP.
              iam getting this error after few minutes and that page doesnt display at
              all.
              can anybody help me out????
              ==vasan++;
              <Jan 9, 2001 11:50:10 AM PST> <Error> <HTTP>
              <[WebAppServletContext(627219,console)] exception raised on
              '/console/panels/mbean/Server.jsp'
              javax.servlet.ServletException: runtime failure in custom tag 'content'
              at
              weblogic.management.console.pages._panels._mbean._server._jspService(_server
              .java:9798)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :208)
              at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
              ntext.java:1127)
              at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
              :1529)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              <Jan 9, 2001 11:50:10 AM PST> <Error> <HTTP>
              <[WebAppServletContext(627219,console)] Root cause of ServletException
              java.net.SocketException: Connection reset by peer: socket write error
              at java.net.SocketOutputStream.socketWrite(Native Method)
              at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
              at
              weblogic.servlet.internal.ChunkUtils.writeHeaderChunk(ChunkUtils.java:127)
              at
              weblogic.servlet.internal.ResponseHeaders.writeHeaders(ResponseHeaders.java:
              345)
              at
              weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseIm
              pl.java:683)
              at
              weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamI
              mpl.java:124)
              at
              weblogic.servlet.internal.ServletOutputStreamImpl.flushWithCheck(ServletOutp
              utStreamImpl.java:451)
              at
              weblogic.servlet.internal.ServletOutputStreamImpl.print(ServletOutputStreamI
              mpl.java:243)
              at
              javax.servlet.ServletOutputStream.println(ServletOutputStream.java:286)
              at
              weblogic.servlet.jsp.JspWriterImpl.println(JspWriterImpl.java:204)
              at
              weblogic.management.console.pages._common._requestinfo.print(_requestinfo.ja
              va:68)
              at
              weblogic.management.console.pages._common._requestinfo._jspService(_requesti
              nfo.java:224)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :208)
              at
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              l.java:249)
              at
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              l.java:167)
              at
              weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:104)
              at
              weblogic.management.console.pages._common._error._jspService(_error.java:162
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :208)
              at
              weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
              l.java:149)
              at
              weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:100)
              at
              weblogic.management.console.pages._panels._mbean._server._jspService(_server
              .java:9830)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :208)
              at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
              ntext.java:1127)
              at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
              :1529)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              

    I just started getting this error after a year in production environment without any problems. Did you every find out what caused this or better yet how to prevent this?
              Dan.
              

  • Javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver

    Hi.
    I've got this piece of code into a servlet:
    <%@page language="java" import="java.sql.*"%>
    <%
    Driver DriverRecordset1 = (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection Conn = DriverManager.getConnection("jdbc:oracle:thin:@myserver:1521:SID","system","manager");
    When starting Tomcat, I included into startup.bat:
    set CLASSPATH=%CLASSPATH%;d:\orant\jdbc\classes102.zip (it exists)
    But when executing the code, I get this error message:
    javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
    What am I doing wrong?
    Thank you very much.

    The whole message:
    javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
         at mypage_1._jspService(mypage_1.java:112)
         at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
         at org.apache.tomcat.core.Handler.invoke(Unknown Source)
         at org.apache.tomcat.core.Handler.service(Unknown Source)
         at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
         at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
         at org.apache.tomcat.core.ContextManager.service(Unknown Source)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:484)
    ================
    If I write only:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    I get the same error.

  • Javax.servlet.ServletException: Before start of result set

    I have a page where i want to put items that have been entered into a bean and put them into my SQL database. Firs of all i want to insert some value into my question table and then I use the SELECT LAST_INSERT_ID() function in mySQL to get the last incremented ID from the first statement. As you can see I then want to use this ID and insert it into the other statements to relate the tables but I get an exception which is shown below. The frist insert staemet works fine when the rest is commented out but when i try it with the other 2 insert statements it throws this back at me.
    javax.servlet.ServletException: Before start of result set
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)     org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.authoring.question_005fmanager.process_005fquestion_jsp._jspService(process_005fquestion_jsp.java:453)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    java.sql.SQLException: Before start of result set
    com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:4424)
    com.mysql.jdbc.ResultSet.getNativeInt(ResultSet.java:6210)
    com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1335)     org.apache.jsp.authoring.question_005fmanager.process_005fquestion_jsp._jspService(process_005fquestion_jsp.java:126)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    My code is shown here
    // gets the feedback string parameters
    if (request.getParameterValues("feedbackBox") != null) {
        String [] feedbackList = request.getParameterValues("feedbackBox");
        questionData.feedback = feedbackList;
    //gets the session username variable
    String insertQuestion1__username = null;
    if (session.getValue("MM_Username") != null) {
        insertQuestion1__username = (String)session.getValue("MM_Username");
    //Creates a new mySQL date
    java.sql.Date currentDate = new java.sql.Date((new java.util.Date()).getTime());
    //goes thorugh each element of the scores array and calculates maxScore 
    questionData.maxScore = 0;
    for (int i = 0; i < questionData.scores.length; i++) {
        questionData.maxScore = questionData.maxScore + questionData.scores;
    Driver DriverinsertQuestion = (Driver)Class.forName(MM_connQuestion_DRIVER).newInstance();
    Connection ConninsertQuestion1 = DriverManager.getConnection(MM_connQuestion_STRING, MM_connQuestion_USERNAME,
    MM_connQuestion_PASSWORD);
    questionData.numOutcomes = questionData.choices.length;
    PreparedStatement insertQuestion1 =
    ConninsertQuestion1.prepareStatement("INSERT INTO Question.question (Topic_ID, Description, Image, Author, Created_Date, Max_Score, Question_Type) VALUES ('"
    + questionData.topicID + "', '"
    + questionData.questionText + "', '"
    + questionData.questionImage + "', '"
    + insertQuestion1__username + "', '" + currentDate
    + "', " + questionData.maxScore + ", '"
    + questionData.questionType + "') ");
    insertQuestion1.executeUpdate();
    PreparedStatement StatementlastID = ConninsertQuestion1.prepareStatement("SELECT LAST_INSERT_ID()");
    ResultSet lastID = StatementlastID.executeQuery();
    int questionID = lastID.getInt(1);
    Driver DriverinsertQuestion2 = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
    Connection ConninsertQuestion2 = DriverManager.getConnection(MM_connAnswer_STRING, MM_connAnswer_USERNAME,
    MM_connAnswer_PASSWORD);
    PreparedStatement insertQuestion2 =
    ConninsertQuestion2.prepareStatement("INSERT INTO Answer.question (Question_ID, Question_Description, Question_Type, Topic, Number_Outcomes, Question_Wording) VALUES ('"
    + questionID + "', '" + questionData.questionLabel
    + "', '" + questionData.questionType + "', '"
    + questionData.questionType + "', '"
    + questionData.topicID + "', '"
    + questionData.numOutcomes + "', '"
    + questionData.questionText + "' ) ");
    insertQuestion2.executeUpdate();
    Driver DriverinsertOutcomes = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
    Connection ConninsertOutcomes = DriverManager.getConnection(MM_connAnswer_STRING, MM_connAnswer_USERNAME,
    MM_connAnswer_PASSWORD);
    for (int i = 0; i < questionData.numOutcomes; i++) {
    PreparedStatement insertOutcomes =
    ConninsertOutcomes.prepareStatement("INSERT INTO Answer.outcome (Question_ID, Outcome_Number, Outcome_Text, Score, Feedback) VALUES ( '"
    + questionID + "', '" + i + "', '"
    + questionData.choices[i] + "', '"
    + questionData.scores[i] + "', '"
    + questionData.feedback[i] + "' ) ");
    insertOutcomes.executeUpdate();

    further to Limo2kz's problem, LAST_INSERT_ID() will return 0 if the last INSERT statement actually has inserted 0 records. this could happen if the previous INSERT attempt has failed.
    as far as i can remember, you should find out if the account or user that you are currently using to connect to MySQL database is allowed to do more SQL executions and create more SQL connections at certain given time (i.e., 10 executions in 1 hour, 10 connections in 1 hour). otherwise, you would have subsequent SQL exceptions because the database server won't allow you to execute them, thus giving you a null ResultSet.

  • WebLogic Server 9.2 Windows - javax.servlet.ServletException: [HTTP:101250]

    Hi,
    I am using BEA WebLogic Server 9.2
    When I deployed my [ear] apllication (Struts 1, Java 1.4, EJB2) I get this error:
    Message icon - Error     javax.servlet.ServletException: [HTTP:101250][weblogic.servlet.internal.WebAppServletContext@11c2137 -
    appName: 'test-ear', name: 'TEST', context-path: '/TEST']: Servlet class de.general.TestActionServlet for servlet action could not be loaded because a class on which
    it depends was not found in the classpath . java.lang.NoClassDefFoundError:
    org/apache/struts/action/ActionServlet.     
    Please help me in this ClassLoader problem,
    Regards

    Hi
    you can set the classpath struts.jar in setDomainEnv.cmd
    you can get this file in your root domain under the bin directory.
    set classpath=%classpath%;/struts.jar;

  • Javax.servlet.ServletException & java.lang.NoClassDefFoundError

    I am getting this javax.servlet.ServletException & java.lang.NoClassDefFoundError
    exceptions while running jsp in .netbeans.
    Iwas able to compile and run jsp pgms , but i am getting this error when i use jsp:useBean.I think the java class created is not in the proper path..netbeans is using tomcat server.The ide put the jsp's in the proper path. but it is not putting the java class i created with setter and getter methods.I also set the classpath. but din't work
    I t is eating up my time!Pl. suggest me a solution!
    Directory structure is :source file
    c:/windows/.netbeans/3.5/samples/jsp
    I guess the ide is putting all the class files(jsp) in
    C:\WINDOWS\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CWINDOWS_5C.netbeans_5C3.5_5Csampledir\JSP
    so i copied the userData.class from source dir to the above directory.
    and i also did the
    set CLASSPATH= C:\WINDOWS\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CWINDOWS_5C.netbeans_5C3.5_5Csampledir\JSP
    in dos prompt
    pl. find the code below.
    Html:
    <HTML>
    <HEAD>
    <TITLE>getData</TITLE>
    </HEAD>
    <BODY>
    <form method = post action="saveData.jsp">
    What's your Name : <input type=text name =username size=10>
    <br>
    What's Age : <input type=text name=age size=10>
    <br>
    What's ur email id : <input type=text name=email size=10>
    <input type=submit>
    </FORM>
    </BODY>
    </HTML>
    SaveData.jsp
    <jsp:useBean id="user" class="JSP.userData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <html>
    <head><title>using bean</title></head>
    <body>
    --Continue
    Thank u
    </body>
    </html>
    userData.java
    * userData.java
    * Created on February 12, 2004, 1:06 PM
    package JSP;
    * @author amano
    public class userData {
    String userName;
    int age;
    String email;
    /** Creates a new instance of userData */
    public userData()
    public void setUsername(String str)
    userName=str;
    public void setAge(int str)
    age=str;
    public void setEmail(String str)
    email=str;
    public String getUsername()
    return userName;
    public int getAge()
    return age;
    public String getEmail()
    return email;

    when i click on the submit button i get the following error msg.
    Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Error
    javax.servlet.ServletException: JSP/user_data
         at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:349)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.NoClassDefFoundError: JSP/user_data
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
         at java.lang.Class.getConstructor0(Class.java:1922)
         at java.lang.Class.newInstance0(Class.java:278)
         at java.lang.Class.newInstance(Class.java:261)
         at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.load(IDEJspServlet.java:106)
         at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.loadIfNecessary(IDEJspServlet.java:150)
         at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:160)
         at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246)
         at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:534)

  • Javax.servlet.ServletException: java.io.FileNotFoundException. How to catch when user

    How to catch when user enters a bogus jsp page. I have login.jsp. If someon enter log.jsp i get javax.servlet.ServletException: java.io.FileNotFoundException and then the whole path is shown. This onlyhappens with 9ias. When i was using http server that came with 9i database, i was able to catch this with send_error=true in zone.properties. It doesnt work with 9ias. How is everyone catching these errors? I cant seem to find out how to do it.
    Thanks

    Anyone have any suggestions on this? I take it noone catches this..

  • Javax.servlet.ServletException: Cannot create bean of class

    People,
    HELP!! I am getting desperate!!!
    I am a newbie when it comes to TOMCAT, but i have been using Blazix before.
    My current system is using APACHE/TOMCAT on a Solaris machine and I keep hitting the same problem. I have gone through the archives but the only thing it states is to check the directory which i have done.
    I keep getting:
    Error 500
    Internal Error
    javax.servlet.ServletException: Cannot create bean of class MyClass
    The code used to work on the Blazix server so i am assuming it is something to do with a config parameter somewhere - but i do not know where. I have checked the directory/package structure and they seem to work. It even serves it when they are html pages not jsp, but obviously wont use the bean. :(
    I can post code if necessary.
    Please help
    Steve

    The FormData.class file is in examples/WEB-INF/classes/ directory.
    Is this wrong? then should it be in a package called examples.steve???
    <TITLE> Poc </TITLE>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <META NAME="Generator" CONTENT="Mozilla/4.61 [en] (WinNT; I) [Netscape]">
    <META NAME="Author" CONTENT="Steve Brodie">
    <META NAME="Proof of Concept order entry system" CONTENT="">
    <META NAME="PROOF OF CONCEPT ORDER ENTRY SYSTEM " CONTENT="">
    </HEAD>
    <%@ page import="steve.FormData" %>
    <jsp:useBean id="user" class="steve.FormData"/>
    <jsp:setProperty name="user" property="*"/>
    <FORM METHOD=POST ACTION="SaveDetails.jsp">
    <CENTER>
    <H1>     
    POC CNS demo <BR>
    POC Order Entry System <BR></H1>
    <H2><CENTER>PROOF OF CONCEPT ORDER ENTRY SYSTEM <BR>
    in order to illustrate the use of an new product<BR></H1>
    </CENTER>
    <BODY>
    Please enter the following details: <BR>
    Second name <INPUT TYPE=TEXT NAME=secondName SIZE=20><BR>
    First name <INPUT TYPE=TEXT NAME=firstName SIZE=20><BR>
    Address <INPUT TYPE=TEXT NAME=address1 SIZE=20><BR>
    Address <INPUT TYPE=TEXT NAME=address2 SIZE=20><BR>
    Post Code <INPUT TYPE=TEXT NAME=postCode SIZE=10><BR>
    Phone NO. <INPUT TYPE=TEXT NAME=phone SIZE=10><BR>
    <BR>
    Credit Card<INPUT TYPE=TEXT NAME=credit SIZE=15><BR>
    <BR>
    Quality of Service:
    <SELECT TYPE=TEXT NAME="QoS">
    <OPTION SELECTED TYPE=TEXT NAME=Gold>Gold <BR>
    <OPTION TYPE=TEXT NAME=Silver>Silver <BR>
    <OPTION TYPE=TEXT NAME=Bronze>Bronze <BR>
    </SELECT>
    <BR>
    <BR>
    <INPUT TYPE=RESET>
    <P><INPUT TYPE=SUBMIT>
    <BR>
    <BR>
    <IMG SRC=../images/Cisco.gif>
    </FORM>
    </BODY>
    </HTML>
    package steve;
    * @author Steven Brodie
    * @date
    * @version 0.0
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class FormData {
         String secondName = null;
         String firstName = null;
         String address1 = null;
         String address2 = null;
         String postCode = null;
         int credit = 0;
         int phone = 0;
         String qos = null;
         String file = "out";
         String filex = "xout";
         PrintWriter pout = null;
         PrintWriter xout = null;
         FormData() {
              try {
                   pout = new PrintWriter(new BufferedWriter(new FileWriter(file + ".txt")));
                   xout = new PrintWriter(new BufferedWriter(new FileWriter(filex + ".xml")));
              xout.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              xout.println("<OrderEntry xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
              xout.println("xsi:noNamespaceSchemaLocation=\"http://machine2.com:8080/xml/xsd/OrderEntry.xsd\">");
              } catch (IOException ioe) {
                   System.err.println("DataFileWriter error ioe on init");
                   ioe.printStackTrace();
                   System.exit(1);
    public void setFirstName( String value ) {
    firstName = value;
              System.out.println(firstName);
              pout.println(firstName);
              xout.println("<firstname value= \"" + firstName + "\"/>");
    public void setSecondName( String value ) {
    secondName = value;
              System.out.println(secondName);
              pout.println(secondName);
              xout.println("<secondname value= \"" + secondName + "\"/>");
    public void setAddress1( String value ) {
    address1 = value;
              System.out.println(address1);
         pout.println(address1);
              xout.println("<address1 value= \"" + address1 + "\"/>");
    public void setAddress2( String value ) {
    address2 = value;
              System.out.println(address2);
              pout.println(address2);
              xout.println("<address2 value= \"" + address2 + "\"/>");
    public void setPostCode( String value ) {
    postCode = value;
              System.out.println(postCode);
              pout.println(postCode);
              xout.println("<postCode value= \"" + postCode + "\"/>");
    public void setCredit( int value ) {
    credit = value;
              System.out.println(credit);
              pout.println(credit);
              xout.println("<creditCard value= \"" + credit + "\"/>");
         public void setPhone( int value) {
              phone = value;
              System.out.println("0" + phone);
              pout.println("0" + phone);
              xout.println("<phoneNo value= \"0" + phone + "\"/>");
    public void setQoS( String value ) {
    qos = value;
              System.out.println(qos);
              pout.println(qos);
              xout.println("<QoS value= \"" + qos + "\"/>");
              xout.println("</OrderEntry>");
              pout.flush();
              pout.close();
              xout.flush();
              xout.close();
    public String getFirstName() {
              return firstName;
    public String getSecondName() {
              return secondName;
    public String getAddress1() {
              return address1;
    public String getAddress2() {
              return address2;
    public String getPostCode() {
              return postCode;
    public int getCredit() {
              return credit;
         public int getPhone() {
              return phone;
         public String getQoS() {
              return qos;

Maybe you are looking for

  • Random freezes-please, somebody, help me find a solution that works!

    I feel a little stupid posting a new thread for what seems to be (at the moment) a rather common issue, but almost every related thread I've come across seems to pin the blame on different things, and I want to consolidate all that I know about what'

  • Error in import schema

    I tried to import and remap a schema to new one. I have done these steps. almost there, but failed. Thanks. 1. create a new schema      create user hr_1 identified by hr_1;      CREATE OR REPLACE DIRECTORY test_dir AS 'C:\oracle\backup';      GRANT R

  • Flickering problem with Apple TV

    I am suddenly having flickering problems after updating Apple TV.  The box has worked fine for several months though I did have this same problem when I first got it in February.  I have a Panasonic 37' viera.  I have unplugged both the TV and the Ap

  • Cisco agent desktop - issue

    hello, we have an issue with two agents. when they open chat, all the time "Initializing" state, every 30 seconds, so active state every 30 seconds begins from 0, and new calls arrive to this agent what is could be? thank you

  • Updating multiple fields using a single update statement.

    Hi All, I am a beginner to Oracle. I have used the following Hint in an update query that is executed in Oracle 10G. We recently updated the Oracle to version 11g and when executing the query getting the following Error: ORA-01779: cannot modify a co