SingleThreadModel and amount of servlet instances ??

Hi !
          Is there anybody who knows how to determine amount of servlet instances in
          wl5.1 if the servlet is implemented in SingleThreadModel ?
          P.asi
          

Yup, I remember somebody mentioned that initial size is hardcoded to 5 and
          max size to 20.
          Robert Patrick <[email protected]> wrote:
          > I am not sure if a recent Service Pack has changed this or not but the
          > original implementation in WLS 5.x was that the SingleThreadModel always used
          > a fixed number of servlet instances (5, I think...).
          > Pasi Lukkarinen wrote:
          >> Hi !
          >>
          >> Is there anybody who knows how to determine amount of servlet instances in
          >> wl5.1 if the servlet is implemented in SingleThreadModel ?
          >>
          >> P.asi
          Dimitri
          

Similar Messages

  • Restricting Thread Pool for Servlet instances

    I am using WebLogic5.1.0 version wherein I am registering a Servlet which
    would be called by all the clients connecting
    to my aplication. The servlet's service methods is taking some time to
    execute. Since the servlet is following a SingleThreadModel, when there are
    a large number of Clients connected, the number instances of Servlets
    created are very high and the number of thread in the Application Server
    process becomes very high affecting the performance of the other
    applications.
    Is it possible to restrict the number of instances of the servlets that get
    created in the Application server ?
    What are the setting required to achieve this ?
    Sandeep

    Hi.
    I'm not aware of a property setting that allows you to restrict the number of
    servlet instances in WLS for the SingleThreadModel. The number of execute
    threads is fixed - it does not grow depending on load. You can set this value
    in the weblogic.properties file by setting weblogic.system.executeThreadCount.
    This value is 15 by default.
    It does sound like you are reaching the max capability of your
    server/hardware. You should try tuning WLS.
    Here are a couple of suggestions:
    1. Try adjusting the executeThreadCount value to a higher value. Start by
    setting it to 30 - see if that makes any difference.
    2. Check out the following tuning guide:
    http://www.weblogic.com/docs51/admindocs/tuning.html
    3. Here is a list of admin properties that might aid in tuning:
    http://www.weblogic.com/docs51/adminhelp/AdminPropertyHelp.html
    4. If you are still having problems you might do better by posting this issue
    to the performance newsgroup.
    Regards,
    Michael
    Sandeep Rajpathak wrote:
    I am using WebLogic5.1.0 version wherein I am registering a Servlet which
    would be called by all the clients connecting
    to my aplication. The servlet's service methods is taking some time to
    execute. Since the servlet is following a SingleThreadModel, when there are
    a large number of Clients connected, the number instances of Servlets
    created are very high and the number of thread in the Application Server
    process becomes very high affecting the performance of the other
    applications.
    Is it possible to restrict the number of instances of the servlets that get
    created in the Application server ?
    What are the setting required to achieve this ?
    Sandeep--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • Setting and/or detecting Servlet timeout

    Hi everyone!
    We have a servlet that we need to monitor if it is hanging up, and we decided to set up a servlet timeout mechanism; in other words, we will set a timeout delay for the servlet to load, and when the timeout delay (say, 5 minutes) has passed, we decide that it has already hung.
    Is there a way to set servlet timeouts? I would prefer an answer that does not require me to tweak the server timeout.
    Thank you very much!

    Jason, I do not think that there is any mechanism that will remove a servlet instance once it has been idle for a certain amount of time. For performance reason, it is removed only for some infrequent events, such as web server shutdown.
    May I ask what is your motivation?

  • Servlet Instances

    How can we differentiate between Servlet instances and threads.
    Actuaaly i want to know how a servlet handles multiple client requests at the same time.
    what i know is like:::
    a client sends a request to the server.
    A new thread is generated which will call the instance of the serlvlet on the server for processing..
    Is this flow is correct???
    am bit confused between threads and instances.
    Please help!!!!

    If you make that your servlets implement the
    SingleThreadModel interface (definition below), then
    you can configure Tomcat with the size of the pool. I
    think that even you can have only one instance, but
    this is not very advisable, unless you want your users
    to wait...Thnx for reply, Do you know how I can tell Tomcat to start multiple instances or alway stick with single instance. I cannot find this.
    "public interface SingleThreadModel
    Ensures that servlets handle only one request at a
    time. This interface has no methods. Yes I am aware of this.
    If a servlet implements this interface, you are
    guaranteed that no two threads will execute
    concurrently in the servlet's service method. The
    servlet container can make this guarantee by
    synchronizing access to a single instance of the
    servlet, or by maintaining a pool of servlet instances
    and dispatching each new request to a free servlet.
    This interface does not prevent synchronization
    problems that result from servlets accessing shared
    resources such as static class variables or classes
    outside the scope of the servlet."If only one user can access the servlet using this interface then why would you want syncrhonization??? There shouldn't be synchornization issues with a servlet that implements SingleThreadModel right??

  • Diagnosing an ASM space issue for a primary and a standby database instance with external redundancy.

    I've received an alert from Enterprise manager saying "Disk Group DATA_SID requires rebalance because at least one disk
    is low on space". My colleague who I would go to with this question is unavailable, so this is a learning opportunity
    for me. So far google and Oracle documentation have provided lots of information, but nothing that answers my questions.
    I've run the following query on both the primary and standby databases ASM instances:
    select name, disk_number, sector_size,os_mb, total_mb, free_mb, redundancy from v$asm_disk;
    On the primary I get 4810M Free space and 18431M Total Space
    on the standby I get 1248M Free space and 18431M Total Space -- this is the one that complained via OEM
    When I run the following query in the database instance:
    select sum(bytes)/1024/1024 MB from dba_segments;
    I get 3736.75M as a result.
    My questions are:
    1. Will OEM's suggestion to rebalance the disk actually help in this situation since the instance is set up with external redundancy?
    2. If I've got 18G of space and only 3.7G of data, why is OEM complaining?
    3. How can I reclaim what I presume is allocated but unused space in my problem disk group?
    4. How can I determine what extra data the standby has that the primary doesn't since both have the same total space allocation, but different amounts of free space?

    Thank you for the reply. That link is very good.
    We are an 11.1 version of our database. Linus is OEL 5.6.
    So, looking at the portion of the link that refers to 'Add Standby database and Instances to the OCR' - If we use SRVCTL to give the STANDBY the role of ‘physical_standby’ and the start option of ‘mount’, what effect will that have if the STANDBY becomes our PRIMARY?
    Would these database settings need to be modified manually with SRVCTL each time?
    We understand why the instance is not starting when the node is rebooted, we are looking for a best practice of how this is implemented.
    Thank you.

  • Error allocating a servlet instance

    i have a problem with the migration de aplication
    the aplication it�s mountage in HP with Unix, with containner iPlanet, with data bases SyBASE; and migrated in mac os x with data bases in MySQL, container TomCat;
    show the next error:
    javax.servlet.ServletException: Error allocating a servlet instance
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:625)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:163)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:552)
    root cause
    java.lang.NoClassDefFoundError: ServletVerifyPsswd (wrong name: SCI/ServletVerifyPsswd)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1649)
         at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:931)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1373)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1252)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:838)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:621)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:163)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:552)
    configuration of the archive server.xml
    <Context path="/sci" docBase="sci"
    debug="5" reloadable="true" crossContext="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="localhost_sci_log." suffix=".txt"
    timestamp="true"/>
    <Resource name="jdbc/dbSCI"
    auth="Container"
    type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/dbSCI">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <!-- Maximum number of dB connections in pool. Make sure you
    configure your mysqld max_connections large enough to handle
    all of your db connections. Set to 0 for no limit.
    -->
    <parameter>
    <name>maxActive</name>
    <value>100</value>
    </parameter>
    <!-- Maximum number of idle dB connections to retain in pool.
    Set to 0 for no limit.
    -->
    <parameter>
    <name>maxIdle</name>
    <value>30</value>
    </parameter>
    <!-- Maximum time to wait for a dB connection to become available
    in ms, in this example 10 seconds. An Exception is thrown if
    this timeout is exceeded. Set to -1 to wait indefinitely.
    -->
    <parameter>
    <name>maxWait</name>
    <value>10000</value>
    </parameter>
    <!-- MySQL dB username and password for dB connections -->
    <parameter>
    <name>username</name>
    <value>usersif</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sifsci</value>
    </parameter>
    <!-- Class name for mm.mysql JDBC driver -->
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <!-- The JDBC connection url for connecting to your MySQL dB.
    The autoReconnect=true argument to the url makes sure that the
    mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
    connection. mysqld by default closes idle connections after 8 hours.
    -->
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/bdsif?autoReconnect=true</value>
    </parameter>
    </ResourceParams>
    </Context>
    and the archive web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <description>Sistema de Consultas Integrales</description>
    <display-name>Sistema de Consultas Integrales</display-name>
    <servlet>
    <servlet-name>Connect</servlet-name>
    <servlet-class>Connect</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Connect</servlet-name>
    <url-pattern>/servlet/Connect</url-pattern>
    </servlet-mapping>
    <servlet>
    <servlet-name>ServletAcuOperacionSIF</servlet-name>
    <servlet-class>ServletAcuOperacionSIFeClase</servlet-class>
    </servlet>
    mapping the servlet
    <resource-ref>
    <description>DB Coneccion</description>
    <res-ref-name>jdbc/dbSCI</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>

    package SCI;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import java.math.*;
    import java.text.*;
    public class ServletAcumuladoOp extends HttpServlet{
         private ServletOutputStream out = null;          
         private ResultSet resultado = null;
         private Statement query = null;
         private String tv;
         private String liq;
         public ServletAcumuladoOp(){
              super();
         public void init(){
         //System.out.println("Inicie el servicio del ServletAcumuladoOp...");
         try{
              Class.forName("com.mysql.jdbc.Driver");
                   //System.out.println("Carge el Driver Sybase...");
              }catch(java.lang.ClassNotFoundException e){
                   System.out.println("Imposible cargar la clase : "+e.getMessage()+" ,,,Verifique la Ruta");
         public boolean datosOk(HttpServletRequest req){
              //System.out.println(req.getRemoteUser());
              Enumeration e = req.getParameterNames();
              Hashtable ht = new Hashtable();          
              while (e.hasMoreElements()) {
                   String cad= (String) e.nextElement();
                   ht.put(cad," ");          
              //     System.out.println(cad);     
              if ( ht.containsKey("TV_AS") && ht.containsKey("Liq") ){
                   tv = "";
                   liq = "";
                   liq = req.getParameter("Liq");
                   tv = req.getParameter("TV_AS");
              }else{
                   return false;
              return true;
         protected synchronized void doPost(HttpServletRequest req, HttpServletResponse res)
         throws IOException, ServletException{
              res.setContentType("text/html");
    out = res.getOutputStream();          
              out.println("<html>\n<head>\n<title>Acumulado de operaciones</title>\n</head>\n<body background='../../../../../SCI/GRA/fondo.jpg'><center>");
              if (datosOk(req)){
                   out.println("<TABLE BORDER=0 width=740 cellspacing=0 cellpadding=0>\n");
                   out.println("<tr>\n");
                   out.println("<td valign='top'><font face='Verdana,Arial' size=2 color='black'><b>");               
                   out.println("Acumulado de operaciones");
                   out.println("</b></TD>\n");
                   out.println("<td ALIGN=RIGHT valign='top'><font face='Verdana,Arial' size=1 color='black'>"+getFechaLocal()+"</FONT></TD>\n");
                   out.println("</tr>\n");
                   out.println("<tr>\n");
                   out.println("<TD colspan=2 align='left' valign='top'>\n");
                   out.println("<font face='Verdana,Arial' size=2 color='black'>\n");
                   if (tv.equals("") || tv.equals("*"))
                        out.println("Tipo de valor: <B>Todos</B>");
                   else
                        out.println("Tipo de valor: <B>"+tv+"</B>");
                   if (liq.equals("") || liq.equals("*"))
                        out.println(", Liquidaci&oacute;n: <B>Todas</B>");
                   else
                        out.println(", Liquidaci&oacute;n: <B>"+liq+"</B>");
                   out.println("</font></TD>\n");
                   out.println("</TR>\n");
                   out.println("</table>\n");
                   out.println("<br>\n");
                   if (getConsulta())                    
                        out.println("</TABLE>\n<HR color=Black width=740>\n</center></BODY>\n</HTML>");
                   else
                        out.println("<br><center><font face='Verdana,Arial' size=4 color=Red>No existen datos para este rango de fechas</font></center>\n</BODY>\n</HTML>");
              }else{
                   out.println("<BR><font face='Verdana,Arial' size=4 color=Red> Se ha producido un error interno... Los par�metros de este Servlet son incorrectos \n</font>\n</BODY>\n</HTML>");
              out.close();          
         public void setHead()throws IOException{
              out.println("<table border=0 width=740 height=30 cellspacing=0 cellpadding=0>\n<tr>\n");
              out.println("<td width=60 align=center ><font face='Verdana,Arial' size=-1><b>Inst</td>\n");
              out.println("<td width=60 align=center ><font face='Verdana,Arial' size=-1><b>Emisora</td>\n");
              out.println("<td width=40 align=center><font face='Verdana,Arial' size=-1><b>Liq</td>\n");
              out.println("<td width=50 align=center><font face='Verdana,Arial' size=-1><b>Oper</td>\n");
              out.println("<td width=70 align=center><font face='Verdana,Arial' size=-1><b>N Series</td>\n");
              out.println("<td width=70 align=center><font face='Verdana,Arial' size=-1><b>N Oper</td>\n");
              out.println("<td width=150 align=center><font face='Verdana,Arial' size=-1><b>Vol�men</td>\n");
              out.println("<td width=150 align=center><font face='Verdana,Arial' size=-1><b>Importe</td>\n");
              out.println("<td width=90 align=center><font face='Verdana,Arial' size=-1><b>% Part.</td>\n");
              out.println("</tr>");
         public boolean getConsulta() throws IOException{
              Connection conexion = getConexion();
              try{
                   DecimalFormat df = new DecimalFormat("###,###,###,###,###.00");
                   String cadTV = "";
                   String cadLiq = "";
                   int cont = 0;
                   double operaciones_total = 0;
                   double volumen_total = 0;
                   double importe_total = 0;
                   double operaciones_subtot = 0;
                   double volumen_subtot = 0;
                   double importe_subtot = 0;
                   double suma_total_importe = 0;
                   double porcentaje = 0;
                   boolean ok = false;
                   int cent = 0;
                   boolean bandera = true;
                   int col = 0;
                   String color = "";
                   //Determina si ya cerr� el mercado
                   query=conexion.createStatement();
                   String sql = "select ctr_estado from ctrlre";
                   resultado=query.executeQuery(sql);
                   while (resultado.next())
                        cadTV = resultado.getString(1);
                   out.println("<table border=0 width=740 height=30 cellspacing=0 cellpadding=0 >");
                   out.println("<TR>");
                   out.println("<TD bgcolor='#FFFFBB' align=right><FONT face='Verdana,Arial'><b>");
                   if ( cadTV.equals("NO") )
                        out.println("DEFINITIVO</b></FONT> </TD> </TR> </table>\n");
                   else
                        out.println("PRELIMINAR</b></FONT> </TD> </TR> </table>\n");
                   out.println("<BR>");
                   cadTV="";
                   sql = getSql();
                   query = conexion.createStatement();
                   resultado = query.executeQuery(sql);
                   //out.println(sql);
                   while(resultado.next()){
                        if (bandera){
                             setHead();
                             bandera = false;
                        String tvalor = resultado.getString(1); //thp_tipo_valor
                        String emisora = resultado.getString(2); //thp_emisora
                        String liquidacion = resultado.getString(3); //thp_liquidacion
                        String toperacion = resultado.getString(4); //thp_tipo_operacion
                        int series = resultado.getInt(5); //series
                        int operaciones = resultado.getInt(6); //operaciones
                        double volumen = resultado.getDouble(7);; //thp_volumen
                        double importe = resultado.getDouble(8);; //thp_importe
                        // Salida al browser
                        if (cont == 0){
                             cadTV = tvalor.trim();
                             cadLiq = liquidacion.trim();
                             suma_total_importe = getTotalImporte(tvalor, liquidacion);
                        if (col == 1){                         
                             color = "#E1E1E1";
                             col = -1;
                        if (col == 0)
                             color = "#FFFFFF";
                        col++;
                        if ( (!cadTV.equals(tvalor.trim()) || !cadLiq.equals(liquidacion.trim()) )&& cont != 0){
                             setSubTotal(cadLiq, operaciones_subtot, volumen_subtot, importe_subtot, df);
                             suma_total_importe = getTotalImporte(tvalor, liquidacion);
                             // Agrega a sumas totales               
                             operaciones_total = operaciones_total + operaciones_subtot;
                             volumen_total = volumen_total + volumen_subtot;
                             importe_total = importe_total + importe_subtot;
                             operaciones_subtot = 0;
                             volumen_subtot = 0;
                             importe_subtot = 0;
                             cadTV = tvalor.trim();
                             cadLiq = liquidacion.trim();
                             cont=0;
                             out.flush();
                        operaciones_subtot = operaciones_subtot + operaciones;
                        volumen_subtot = volumen_subtot + volumen;
                        importe_subtot = importe_subtot + importe;
                        if (suma_total_importe == 0)
                             porcentaje = 0;
                        else
                             porcentaje = ( importe * 100 ) / suma_total_importe;
                        setRow(color,
                        " "+tvalor,
                        " "+emisora,
                        " "+liquidacion,
                        " "+toperacion,
                        " "+series,
                        " "+operaciones,
                        " "+df.format(volumen),
                        " "+df.format(importe),
                        " "+getScala(porcentaje,2));
                        cont++;
                        cent++;
                   conexion.close();
                   if (cent==0){ // No hubo registros
                        return false;
                   if (cont!=0){
                        setSubTotal(cadLiq, operaciones_subtot, volumen_subtot, importe_subtot, df);
                        // Agrega a sumas totales               
                        operaciones_total = operaciones_total + operaciones_subtot;
                        volumen_total = volumen_total + volumen_subtot;
                        importe_total = importe_total + importe_subtot;
                   setTotal(operaciones_total, volumen_total, importe_total, df);
              }catch(SQLException e){
                   System.out.println("Codigo de Error :"+e.getErrorCode());
                   System.out.println("Descripci�n del error :"+e.getMessage());
                   System.out.println("Estado del SQL :"+e.getSQLState());                    
              return true;
         public String getSql(){
              String sql1="select thp_tipo_valor, thp_emisora, thp_liquidacion, thp_tipo_operacion, "+
         "count(distinct(thp_emision)), count(thp_folio), sum(thp_volumen), sum(thp_importe) "+
                   "from thecprod "+
                   "where ( thp_tipo_valor = '"+tv+"' or '"+tv+"'='*') and "+
                   " ( thp_liquidacion = '"+liq+"' or '"+liq+"'='*') "+
                   "group by thp_tipo_valor, thp_emisora, thp_liquidacion, thp_tipo_operacion";
              return sql1;
         public void setRow(String a1,String a2,String a3,String a4,String a5,String a6,String a7,String a8,
                                  String a9, String a10) throws IOException{
                   out.println("<tr bgcolor='"+a1+"'"+" align=center bordercolor='"+a1+"' bordercolorlight='"+a1+"' bordercolordark='"+a1+"'>\n");
                   out.println("<td width=60 align=center><font face='Verdana,Arial' size=-1>"+a2+"</td>\n");
                   out.println("<td width=60 align=center><font face='Verdana,Arial' size=-1>"+a3+"</td>\n");
                   out.println("<td width=40 align=center><font face='Verdana,Arial' size=-1>"+a4+"</td>\n");
                   out.println("<td width=50 align=center><font face='Verdana,Arial' size=-1>"+a5+"</td>\n");
                   out.println("<td width=70 align=center><font face='Verdana,Arial' size=-1>"+a6+"</td>\n");
                   out.println("<td width=70 align=center><font face='Verdana,Arial' size=-1>"+a7+"</td>\n");
                   out.println("<td width=150 align=right><font face='Verdana,Arial' size=-1>"+a8+"</td>\n");
                   out.println("<td width=150 align=right><font face='Verdana,Arial' size=-1>"+a9+"</td>\n");
                   out.println("<td width=90 align=right><font face='Verdana,Arial' size=-1>"+a10+"%</td>\n");
                   out.println("</tr>\n");
         public void setSubTotal(String liquidacion, double operaciones_sub, double volumen_sub, double importe_sub, DecimalFormat df)throws IOException {
              out.println("<tr>\n");
                   out.println("<td width=60 align=center bgcolor=#FFFFFF><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=60 align=center bgcolor=#FFFFFF><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=40 align=center bgcolor=#ffffbb><font face='Verdana,Arial' size=-1>"+liquidacion+"</td>\n");
                   out.println("<td width=50 align=center bgcolor=#ffffbb><font face='Verdana,Arial' size=-1>Total</td>\n");
                   out.println("<td width=70 align=center bgcolor=#ffffbb><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=70 align=center bgcolor=#ffffbb><font face='Verdana,Arial' size=-1>"+getScala(operaciones_sub,0)+"</td>\n");
                   out.println("<td width=150 align=right bgcolor=#ffffbb><font face='Verdana,Arial' size=-1>"+df.format(volumen_sub)+"</td>\n");
                   out.println("<td width=150 align=right bgcolor=#ffffbb><font face='Verdana,Arial' size=-1>"+df.format(importe_sub)+"</td>\n");
                   out.println("<td width=90 align=right bgcolor=#ffffbb><font face='Verdana,Arial' size=-1>100.00%</td>\n");
                   out.println("</tr>\n");
         public void setTotal(double operaciones_total, double volumen_total, double importe_total, DecimalFormat df)throws IOException {
              out.println("<tr>\n");
                   out.println("<td width=60 align=center bgcolor=#FFFFFF><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=60 align=center bgcolor=#FFFFFF><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=40 align=center bgcolor=#FFFFFF><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=50 align=center bgcolor=#FFFFFF><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=70 align=center bgcolor=#FFFFFF><font face='Verdana,Arial' size=-1> </td>\n");
                   out.println("<td width=70 align=center bgcolor=#b5cffb><font face='Verdana,Arial' size=-1>"+getScala(operaciones_total,0)+"</td>\n");
                   out.println("<td width=150 align=right bgcolor=#b5cffb><font face='Verdana,Arial' size=-1><b>"+df.format(volumen_total)+"</td>\n");
                   out.println("<td width=150 align=right bgcolor=#b5cffb><font face='Verdana,Arial' size=-1><b>"+df.format(importe_total)+"</td>\n");
                   out.println("<td width=90 align=right bgcolor=#b5cffb><font face='Verdana,Arial' size=-1><b> </td>\n");
                   out.println("</tr>\n");
         public String getScala(double val, int uno){
              BigDecimal bd = new BigDecimal(val);
              return " "+bd.setScale(uno,5);
         protected synchronized double getTotalImporte(String tipovalor, String liquidacion){          
              double total = 0;
              try{
                   Connection conexion1 = getConexion();
                   Statement q = conexion1.createStatement();
                   String sql ="";
                   sql = "select sum(thp_importe) from thecprod where thp_tipo_valor = '"+tipovalor+"' and thp_liquidacion = '"+liquidacion+"'";
                   ResultSet res = q.executeQuery(sql);
                   while(res.next()){
                        total = res.getDouble(1);
                   res.close();
                   conexion1.close();               
              }catch(SQLException e){
                   System.out.println("Codigo de Error :"+e.getErrorCode());
                   System.out.println("Descripci�n del error :"+e.getMessage());
                   System.out.println("Estado del SQL :"+e.getSQLState());
              return total;
         public Connection getConexion(){
              String url ="jdbc:mysql//localhost:3306/bdsif";
              Connection conexion = null;
              try{
                   conexion = DriverManager.getConnection(url, "usersif", "password");
              }catch(SQLException e){
                   System.out.println("Codigo de Error :"+e.getErrorCode());
                   System.out.println("Descripci�n del error :"+e.getMessage());
                   System.out.println("Estado del SQL :"+e.getSQLState());
              return conexion;
         public String getFechaLocal(){
              java.util.Date today;
              String output;
              java.text.SimpleDateFormat formatter;
              formatter = new java.text.SimpleDateFormat("EEEEEEEEE dd 'de' MMMMMMMMMM 'del' yyyy", new Locale("es", "Spanish"));
              today = new java.util.Date();
              return " "+formatter.format(today);          
         public void destroy(){
    //     System.out.println("Destrui el ServletAcumuladoOp...");
    }

  • Servlet instance problem

    Hi
    I am have a web application that does a lot of processing. when 2 users submit the form.. i noticed that one instance of the servlet is running and the other request waits for some time for
    processor and just dies off.. Servlets are suppose to be thread safe and 'n' number of intances can be created . why only one
    instance running at a given time.. My servlet is not a single instance servlet and i have not placed an restrictions of that sort..
    can anyone help me with this ??
    rgds
    satish

    I have written the processing part in dopost method.. which takes a few seconds to finish for each instance (creatting a huge array of objects ). Then i keep the reference of this in session. While the objects are being generated, if i send another request the first servlets dies and the second one proceeds , sometimes second one dies off after waiting for something..
    yes i am testing by 2 users from 2 different machines.its not the connection problem.. the systems.outs show that both the servlet instances are running at one point of time then suddenly one dies.. i have allocated 1000m to tomcat... so memory is not a problem i suppose..
    Any helping tips ?
    rgds
    satish

  • Where is a Servlet instance stored in Tomcat?

    Hi,
    We know that servlet container generates ONLY ONE servlet instance which will handle all the client requests for the servlet. This makes big inconvenionce in debug phase using Tomcat server. Unless restarting the server, you will not be able to see the changes you made in the servlet class.
    My question is where the servlet instance is stored in Tomcat. I think it should be in [TOMCAT_HOME]/work/ directory but actually not. My approach is deleting the instance before sending request to the servlet. In this way, servlet container will generate an instance of new version of the servlet class.
    Is there any other way to work around that?
    Thanks,

    We know that servlet container generates ONLY ONE
    servlet instance which will handle all the client
    requests for the servlet. My Tomcat instance will pool servlet instances. It might look like only one instance to you, but that doesn't mean that Tomcat does it that way.
    This makes big inconvenionce in debug phase using Tomcat server. This makes no sense to me. Are you talking about load testing?
    Unless restarting the server, you will not be able to see the changes you made in the servlet class.This has nothing to do with debugging. And Tomcat has hot deployment now if you do it correctly with WAR files.
    My question is where the servlet instance is stored in Tomcat. I think it should be in
    [TOMCAT_HOME]/work/ directory but actually not. My approach is deleting the instance before sending
    request to the servlet. In this way, servlet container will generate an instance of new version of the
    servlet class.Sounds like you don't know how to deploy to Tomcat properly. Servlet .class files are stored where you put them: in the WEB-INF/classes directory for your Web app, in a JAR in the WEB-INF/lib directory for your Web app. These are either in the TOMCAT_HOME/webapps context directory that you create or, better yet, in the WAR file that you deploy to TOMCAT_HOME/webapps.
    The /work directory that you refer to is where Tomcat puts generated Java code for JSPs.
    Is there any other way to work around that?There's no way to change it, and there's no reason that I can think of to explain why you'd want to. What is the real problem here?

  • HELP!!!! -- Error allocating a servlet instance

    Please help me...
    The deathline for my schoolproject is getting close!!!
    - 2 weeks ago everything worked fine
    - now i wanted to start at making the last changes...
    but...the only thing a get is this...
    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: Error allocating a servlet instance
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:670)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:292)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1274)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:884)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:666)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
         at java.lang.Thread.run(Thread.java:536)

    The actual bizare thing in all this is that everything worked fine 2 weeks ago and that i touched nothing in the meanwhile...
    Important to note is also that the examples of tomcat still work fine so that i know that servlet.jar is at his place and in fact still being used correctly, at least in those examples.
    What the servlet itself consernes, by putting a println-statement at the beginning of the init-method i can conclude that he doesn't seems to be able to reach the servlet at all. (compilation of all my files works still without any problems)
    Could it be possible that my problem has something to do with the web.xml file? Ok, he worked alright...but maybe something isn't quite as it should be...
    Thx for the responses!!!
    Maybe you guys can help me further with this information...I at least hope so!
    greetings
    steven

  • What if i give -1 as a Servlet instance in pool in web.xml

    What if i give -1 as a no of Servlet instance, in pool, in web.xml

    Try it and them get back to us and let us know if it works.

  • OC4J / more servlet instances on startup

    Runninng SingleThreadModel-Servlet on OC4J want to initialize 10 servlet-instances on startup of my container. Can somebody tell me how should I configure OC4J to get it ???
    best regards
    Stan

    I've solved the said problem. I need to add load-on-startup to <default-web-app application="default" name="defaultWebApp" root="/j2ee" load-on-startup="true"/>.
    James Thanks for sending the solution James.
    -steve-

  • GR/IR A/c Amount and Amount in local Curreny values are not matching

    Hello Gurus
    When we are doing MIGO for some Scheduling Agreement PO's the Amount and Amount in local currency columns are mismatching with  paise (+/-), eventhough PO belongs to Local Currency (INR). Because of this GR/IR account is not cleared after MIRO through F.13. Both MIGO and MIRO amount are showing as Open items.
    Why it is happening and what is the way to clear GR/IR A/C. (F.13 with Tolerance limit is also not workout).
    Thanks & Regards
    Venkat.P

    Hi sridhar
    Thanks for reply
    Through MR11 also these values are not cleared.
    Regards
    Venkat.P

  • Parsing XML and Storing values in instance variable

    hi,
    i'm new to XML.
    here i'm trying to parse an XML and store their element data to the instance variable.
    in my main method i'm tried to print the instance variable. but it shows "" (ie it print nothing ).
    i know the reason, its becas of the the endElement() event generated and it invokes the characters() and assigns "" to the instance variable.
    my main perspective is to store the element data in instance variable.
    thanks in advance.
    praks
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    public class mysax extends DefaultHandler
         String ctelement;
         CharArrayWriter contents;
         String vname1,vrcbreg1,vaddress1,vcountry1,vtelephone1,vfax1;
         String vname,vrcbreg,vaddress,vcountry,vtelephone,vfax;
         public mysax()
              vname1 = null;
              vrcbreg1 = null;
              vaddress1 = null;
              vcountry1 = null;
              vtelephone1 = null;
              vfax1 = null;
              contents= new CharArrayWriter();
         public void doparse(String url) throws Exception
              SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser sp = spf.newSAXParser();
    ParserAdapter pa = new ParserAdapter(sp.getParser());
    pa.setContentHandler(this);
    pa.parse(url);          
         public void startElement(String namespace,String localName,String qName,Attributes atts)
              ctelement = localName;     
         public void endElement(String uri,String localName,String qName) throws SAXException
         public void characters(char[] ch,int start, int length) throws SAXException
              try
                   if(ctelement.equals("name"))
                        vname = new String (ch,start,length);
                        System.out.println("The method "+vname1);
              }catch (Exception e)
                   System.out.println("The exception "+e);
         public static void main(String args[])
              try
              mysax ms = new mysax();
              ms.doparse(args[0]);
              System.out.println("the contents name "+ms.vname1);
              catch(Exception e)
                   System.out.println("this is exception at main" +e);
    my XML looks like
    <coyprofile_result>
    <company>     
    <name>abcTech</name>
    <rcbreg>123456789</rcbreg>
    <address>Singapore</address>
    <country>sg</country>
    <telephone>123456</telephone>
    <fax>123155</fax>
    </company>
    </coyprofile_result>

    I believe that the problem has to do with the value you assign to ctelement. You are assigning the value of localName to ctElement, however for the element: <name>...</name> the localname is empty string i.e. "", but qName equals "name". Because you are assigning empty string to ctElement, when you do the comparison in characters of ctElement to "name" it will always be false. So in startElement change it to ctElement = qName; Try it and see if it works. I have produced similar programs and it works for me.
    Hope this helps.

  • I upgraded my icloud storage and amount got deducted from my account but yet storage wasn't upgraded. What can i do?

    I upgraded my icloud storage and amount got deducted from my account but yet storage wasn't upgraded. What can i do?

    How long did you wait for the systm to catch up to your request for more storage?  it can take a little while, up to an hour sometimes I have heard.
    If you don't see any more room after waiting a while, try resetting your phone to see if it appears then.
    If that doesn't help go here, http://www.apple.com/support/contact/ and see if they can help you out.

  • HT201272 How do i see a list of the apps that have been downloaded and the dates and times and amounts?  Tried to follow the on-line thing but i want to compare what has been downloaded with my visa bill.  HELP!!

    How do i see a list of the apps that have been downloaded and the dates and times and amounts?  Tried to follow the on-line thing but i want to compare what has been downloaded with my visa bill.  HELP!!

    See this -> http://support.apple.com/kb/HT2727

Maybe you are looking for

  • How can i delete my old iCloud id when my old apple id no longer works?

    I am helping my grandmother set up an apple ipad. i need to fix her iphone because we had changed her id to match with her current email address because the old one doesn't work anymore. What do i need to do to get the old icloud off her phone so tha

  • How to use recovery dvd on new hard drive, install window 7

    hello, i have trouble with my laptop. my hard drive got bad sectors and now i need to replace my hdd to new one. im not sure how to reinstall window 7 on my new hdd. is it possible to install operating system on new hard drive using recovery disk? an

  • Logic on a MacBook Air?

    I'm considering purchasing a MacBook Air, 13 inch i5 with 8gb RAM. I'm just wondering if logic pro will be useable on this machine? Does anyone have any experience with this? My demands arent all that professional.

  • BO Installation Issues

    Hello Team, We have installed BOBJ XI 3.1 on our server. Is it possible to install 2 different BO server instances on the same system ? We have a Window 2003 Server, which had 2 BW Systems already installed on the same system - BID & BIQ. We thought

  • Problems modifying a itab

    Hi all. We are enhacing the tcode vfx3 report adding new fields. At this point we have added 2 fields (netwr and mwsbk) by the use of a user exit. Everything is ok. Now we want to add a new field(mrnkz 'char 1'), the steps we follow are the same as w