Large WAR file cannot be deployed in Tomcat 7

Thanks maxrohde.com

 

Não consegue subir no tomcat para fazer deploy por causa do limite de tamanho do arquivo? Segue a dica:

The Full Stack Blog

Problem

When uploading a WAR file larger than 50 MB, the Tomcat 7 Manager application reports:

The server encountered an internal error () that prevented it from fulfilling this request.

Exception java.lang.IllegalStateException:

org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException:

the request was rejected because its size (XXX) exceeds the configured maximum (52428800)

Solution

  • Go to the web.xml of the manager application (for instance it could be under /tomcat7/webapps/manager/WEB-INF/web.xml.
  • Increase the max-file-size and max-request-size:

<multipart-config>

<!– 50MB max –>

<max-file-size>52428800</max-file-size>

<max-request-size>52428800</max-request-size>

<file-size-threshold>0</file-size-threshold>

</multipart-config>

 

Resources

Mail List “The request was rejected because its size (102811565) exceeds the configured maximum (52428800)”

Mail List “Can’t upload large war to Tomcat 7, worked in Tomcat 6”

Ver o post original

CodeIgniter – “Scaps” no form_dropdown

Creio que mais pessoas já precisaram ter uma opção de um “form_dropdown()” desabilitada… mas como pode-se ver no código abaixo(retirado de: CodeIgniter/system/helpers/form_helper.php linha 364):

/**
 * Checkbox Field
 *
 * @access  public
 * @param   mixed
 * @param   string
 * @param   bool
 * @param   string
 * @return  string
 */
if ( ! function_exists('form_checkbox'))
{
    function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
    {
        $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);

        if (is_array($data) AND array_key_exists('checked', $data))
        {
            $checked = $data['checked'];

            if ($checked == FALSE)
            {
                unset($data['checked']);
            }
            else
            {
                $data['checked'] = 'checked';
            }
        }

        if ($checked == TRUE)
        {
            $defaults['checked'] = 'checked';
        }
        else
        {
            unset($defaults['checked']);
        }

        return "<input "._parse_form_attributes($data, $defaults).$extra." />";
    }
}

Não foi previsto isto. Então só nos resta fazer na “mão grande” mesmo, algo como:

    echo '<select id="category" name="category">';
    echo '<option selected disabled>Choose a category...</option>';
    foreach ( $categories as $key => $categorie )
    {
        echo '<option value="'.$key.'">'.$categorie.'</option>';
    }
    echo '</select>';

Valeu!

plpgsql para corrigir o “nextId” em bases PostgreSQL (conserta as sequences)

CREATE OR REPLACE FUNCTION "public"."fixsequence"()
 RETURNS "pg_catalog"."int2" AS $BODY$declare v_reg record;
v_sql varchar;
i_count int;
BEGIN
 i_count := 0;

       for v_reg in (
               select t.table_name, c.column_name, t.table_schema, s.sequence_name
               from information_schema.tables t
               inner join information_schema.columns c on
                  c.table_catalog = t.table_catalog and
                  c.table_schema = t.table_schema and
                  c.table_name = t.table_name and
                  c.column_name = 'id'
               inner join information_schema.sequences s on
                  t.table_catalog = s.sequence_catalog and
                  t.table_schema = s.sequence_schema and
                  lower(s.sequence_name) = lower(t.table_name || '_id_seq')
       ) loop
               v_sql := 'SELECT setval(''"'|| v_reg.table_schema || '"."' || v_reg.sequence_name || '"'', (SELECT max("'|| v_reg.column_name ||'")+1 FROM "'||v_reg.table_schema||'"."' || v_reg.table_name || '"))';
               execute v_sql;
               i_count := i_count +1;
       end loop;
       RETURN i_count;
END
$BODY$
 LANGUAGE 'plpgsql' VOLATILE;

Obs.: Note que ali onde tem “c.column_name = ‘id'”, “id” se refere a chave primária de suas tabelas 😉

Retirado de: http://www.danielpk.com.br/blog/2010/04/08/corrigir-as-sequences-do-postgres/comment-page-1/#comment-7822