Troubleshoot Web Server

With troubleshoot of Web Server, you can free your memory

  1. [JBoss] Error Starting JBoss Server 5 on NetBeans

    a. Problem

    java.lang.IllegalStateException: Incompletely deployed: DEPLOYMENTS IN ERROR: Deployment "AttachmentStore" is in error due to: java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected="" actual=""

    b. Cause

    A bug that occurs with certain specific combinations of JRE and OS versions. Basically, the JBoss config is relying on reflection to return constructors in a certain order, and in some cases this order is different, causing the exception.

    c. Solution

    You need to change the content of conf/bootstrap/profile.xml. Look for the definition of the AttachmentStore, and change the constructor line so that it starts:

    <parameter class="">

    The original version doesn't have the class="" attribute.

  2. [Tomcat] Tomcat Encoding Problems

    a. Problem

    Queryes the database with user input (search/paging by Japanese string using GET method). The problem is that accented characters are being transformed into weird letters like ใƒ†ใ‚นใƒˆ => ãã¹ã.

    b. Cause

    By default, Tomcat uses ISO-8859-1 character encoding when decoding URLs received from a browser. This can cause problems when encoding is UTF-8, and you are using international characters in the names of attachments or pages.

    c. Solution

    Setting the XML file encoding and the meta tags have no effect on HTTP request/response encoding. Only the following should be minimally configured for a JSP/Servlet based web application:

    • For HTTP GET requests, configure it at server level. In Tomcat, that's to be done by setting the URIEncoding attribute of <Connector> in Tomcat's conf/server.xml

      <Connector port="8080" URIEncoding="UTF-8"/>
      <!-- If you are using mod_jk -->
      <Connector port="8009" protocol="AJP/1.3" URIEncoding="UTF-8"/>
    • For HTTP POST requests, use a filter which does a ServletRequest#setCharacterEncoding()
    • For HTTP responses generated by JSPs, set pageEncoding attribute of <%@page%> on a per-JSP basis, or, better, set <page-encoding> entry in web.xml for an application-wide basis
    • For HTTP responses generated by servlets (wherein no JSP is been involved!) use ServletResponse#setCharacterEncoding()
    • Last but not least, make sure that your source code files are also saved as UTF-8. The exact configuration depends on the editor used. In case of Eclipse, you can control it via Window > Properties > General > Workspace > Text File Encoding


Popular posts from this blog

Reduce TIME_WAIT Socket Connections