Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Apr 2006
    Posts
    16

    Default Tomcat jsp issue

    First i wont to say that i am not a tomcat expert and maybe i am doing something wrong. Here is the case :

    I have a class located in
    /home/user/public_html/WEB-INF/classes/testlib/MyString.class

    I have a jsp page located in document root directory (/home/user/public_html/)
    with that content
    <%@ page language="java" import="testlib.*"%>
    <%
    out.print("User1"+MyString.doString("Test String"));
    %>
    and its working like a charm

    I have same file in directory /home/user/public_html/t1/ with the same content.

    but i got that error
    Java FileName:/usr/local/jakarta/apache-tomcat-5.5.25/work/Catalina/domain.com/t1//org/apache/jsp/test2_jsp.java

    An error occurred at line: 3 in the jsp file: /test2.jsp
    MyString cannot be resolved
    1: <%@ page language="java" import="testlib.*"%>
    2: <%
    3: out.print("User1"+MyString.doString("Test String"));
    4: %>
    Looks like if the jsp is located outside of the document root import tag did not work properly.

    Any one with same issue ? or any ideas what can be wrong ?

  2. #2
    Member
    Join Date
    Feb 2007
    Posts
    20

    Default

    Are both JSPs being called in the same context. Provide the URL for each.

    NGASI AppServer Manager
    Private JVM Java Hosting Addon
    http://www.ngasi.com

  3. #3
    Member
    Join Date
    Apr 2006
    Posts
    16

    Default

    The working one is called from http://www.domain-name.tld/test2.jsp
    The not working is called http://www.domain-name.tld/t1/test2.jsp

  4. #4
    Member
    Join Date
    Feb 2007
    Posts
    20

    Default

    OK. So the domains in the URL are the same.
    Is there a WEB-INF directory under ./t1

    NGASI AppServer Manager
    Private JVM Java Hosting Addon
    http://www.ngasi.com

  5. #5
    Member
    Join Date
    Apr 2006
    Posts
    16

    Default

    No i have web inf only under main document root
    /home/user/public_html/WEB-INF/
    should i have WEB-INF in t1 subdirectory ?
    if i should should y make a copy of all my classes inside /home/user/public_html/WEB-INF/ to
    /home/user/public_html/t1/WEB-INF/

    Because i dont know how tomcat works internally maybe i ask very stupid questions...

    I really appreciate your help appservermgr

  6. #6
    Member
    Join Date
    Feb 2007
    Posts
    20

    Default

    Hi Menta2k,

    Do not add a WEB-INF under t1. There should only be 1 WEB-INF per application
    context.

    Try restarting Tomcat and see if the error goes away.

    NGASI AppServer Manager
    Private JVM Java Hosting Addon
    http://www.ngasi.com

  7. #7
    Member
    Join Date
    Apr 2006
    Posts
    16

    Default

    Unfortunately restart of the tomcat server did not help.
    here is exact urls and what i mean.
    Java class
    http://server-lab.net/WEB-INF/classe...elloWorld.java
    (http://server-lab.net/WEB-INF/classe...lloWorld.class)

    Working URL:
    http://server-lab.net/test.jsp

    Error:
    http://server-lab.net/t1/test.jsp

    Is it possible to be a bug in tomcat version ?

  8. #8
    Member
    Join Date
    Feb 2007
    Posts
    20

    Default

    Quote Originally Posted by Menta2K View Post
    Is it possible to be a bug in tomcat version ?
    Quite possible as most 3rd party packages of Tomcat are susceptible to
    problems. I personally recommend using unaltered Tomcat versions directly from the Apache site.
    I presume the Tomcat installation is from cPanel?
    That said did you add any thing to the CLASSPATH or made any changes?
    Also is there a Context in the server.xml with the name "t1".

    Try testing the jsp under a different name (e.g. test2.jsp) under t1 and see what happens.

    NGASI AppServer Manager
    Private JVM Java Hosting Addon
    http://www.ngasi.com

  9. #9
    Member
    Join Date
    Jun 2003
    Location
    Bharat
    Posts
    230

    Default

    It seems there is a bug somewhere or may be some misconfiguration, this is what I am getting:

    HTTP Status 500 -

    type Exception report

    message

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

    exception

    org.apache.jasper.JasperException: Unable to compile class for JSP:
    JSP FileName:/Menus/AdminMenu.jsp
    Java FileName:/usr/local/jakarta/apache-tomcat-5.5.25/work/Catalina/sakariya.com/JSP//org/apache/jsp/Menus/AdminMenu_jsp.java

    An error occurred at line: 4 in the jsp file: /Menus/AdminMenu.jsp
    User cannot be resolved to a type
    1: <%@page contentType="text/html"%>
    2: <%@page import = 'Beans.*' %>
    3: <%
    4: User user = (User)session.getAttribute("user");
    5: if(user == null || !user.getCurrentUserTypeRef().equals("administrator"))
    6: {
    7: session.setAttribute("message", "Administrator Login failed. Please Login."); %>

    JSP FileName:/Menus/AdminMenu.jsp
    Java FileName:/usr/local/jakarta/apache-tomcat-5.5.25/work/Catalina/sakariya.com/JSP//org/apache/jsp/Menus/AdminMenu_jsp.java

    An error occurred at line: 4 in the jsp file: /Menus/AdminMenu.jsp
    User cannot be resolved to a type
    1: <%@page contentType="text/html"%>
    2: <%@page import = 'Beans.*' %>
    3: <%
    4: User user = (User)session.getAttribute("user");
    5: if(user == null || !user.getCurrentUserTypeRef().equals("administrator"))
    6: {
    7: session.setAttribute("message", "Administrator Login failed. Please Login."); %>


    Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:98)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
    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.
    Apache Tomcat/5.5.25
    whereas the index.jsp is working fine at http://www.sakariya.com

    The developer says, it is not compiling JSP pages.

    Any idea where it is going wrong?
    Vinayak Sharma
    Vinsar.Net - Quality WebHosting Services at Economical Price USA & UK Servers
    Book Your Domain with Confidence Reliable Domain Reseller Account

Similar Threads & Tags
Similar threads

  1. jsp/tomcat problem
    By linuxgirl in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 11-18-2007, 12:20 PM
  2. Tomcat/JSP Suppport security issue
    By glottis in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-30-2007, 11:14 PM
  3. About JSP (Tomcat)
    By Domenico in forum cPanel and WHM Discussions
    Replies: 17
    Last Post: 08-07-2004, 11:24 PM
  4. Tomcat JSP
    By casey in forum cPanel and WHM Discussions
    Replies: 18
    Last Post: 04-14-2003, 04:57 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube