The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tomcat cannot run JSP

Discussion in 'General Discussion' started by yogi73, Feb 25, 2008.

  1. yogi73

    yogi73 Registered

    Joined:
    Jul 23, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I have installed Tomcat via the easyapache utility in the WHM. The Tomcat got installed okay. Following are the versions:
    apache-tomcat-5.5.25
    jdk1.6.0_02

    I have enabled Servlet support for an Account. JSPs are working fine under the public_html folder. However, the moment I place the SAME JSP inside any folder (in the public_html folder) I get the following error:

    org.apache.jasper.JasperException: /test2.jsp(2,0) The value for the useBean class attribute validation.FieldValidations is invalid.
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
    org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1175)
    org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1117)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
    org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
    org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Generator.generate(Generator.java:3322)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.

    The Test.jsp which I'm tying to run is:
    <%@page language = "java" import="java.io.*,java.util.*,java.sql.*,java.net.InetAddress,javax.servlet.http.Cookie" %>
    <jsp:useBean id = "validate" scope="page" class="validation.FieldValidations" />
    <jsp:useBean id="ConnectionBean" scope="session" class="poolcon.ConnectionPool" />
    <jsp:useBean id="orderidbean" scope="page" class="RngPack.RandomApp" />
    <%
    validate.setValueForAlfaNumeric("DUMMY_123'");
    String s_name=validate.getValueForSchar();

    out.println("AAAAAAA"+s_name);
    %>
    <html>
    Hello test
    </html>

    Now, I know that the Bean is NOT accessible to my JSP within any folder. And yes the package "validation" is present under /account/public_html/WEB-INF/classses. I further confirmed this with the help of the following code:

    <html>
    <head><title>Loading a class</title></head>
    <body>
    <%

    String myClass = "validation.FieldValidations" ;
    try{
    Class.forName( myClass );
    out.println("Class " + myClass + " found on the classpath") ;
    }catch(ClassNotFoundException e) {
    out.println("<font color=\"red\">Class " + myClass + " not found on the classpath</font>") ;
    }
    %>
    </body>
    </html>

    If I run this JSP inside any folder within the public_html it shows that the relevant class is not present in the CLASSPATH. If I run this JSP in public_html of the account, then the Class is found. I'm running the exactly the same versions of Tomcat and JDK on the development machine and everything works fine.

    I shall be really grateful if someone could help me with this. Is this because I have installed Tomcat via easyapache?????
     
  2. majorrepublic

    majorrepublic Registered

    Joined:
    Mar 8, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    The value for the useBean class attribute is invalid

    Even I'm having the same problem for JSPs not in root folder using beans.
     
  3. oscarvs

    oscarvs Registered

    Joined:
    Oct 8, 2003
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    We have the SAME problem since the last apache/tomcat update and everything works fine inside the public_html ONLY; the same file in any other folder generates error when the jsp call a class.

    Please help us.

    Oscar C.
     
  4. yogi73

    yogi73 Registered

    Joined:
    Jul 23, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    EasyApache Tomcat Installation

    I have done some more research. The "easyapache" Tomcat installation is taking the
    /home/user/public_html folder as "webapps" rather than an individual context. As a result for every folder which one tries to create within the public_html folder, a separate WEB-INF folder needs to be put in the folder. In production environment this is simply not acceptable.

    I will try and troubleshoot this and let you know if something can be juggled. I have also realized that Tomcat installation should be done ground up on a lin box. Do not rely on third party installations. Its messy and creates more problems.
     
  5. crickethost

    crickethost Registered

    Joined:
    Mar 16, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I had similar problems, and after googling, I found www.ngasi.com. And their
    NGASI AppServer Manager works wonderfully. Although it is a 3rd party installation, that is not an issue. The fact is they do not alter the Tomcat packages. They use the same packages
    that you would get directly from tomcat.apache.org.

    My 2 cents.
     
  6. yogi73

    yogi73 Registered

    Joined:
    Jul 23, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Tomcat Configuration

    Its not that the cPanel guys have tinkered with Tomcat itself. The Tomcat which the Easy Apache installs is original thing. Be very sure of this. However, it is the way they configure the Tomcat with Apache is the problem.

    This is how they do it (I may be wrong!):
    Under the httpd.conf
    1. Load mod_jk module (mod_jk.so). This is the Tomcat connector.
    2. Include the jk.conf. This is neat as these directives can be put directly into the httpd.conf, but would clutter it!
    3. Create workers.properties file.
    4. Create a separate context tag <context> ...... </context> for every account in the Tomcat's server.xml file.

    All this is standard stuff. Perfectly okay. I really do not know what else they have done to the configuration to warrant such Tomcat behavior! I'm trying to replicate the same our Local Server. Will keep you posted.
     
Loading...

Share This Page