Servlet/JSP with Tomcat
Where is the best place on the Web to learn Servlet/JSP with Tomcat for beginners?
i also just started learning servlets a few days ago.
here are some of the websites i've found
there are some tutorials as well as general tips and stuff.
http://java.sun.com/docs/books/tutorial/servlets/index.html
http://www.javaworld.com/javaworld/javatips/jw-javatip94.html
http://www.cetus-links.org/oo_javaserver_pages.html
http://www-105.ibm.com/developerworks/education.nsf/dw/java-onlinecourse-bynewest?OpenDocument&Count=500&loc=j
http://www.fawcette.com/javapro/2002_03/online/online_eprods/servlets_03_08/
http://developer.java.sun.com/developer/onlineTraining/Servlets/Fundamentals/index.html
http://developer.java.sun.com/developer/onlineTraining/JSPIntro/
http://www.novocode.com/doc/servlet-essentials/
http://hotwired.lycos.com/webmonkey/99/07/index3a.html?tw=programming
http://www.jguru.com/faq/Servlets
http://www.jguru.com/faq/JSP
i haven't looked into all of these yet, but i'm sure they will help you.
Similar Messages
-
HTTP 500 server error as follows:
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred at line: 2 in the jsp file: /listStore.jsp
*line#2 is the usebean statement in the jsp...
NOTE: new machine, new configuration... this same servelt/jsp/bean work great on another machine with tomcat 3...
so this will have something to do with tomcat configuation... believe that the configuration is set to not compile with deprecation.. would like to know where to change that...I guess the problem comes from jdk 1.4 ...deprecation of sun.tools.javac.Main prevents compilation in jasper...
-
I've been going through this painful process
to deploy a simple JSP application on a
Red Hat Linux 6.1 system with the latest
Tomcat release. I got the Tomcat server
running and all their sample JSP apps work.
This system also contains the database,
so I'm running it as local.
I created a simple JSP application using
just one table from the database. It
works just fine from the JDeveloper
environment. When I try to access the
main.jsp file via the URL http://odb/ojsp/main.jsp, I get this:
Error: 500
Location: /ojsp/main.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSP/usr/local/jakarta-tomcat/work/localhost_8080/_0002fojsp_0002fmain_0002ejspmain_jsp_0.java:17: Package javax.naming not found in import.
import javax.naming.*;
^
1 error
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:475)
I would assume it's a classpath issue, but
which one do I need to add?
nullI got the exactly same message by using JDeveloper3.1.1.2, NT, and Tomcat 3.1. I have posted the issue several time and not got any response yet.
Thanks.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by abbaroo:
Well, I figured out that I need the JNDI
package to go along with JDK 1.2.2.
So I downloaded and installed that, and
now I get this message:
Error: 500
Location: /ojsp/ConstantJSP_html/main.jsp
Internal Servlet Error:
java.lang.IllegalStateException: Response has already been committed
at org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletResponseFacade.java:157)
at org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:475)
<HR></BLOCKQUOTE>
null -
Running .jsp with TOMCAT 5.5.9
I am new to Tomcat and Java, I was task to make this application run on Tomcat, it currently works fine on Webshpere.
org.apache.jasper.JasperException: /header.jsp(90,0) The value for the useBean class attribute training.rules.TrainingSession is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2237)
org.apache.jasper.compiler.Node$IncludeDirective.accept(Node.java:597)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
MY JAVA FILE:
package training.rules;
import training.Training; // Database utilities
import java.io.*; // File utilities
import java.sql.*; // More database utilities
import java.util.*; // Data structure classes
import java.util.Date;
import tools.pages.AbstractPage;
import tools.persistence.*; // Database utilities
import tools.persistence.LibraryFactory; // Database library manager
import tools.persistence.LibraryManager; // Application library manager
import tools.rules.*; // Business rules utilities
import tools.utilities.*; // Misc. utility classes
import tools.utilities.Log; // Log file for application
import tools.utilities.EmailException;
import tools.utilities.EmailLookup;
import tools.utilities.print.*; // Print utility classes
* Provides the utilities necessary to create and maintain a
Training DB user session.
* @author Mary S. Powers ([email protected])
* @version 1.000 2003.02.26 Initial
public class TrainingSession extends Session {
The list of valid agency codes.
public static MultiValue agencyCodes = null;
The code for a page not requiring a log-in at all.
public static final String AGENCY_NONE = "4";
The code for the agency of OTH.
public static final String AGENCY_OTHER = "2";
The code for the agency of PDG.
public static final String AGENCY_PDG = "1";
The code for the agency of Supervisor.
public static final String AGENCY_SUPERVISOR = "3";
List of archived Employees in the database.
public static MultiValue archivedEmployees = null;
The list of email addresses for the contacts for the application.
public static MultiValue contactEmailAddresses = null;
The list of contact names for the application.
public static MultiValue contactNames = null;
The list of valid course type IDs.
public static MultiValue courseTypeIds = null;
The list of valid course types.
public static MultiValue courseTypeNames = null;
The list of manager delegates.
public static KeyedList delegates = null;
List of Employees in the database.
public static MultiValue employees = null;
The list of options on the course evaluation form.
public static MultiValue evaluationCodes = null;
The list of IDs for the options on the course evaluation form.
public static MultiValue evaluationCodeIds = null;
The list of job title IDs.
public static MultiValue jobTitleIds = null;
The list of valid job titles.
public static MultiValue jobTitleNames = null;
The list of course location IDs.
public static MultiValue locationIds = null;
The list of valid course location names.
public static MultiValue locationNames = null;
The list of valid training proficiency codes.
public static MultiValue proficiencyCodes = null;
The list of training proficiency IDs.
public static MultiValue proficiencyIds = null;
The list of course provider IDs.
public static MultiValue providerIds = null;
The list of valid course providers ordered by provider name.
public static MultiValue providerNames = new MultiValue();
The list of valid training request status codes.
public static MultiValue requestStatusCodes = new MultiValue();
The list of keys for the training request status codes.
public static MultiValue requestStatusCodeIds = new MultiValue();
The list of abbreviations for the states.
public static MultiValue stateAbbrs = null;
The list of IDs for the state codes.
public static MultiValue stateIds = null;
The list of valid states.
public static MultiValue stateNames = null;
The list of course subject area IDs.
public static MultiValue subjectAreaIds = null;
The list of course subject areas.
public static MultiValue subjectAreaNames = null;
The list of training level codes.
public static MultiValue trainingLevelCodes = null;
The list of training level IDs.
public static MultiValue trainingLevelIds = null;
The list of valid training method codes.
public static MultiValue trainingMethodCodes = null;
The list of training method IDs.
public static MultiValue trainingMethodIds = null;
Create a connection to the specified database as the specified user
with the specified password.
* @exception IOException if JDBC cannot connect.
public TrainingSession() throws IOException {
super(SessionManager.getApplication("TrainingDB"));
init("TrainingDB");
setLockedTables(new MultiValue());
logFile = Training.getLog();
} /* end of constructor */
This method retrieves the access level given the command the
user is attempting to execute.
* @param command the command the user wishes to execute
* @return the access level
public String getAccess(String command) {
String access = "";
if (command == null)
return(access);
try {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validAccessLevels = ((KeyedList )validityTables.get("Access"));
if (!validAccessLevels.isValid()) {
getValidAccessLevels();
validityTables = SessionManager.get(getApplication()).getValidityTables();
validAccessLevels = ((KeyedList )validityTables.get("Access"));
} // end of if
Enumeration keys = validAccessLevels.keys();
while (keys.hasMoreElements()) {
String oneKey = ((String )keys.nextElement());
if (oneKey.trim().equalsIgnoreCase(command.trim()))
return(((String )((MultiValue )validAccessLevels.get(oneKey)).elementAt(0)));
} // end of while loop
catch (Exception e) {}
return(access);
} // end of method 'getAccess'
This method returns the agency the current user is logged in
under. OTH is the default.
* @return the agency the current user is logged in under
public String getAgency() {
return(this.getAgencyCode(agencyKey));
} // end of method 'getAgency'
This method retrieves the agency, given the agency key.
* @param agencyId the agency key
* @return the name of the agency
public String getAgencyCode(String agencyId) {
String agency = "";
if (agencyId == null)
return(agency);
try {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validAgencies = ((KeyedList )validityTables.get("Valid_Agency"));
if (!validAgencies.isValid()) {
getValidAgencies();
validityTables = SessionManager.get(getApplication()).getValidityTables();
validAgencies = ((KeyedList )validityTables.get("Valid_Agency"));
} // end of if
Enumeration keys = validAgencies.keys();
while (keys.hasMoreElements()) {
String oneKey = ((String )keys.nextElement());
if (oneKey.trim().equals(agencyId))
return(((String )((MultiValue )validAgencies.get(oneKey)).elementAt(0)));
} // end of while loop
catch (Exception e) {}
return(agency);
} // end of method 'getAgencyCode'
This method retrieves the list of valid agency codes.
* @return the list of valid agency codes
public MultiValue getAgencyCodes() {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validAgencies = ((KeyedList )validityTables.get("Valid_Agency"));
if (!validAgencies.isValid()) {
try {
getValidAgencies();
catch (IOException e) {} // We did the best we could to repopulate the cache.
} // end of if
return(agencyCodes);
} // end of method 'getAgencyCodes'
This method retrieves the agency key, given the name of the
agency.
* @param agency the name of the agency code
* @return the agency key
public String getAgencyId(String agency) {
String agencyId = "";
if (agency == null)
return(agencyId);
try {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validAgencies = ((KeyedList )validityTables.get("Valid_Agency"));
if (!validAgencies.isValid()) {
getValidAgencies();
validityTables = SessionManager.get(getApplication()).getValidityTables();
validAgencies = ((KeyedList )validityTables.get("Valid_Agency"));
} // end of if statement
Enumeration keys = validAgencies.keys();
while (keys.hasMoreElements()) {
String oneKey = ((String )keys.nextElement());
MultiValue agencies = ((MultiValue )validAgencies.get(oneKey));
for (int i=0; i<agencies.size(); i++) {
String oneAgency = ((String )agencies.elementAt(i));
if (agency.trim().equalsIgnoreCase(oneAgency.trim()))
return(oneKey);
} // end of for loop
} // end of while loop
catch (Exception e) {}
return(agencyId);
} // end of method 'getLocationId'
This method retrieves the list of archived employees.
* @return reference to the list of archived employees
public MultiValue getArchivedEmployees() {
return(archivedEmployees);
} // end of method 'getArchivedEmployees'
This method retrieves the list of email addresses for the contacts
for the application.
* @return the list of email addresses
public MultiValue getContactEmailAddresses() {
return(contactEmailAddresses);
} // end of method 'getContactEmailAddresses'
This method retrieves the list of contact names for the
application.
* @return the list of contact names
public MultiValue getContactNames() {
return(contactNames);
} // end of method 'getContactNames'
This method retrieves the reference to a Course object, given the
key for the course.
* @param courseId the key for the course
* @return reference to the Course object
public ICourse getCourse(String courseId) {
ICourse theCourse = null;
if (courseId == null)
return(theCourse);
try {
ICourse courseTemplate = this.getNewCourseInstance();
((Course )courseTemplate).getKey().setValue(courseId.trim());
IIterator results = this.query(courseTemplate);
theCourse = ((ICourse )results.next());
catch (Exception e) {}
return(theCourse);
} // end of method 'getCourse'
This method retrieves the reference to a CourseInstance object, given the
key for the course.
* @param courseId the key for the course instance
* @return reference to the CourseInstance object
public ICourseInstance getCourseInstance(String courseId) {
ICourseInstance theCourseInstance = null;
if (courseId == null)
return(theCourseInstance);
try {
ICourseInstance courseInstanceTemplate = this.getNewClassInstance();
((CourseInstance )courseInstanceTemplate).getKey().setValue(courseId.trim());
IIterator results = this.query(courseInstanceTemplate);
theCourseInstance = ((ICourseInstance )results.next());
catch (Exception e) {}
return(theCourseInstance);
} // end of method 'getCourseInstance'
This method retrieves the course type, given the course type key
* @param courseTypeId the course type key
* @return the name of the course type
public String getCourseType(String courseTypeId) {
String courseType = "";
if (courseTypeId == null)
return(courseType);
try {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validCourseTypes = ((KeyedList )validityTables.get("Course_Types"));
if (!validCourseTypes.isValid()) {
getValidCourseTypes();
validityTables = SessionManager.get(getApplication()).getValidityTables();
validCourseTypes = ((KeyedList )validityTables.get("Course_Types"));
} // end of if statement
Enumeration keys = validCourseTypes.keys();
while (keys.hasMoreElements()) {
String oneKey = ((String )keys.nextElement());
if (oneKey.trim().equalsIgnoreCase(courseTypeId))
return(((String )((MultiValue )validCourseTypes.get(oneKey)).elementAt(0)));
catch (Exception e) {}
return(courseType);
} // end of method 'getCourseType'
This method retrieves the list of valid course type IDs.
* @return the list of course type IDs
public MultiValue getCourseTypeIds() {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validCourseTypes = ((KeyedList )validityTables.get("Course_Types"));
if (!validCourseTypes.isValid()) {
try {
getValidCourseTypes();
catch (IOException e) {} // We did the best we could to repopulate the cache.
} // end of if
return(courseTypeIds);
} // end of method 'getCourseTypeIds'
This method retrieves the list of valid course types.
* @return the list of course type names
public MultiValue getCourseTypes() {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validCourseTypes = ((KeyedList )validityTables.get("Course_Types"));
if (!validCourseTypes.isValid()) {
try {
getValidCourseTypes();
catch (IOException e) {} // We did the best we could to repopulate the cache.
} // end of if
return(courseTypeNames);
} // end of method 'getCourseTypes'
This method returns a list of IDs for the delegates (if any) of the
person logged in, if he/she is a section manager.
* @return the list of employee IDs of the delegates
public MultiValue getDelegates() {
MultiValue theDelegates = new MultiValue();
if (this.isSectionManager()) {
IEmployee employeeRecord = this.getEmployeeRecord();
String employeeId = ((String )((AbstractDataObject )((Employee )employeeRecord).getKey()).get()).trim();
KeyedList delegateTable = this.delegates;
Enumeration keys = delegateTable.keys();
while (keys.hasMoreElements()) {
String oneKey = ((String )keys.nextElement()).trim();
if (oneKey.equals(employeeId)) {
theDelegates = ((MultiValue )delegateTable.get(oneKey));
break;
} // end of if statement
} // end of while loop
} // end of outer if statement
return (theDelegates);
} // end of method 'getDelegates'
This method retrieves the name of the domain used to validate
logins.
* @return the name of the domain
public String getDomain() {
return(domain);
} // end of method 'getDomain'
This method retrieves the Employee record, given the employee ID.
* @param employeeId the employee ID
* @return the employee record;
'null', if no such employee ID
public IEmployee getEmployee(String employeeId) {
IEmployee employee = null;
for (int i=0; i<employees.size(); i++) {
IEmployee oneEmployee = ((IEmployee )employees.elementAt(i));
String oneEmployeeId = ((String )((AbstractDataObject )((Employee )oneEmployee).getKey()).get());
if (oneEmployeeId.trim().equalsIgnoreCase(employeeId.trim())) {
employee = oneEmployee;
break;
} // end of if
} // end of for loop
// If the employee is not found, then search the list of archived
// employees.
if (employee == null) {
for (int i=0; i<archivedEmployees.size(); i++) {
IEmployee oneEmployee = ((IEmployee )archivedEmployees.elementAt(i));
String oneEmployeeId = ((String )((AbstractDataObject )((Employee )oneEmployee).getKey()).get());
if (oneEmployeeId.trim().equalsIgnoreCase(employeeId.trim())) {
employee = oneEmployee;
break;
} // end of if
} // end of for loop
} // end of outer if statement
return(employee);
} // end of method 'getEmployee'
This method retrieves an employee name (last name, comma, first name),
given the employee's user ID.
* @param userId the employee's user ID
* @return the employee's name;
'null', if no such employee
public String getEmployeeName(String userId) {
String employeeName = null;
for (int i=0; i<employees.size(); i++) {
IEmployee oneEmployee = ((IEmployee )employees.elementAt(i));
String oneUserId = ((String )((AbstractDataObject )((Employee )oneEmployee).getUserName()).get());
String middleName = ((String )((AbstractDataObject )oneEmployee.getMiddleInitial()).get());
if (middleName == null)
middleName = "";
if (oneUserId.trim().equalsIgnoreCase(userId.trim())) {
employeeName = ((String )((AbstractDataObject )oneEmployee.getLastName()).get()) + ", " +
((String )((AbstractDataObject )oneEmployee.getFirstName()).get()) + " " +
middleName;
break;
} // end of if
} // end of for loop
return(employeeName);
} // end of method 'getEmployeeName'
This method retrieves the employee record of the current user.
* @return reference to the employee record;
'null', if no employee record exists for the user
public IEmployee getEmployeeRecord() {
try {
MultiValue theEmployees = getEmployees();
for (int i=0; i<theEmployees.size(); i++) {
IEmployee oneEmployee = ((IEmployee )theEmployees.elementAt(i));
String userName = ((String )((AbstractDataObject )oneEmployee.getUserName()).get());
if (userName.equalsIgnoreCase(getUserId())) {
employeeRecord = oneEmployee;
break;
} // end of if
} // end of for loop
catch (IOException e) {}
return(employeeRecord);
} // end of method 'getEmployeeRecord'
This method retrieves the list of Employees.
* @exception IOException thrown if there was an occur attempting
to retrieve the Employee list
public synchronized MultiValue getEmployees() throws IOException {
if (isNew) {
IEmployee employeeTemplate = getNewEmployeeInstance();
employeeTemplate.setEmployeeStatus("ACTIVE");
employeeTemplate.getLastName().setOrder(0);
employees = this.query(employeeTemplate).getAll();
// Now, get the listing of archived employees.
employeeTemplate.setEmployeeStatus("TERMINATED");
archivedEmployees = this.query(employeeTemplate).getAll();
isNew = false;
} // end of if
return(employees);
} // end of method 'getEmployees'
This method retrieves the evaluation option, given the evaluation option key.
* @param evaluationCodeId the evaluation option key
* @return the name of the course evaluation option
public String getEvaluationCode(String evaluationCodeId) {
String evaluationCode = "";
if (evaluationCodeId == null)
return(evaluationCode);
try {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validEvaluationCodes = ((KeyedList )validityTables.get("Valid_Evaluation_Options"));
if (!validEvaluationCodes.isValid()) {
getValidEvaluationOptions();
validityTables = SessionManager.get(getApplication()).getValidityTables();
validEvaluationCodes = ((KeyedList )validityTables.get("Valid_Evaluation_Options"));
} // end of if statement
Enumeration keys = validEvaluationCodes.keys();
while (keys.hasMoreElements()) {
String oneKey = ((String )keys.nextElement());
if (oneKey.trim().equalsIgnoreCase(evaluationCodeId))
return(((String )((MultiValue )validEvaluationCodes.get(oneKey)).elementAt(0)));
catch (Exception e) {}
return(evaluationCode);
} // end of method 'getEvaluationCode'
This method retrieves the list of valid course evaluation option IDs.
* @return the list of course evaluation form option IDs
public MultiValue getEvaluationCodeIds() {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validEvaluationOptions = ((KeyedList )validityTables.get("Valid_Evaluation_Options"));
if (!validEvaluationOptions.isValid()) {
try {
getValidEvaluationOptions();
catch (IOException e) {} // We did the best we could to repopulate the cache.
} // end of if
return(evaluationCodeIds);
} // end of method 'getEvaluationCodeIds'
This method retrieves the list of valid course evaluation codes.
* @return the list of course evaluation codes
public MultiValue getEvaluationCodes() {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validEvaluationOptions = ((KeyedList )validityTables.get("Valid_Evaluation_Options"));
if (!validEvaluationOptions.isValid()) {
try {
getValidEvaluationOptions();
catch (IOException e) {} // We did the best we could to repopulate the cache.
} // end of if
return(evaluationCodes);
} // end of method 'getEvaluationCodes'
This method retrieves the highest access that the current user has.
* @return the highest access that the current user has.
public String getHighestAccess() {
String highestAccess = AGENCY_OTHER;
if (isPDG())
highestAccess = AGENCY_PDG;
else if (isSupervisor())
highestAccess = AGENCY_SUPERVISOR;
String highestAgency = "";
highestAgency = this.getAgencyCode(highestAccess);
setAgency(highestAgency);
return(highestAgency);
} // end of method 'getHighestAccess'
This method returns the section manager highest up in the chain
that the current user is a delegate for.
* @return reference to the section manager highest up in the
chain that the current user is a delegate for;
'null', if the current user is a delegate for no one
public IEmployee getHighestDelegate() {
if (highestDelegate != null)
return(highestDelegate);
String employeeId = ((String )((AbstractDataObject )((Employee )this.employeeRecord).getKey()).get());
try {
String sql = "select Manager_Emp_Id from Delegates where Delegate_Emp_Id=" +
employeeId;
MultiValue results = this.textQuery(sql);
String employeeDB = ((String )((Session )this).getApplication().getProperty("EMPLOYEE_DB")).trim();
String highestDelegateId = "";
int maxEmployeeList = -1;
for (int i=0; i<results.size(); i++) {
Vector oneRow = ((Vector )results.elementAt(i));
String oneManagerId = oneRow.elementAt(0).toString();
sql = "exec " + employeeDB + ".dbo.usp_chain_down " + oneManagerId;
MultiValue queryResults = this.textQuery(sql);
if (queryResults.size() > maxEmployeeList) {
maxEmployeeList = queryResults.size();
highestDelegateId = oneManagerId;
} // end of if statement
} // end of for loop
highestDelegate = this.getEmployee(highestDelegateId);
catch (Exception e) {}
return(highestDelegate);
} // end of method 'getHighestDelegate'
This method retrieves the job title, given the job title key
* @param jobTitleId the job title key
* @return the name of the job title
public String getJobTitle(String jobTitleId) {
String jobTitle = "";
if (jobTitleId == null)
return(jobTitle);
try {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedList validJobTitles = ((KeyedList )validityTables.get("Job_Table"));
if (!validJobTitles.isValid()) {
getValidJobTitles();
validityTables = SessionManager.get(getApplication()).getValidityTables();
validJobTitles = ((KeyedList )validityTables.get("Job_Table"));
} // end of if statement
Enumeration keys = validJobTitles.keys();
while (keys.hasMoreElements()) {
String oneKey = ((String )keys.nextElement());
if (oneKey.trim().equalsIgnoreCase(jobTitleId))
return(((String )((MultiValue )validJobTitles.get(oneKey)).elementAt(0)));
catch (Exception e) {}
return(jobTitle);
} // end of method 'getJobTitle'
This method retrieves the list of job title IDs.
* @return the list of job title IDs
public MultiValue getJobTitleIds() {
Hashtable validityTables = SessionManager.get(getApplication()).getValidityTables();
KeyedLisThanks that help a bunch. I also the code was a bit much.
I am currenty getting the error:
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
Only a type can be imported. training.Training resolves to a package
An error occurred at line: 112 in the jsp file: /header.jsp
Generated servlet error:
The method getLog() is undefined for the type Training
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Thanks, -
How to use Classes stored in "Classes" folder in JSP with tomcat ?
Hello friends
im using tomcat as server and MySQL as a Backend. now i am using the date calculation in Diff.class files which i have stored in catalina_home/webapps/prj_dev/Prj_files/classes/diff/DIff.class.
now i am getting error that :
Generated servlet error:
Only a type can be imported. diff.Diff resolves to a package
wht i have to do ?I don't include the "classes" word in my import anymore.. Waa.. I'm going nuts.. T.T
Now, I'm trying to use the class through useBean..
this is how my application looks like:
/webapps
-----/hangman-jsp
------------index.jsp
------------/WEB-INF
-------------------web.xml
-------------------MysteryPhrase.java
-------------------/classes
---------------------------/beans
----------------------------------MysteryPhrase.class
-----------/images
-------------------hangman.gif
This is what is in my MysteryPhrase:
package beans;
import java.lang.String;
import java.lang.StringBuffer;
public class MysteryPhrase {
private String answer;
private StringBuffer mysteryPhrase;
private int guesses;
private char[] alphabet;
public MysteryPhrase () {
this.alphabet = new char[26];
public void setMysteryPhrase (String mysteryPhrase) {
this.answer = mysteryPhrase;
this.mysteryPhrase = new StringBuffer(mysteryPhrase.length());
for (int i = 0; i < mysteryPhrase.length(); i++) {
this.mysteryPhrase.setCharAt(i, '_');
public void setGuess (char guess) {
for (int i = 0; i < answer.length(); i++) {
if (answer.charAt(i) == guess) {
mysteryPhrase.setCharAt(i, guess);
guesses++;
public String getMysteryPhrase () {
return mysteryPhrase.toString();
public String getAnswer () {
return answer;
public int getGuesses () {
return guesses;
This is what is in my index.jsp (It is not yet finished..I just started..)
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="phrase" class="beans.MysteryPhrase"/>
<jsp:setProperty name="phrase" property="MysteryPhrase" value="Hello!"/>
<html>
<head>
<title>JSP/JSTL Implementation of Hangman</title>
<style type="text/css">
div {
color: white;
background-color: gray;
position: absolute;
border-style: solid;
border-width: thin;
width: 20%;
height: 30%;
text-align: center;
#guessBoard {
top: 28%;
left: 42%
#mysteryPhraseBoard {
top: 50%;
left: 25%;
z-index: 2;
#statisticsBoard {
top: 57%;
left: 58%;
z-index: 2;
#categoryBoard {
top: 23%;
left: 10%
#hangman {
top: 7%;
left: 70%;
#char {
width: 20px;
body {
background-color: black;
</style>
</head>
<body>
<div id="categoryBoard">
<form method="post">
Please choose a category:
<select name="category">
<option>Category 1</option>
<option>Category 2</option>
<option>Category 3</option>
<option>Category 4</option>
<option>Category 5</option>
<option>Category 6</option>
<option>Category 7</option>
<option>Category 8</option>
</select>
<input type="submit" value="Change"/>
</form>
</div>
<div id="mysteryPhraseBoard">
The mystery phrase is
</div>
<div id="guessBoard">
<form method="post">
Enter a letter: <input id="char" type="text" name="letter"/>
or
Enter a word: <input type="text" name="word"/>
<input type="submit" value="Guess"/>
</form>
</div>
<div id="statisticsBoard">
Guesses: 0
Remaining Letters: 8
</div>
<div id="hangman">
<img src="images/hangman.gif"/>
</div>
</body>
</html> -
Error 500 when I'm running JSP with tomcat on Linux
I'm using Tomcat on linux and when I'm running any JSP file I got this Error:
Error: 500
Location: /examples/jsp/snp/snoop.jsp
Internal Servlet Error:
javax.servlet.ServletException: sun/tools/javac/Main
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:508)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.NoClassDefFoundError: sun/tools/javac/Main
at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:136)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:258)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
What I'm doing wrong?
thank you for help, SnirI've got the same problem but on a Win98 platform also in Solaris OS
By copying the file JAVA_HOME/lib/tools.jar to the following path :
JAVA_HOME/jre/lib/ext/
another alternative is to set your classpath so that it point to the .jar files in your environnement variaoble
ex under Win98:
include this line in your autoexec.bat file
SET CLASSPATH=.;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\lib\dt.jar
under Linux:
edit your .source that include environnment variables and add :"anOldPath:/jdk1.3/lib/tools.jar"
run the source in your terminal window then you can run ./startup under solaris or startup.sh
JAVA_HOME : c:\jdk1.3 or c:\jdk1.2.2 under win98
/home/user/auser/jdk1.2.2/ on linux
I hope that you encounter this problem.
Hichem Hassainia. -
I wanted to test my JSPs calling Oracle in Tomcat before moving
them over to our 9iAS webserver. I put the ojsp.jar and
ojsputil.jar in the tomcat\binary\lib\ directory. Where do I
put the JSPs? I am not sure but don't I need to add something to
the server.xml file?
Thanks,
Tom HenricksenHi
I never installed OUS on Tomcat...
Anyway as shown in the error message you have a problem with the configuration of the connection pool. Perhaps the JNDI name is wrong.
Chris -
Strange thing with tomcat+jsp+javabean
I use javabean in jsp with tomcat container.if I put the javabean file in a package,then it works well.But if I don't, I means,there are no package clause in my javabean file.then it complaint that org.apache.jsp. error:class not found.
It is very strange.Of course place the class file I put is right.Do anyone encounter the same problem.I use tomcat4.0.4Did you import the classfile? Even if it is not there in a package, you need to import it.
For example, if you have a Test.java (Test.class) in your web-inf\\classes with out any package statement, then you need to code this in your jsp,
<%@ page import="Test" %> (I don't exactly remember whether you need to import 'Test' or 'Test.class'). Just give a try.
Sudha -
This happened when i ran the project jsp with tomcat 5.0, the eclipse startup the tomcat but when is going to run the jsp show me this.... what is happing?
StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:496)
at org.apache.catalina.startup.Catalina.await(Catalina.java:619)
at org.apache.catalina.startup.Catalina.start(Catalina.java:579)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)it would appear this person had a similar problem. maybe related?
http://www.junlu.com/msg/42820.html
good luck -
Problem with JNDI and JSP in Tomcat
Hi,
Basically, what I've done is to use the Tomcat administration web
application to create the DataSource, which looks like it populated the
server.xml (see below). I then try to access the testconn.jsp, and am
getting that "Name java:comp is not bound in this Context" error.
I was wondering if anyone could tell me what I'm doing wrong?
Thanks,
Feri
My Configuration:
- Tomcat 5.0.19
- MySQL 4.0.18-nt
- mysql-connector-java-3.0.15-ga-bin.jar
server.xml:
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
<!--Feri test JNDI-->
<Context crossContext="true" debug="5" docBase="injury" path="/injury" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_injury_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/injury" auth="Container"
type="javax.sql.DataSource">
</Resource>
<ResourceParams name="jdbc/injury">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>root</value>
</parameter>
<parameter>
<name>password</name>
<value>root</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/injury</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
</ResourceParams>
</Context>
<!--Feri test JNDI end-->
</GlobalNamingResources>
\webapps\injury\WEB-INF\web.xml:
<resource-ref>
<description>Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file.</description>
<res-ref-name>jdbc/injury</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
\webapps\injury\testconn.jsp
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ taglib prefix="ct" uri="/injury" %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<h1>Connection test</h1>
<ct:connection name="jdbc/injury">
<%
Statement stmt= conn.createStatement();
ResultSet rs;
rs = stmt.executeQuery("select * from user");
while (rs.next()){
%><%=rs.getString(1)%><%=rs.getInt(2) %><br><%
rs.close();
stmt.close();
%>
</ct:connection>
ConnectionTag.java
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.naming.*;
import javax.sql.*;
import javax.sql.DataSource;
public class ConnectionTag extends TagSupport implements TryCatchFinally {
private Connection conn;
// JNDI name of the connection
private String name;
public void setName(String name)
this.name = name;
public int doStartTag()
throws JspException
try {
Context env = (Context) new InitialContext().lookup("java:comp/env");
DataSource ds = (DataSource) env.lookup(name);
if (ds != null)
conn = ds.getConnection();
} catch (Exception e) {
throw new JspException(e);
if (conn == null)
throw new JspException("can't open connection " + name);
pageContext.setAttribute("conn", conn);
return EVAL_BODY_INCLUDE;
public void doCatch(Throwable t)
throws Throwable
throw t;
public void doFinally()
try {
Connection conn = this.conn;
this.conn = null;
pageContext.removeAttribute("conn");
conn.close();
} catch (Exception e) {
Tomcat 5.0\conf\Catalina\localhost\injury.xml
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="Injury" docBase="E:\Tomcat 5.0\webapps\injury" path="/injury" className="org.apache.catalina.core.StandardContext"
cachingAllowed="true" charsetMapperClass="org.apache.catalina .util.CharsetMapper" cookies="true" crossContext="false" debug="0"
mapperClass="org.apache.catalina.core.StandardContextMapper" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper" >
<Resource auth="Container" description="Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file." name="jdbc/injury" type="javax.sql.DataSource"/>
<ResourceLink global="jdbc/injury" name="injury" type="javax.sql.DataSource"/>
</Context>Hi,
First of all, you can find alot of information about this in the forum about jsp's.
I think a good thing to do is not to put your context tag directly into the server.xml file.
What you should do is create a context.xml file with the context-tag in it, and put it in the META-INF directory of your .war file. Upon deployment to tomcat5 this file will be extracted from the war, copied to the conf\enginename\hostname directory, and it will be renamed to contextName.xml.
I think you are developing directly into the webapps directory, and I believe you should avoid that and use the deployment feature of the manager web-app or you should use the deployertool from you ide or standalone ant.
anyway, for starters try to remove the context tag from the server.xml file as described above, and check out the jsp / jdbc forums for simular problems and answers.
good luck -
I've been trying to do the tutorials in a book titled Apache Jakarta-Tomcat as part of my introduction to JSP. I'm new to Java but do know the basics. I have on my machine Java 1.3, Java 1.4, Java FrameWorks 2.1 and Jython 2.1 on Win2000 Pro. So enough about my configuration. I have never worked with packages also.
I downloaded the files from the books site due to the fact I make a lot of typos when hand coding Java (I've become a pretty good debugger of my own code). But everytime I go to compile the *.java I get error messages. So below you will find HelloTag.java and beneath that the error messages that are thrown when I try and compile it. I tested other bits of *.java and have had no problem compiling them. Is there a JSP module I'm missing?
Am I doing something wrong or am I missing something from my configuration.
Marijan Madunic
package chapter2;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
public class HelloTag extends TagSupport
public void HelloTag() {
// Method called when the closing hello tag is encountered
public int doEndTag() throws JspException {
try {
// We use the pageContext to get a Writer
// We then print the text string Hello
pageContext.getOut().print("Hello");
catch (Exception e) {
throw new JspTagException(e.getMessage());
// We want to return SKIP_BODY because this Tag does not support
// a Tag Body
return SKIP_BODY;
public void release() {
// Call the parent's release to release any resources
// used by the parent tag.
// This is just good practice for when you start creating
// hierarchies of tags.
super.release();
D:\Java\JDK 1.3\bin>javac HelloTag.java
HelloTag.java:3: cannot resolve symbol
symbol : class JspException
location: package jsp
import javax.servlet.jsp.JspException;
^
HelloTag.java:4: cannot resolve symbol
symbol : class JspTagException
location: package jsp
import javax.servlet.jsp.JspTagException;
^
HelloTag.java:5: cannot resolve symbol
symbol : class TagSupport
location: package tagext
import javax.servlet.jsp.tagext.TagSupport;
^
HelloTag.java:7: cannot resolve symbol
symbol : class TagSupport
location: class chapter2.HelloTag
public class HelloTag extends TagSupport
^
HelloTag.java:14: cannot resolve symbol
symbol : class JspException
location: class chapter2.HelloTag
public int doEndTag() throws JspException {
^
HelloTag.java:20: cannot resolve symbol
symbol : variable pageContext
location: class chapter2.HelloTag
pageContext.getOut().print("Hello");
^
HelloTag.java:24: cannot resolve symbol
symbol : class JspTagException
location: class chapter2.HelloTag
throw new JspTagException(e.getMessage());
^
HelloTag.java:28: cannot resolve symbol
symbol : variable SKIP_BODY
location: class chapter2.HelloTag
return SKIP_BODY;
^
HelloTag.java:37: cannot resolve symbol
symbol : variable super
location: class chapter2.HelloTag
super.release();
^
9 errorsWell, it looks like you've not got the servlet development kit JAR on your classpath. I think it'll probably be called servlet.jar on your system. Add that to the classpath if it's not already there.
Incidentally, you've bumped into one of the areas Java's slightly lenient - declaring a method that looks like a constructor:
public HelloTag() { }
public void HelloTag() { }The first is a constructor, the second is a normal method. I'm assuming you intended to have the former instead of the latter.
Anyway, hope this helps. -
JSP: work with TomCat 5.5.9 and NOT work with TomCat 6.0.16
Hi all,
I'm Antony and I have a problem with a .JSP page of my server.
In my server there are 2 users: "u1" and "u2"; there are 2 TomCat, version 5.5.9 and version 6.0.16. There is Apache WebServer version 2. The 2 TomCat servers have the same configuration files: server.xml and web.xml (in the dir /conf of the main server's root). They not work simultaneously.
When the user "root" launch the TomCat 5.5.9 all work fine: the server will show correctly the JSP pages of "u1" and the pages of "u2".
When the user "root" launch the TomCat 6.0.16 the JSP pages of "u1" work fine but the JSP pages of "u2" not work: it seems that there are problems with the path where the server want to search the pages of u2.
In the server.xml there is this code (for the handle of u2's site):
<Host name="u2site.com" appBase="/home/u2/public_html/">
<Alias>www.u2site.com</Alias>
<Context path="" reloadable="false" docBase="/home/u2/public_html/" debug="0"/>
<Context path="/manager" debug="0" privileged="true"
docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
</Context>
</Host>and this code (for the u1's site)
<Host name="u1site.com" appBase="/home/u1/public_html/">
<Context path="" reloadable="false" docBase="/home/u1/public_html" debug="1"/>
<Context path="/manager" debug="0" privileged="true"
docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
</Context>
</Host>The problems with the JSP pages of u2 are one of the following:
org.apache.jasper.JasperException: /login2.jsp(4,0) The value for the useBean class attribute com.u2.beans.access.Autenticator is invalid.and this one that appear with the pages that have the inclusion of another JSP page
/u2page.jsp(3,0) File "/../support/_formatting.jsp" not foundI think that the TomCat know how to find the page that the browser request to Apache WebServer (and that the webserver request to Tomcat by the connector) 'cause for pages that haven't inclusion or call to method in packages all work fine...but the TomCat have problems to locate the pages included or the method located in a JAR (the jars are located in WEB-INF/lib/ of the u2's site).
How I can resolve this problem with TomCat 6.0.16? I repeat that with TomCat 5.5.9 all work fine...same configuration!
Any ideas?
Thank you very much,
Antony.Hi stevejluke, 'cause in the page "/supporto/_formatting.jsp" there are only the definition of some variables it's normal that the output at the browser it's a blank page.
The problem it's that Tomcat 6.0.16 cannot know how "navigate" the pages beginning from one...it know where is the "x.jsp" page requested directly by Apache WebServer, where is "y.jsp" request directly by Apache, where is "z.jsp" requested directly by Apache but if "x.jsp" request, includes, "y.jsp" Tomcat cannot know where "y.jsp" is located. There is some file where I can "say" this to Tomcat?
The page "/mostre/elenco_mostre.jsp" includes directly the "/supporto/_formatting.jsp".
Another thing: in /mostre/elenco_mostre.jsp there is an inclusion directive for /supporto/_formatting.jsp that is so:
<%@ include file="../supporto/_formatting.jsp"%>you can see that the included file is "../supporto/_formatting.jsp" and NOT "/../supporto/_formatting.jsp"...the "/" at the begin of the path is included by Tomcat!
In the catalina.out there are this lines, when the page is called:
Jul 6, 2008 3:15:00 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /elenco_mostre.jsp(3,0) File "/../supporto/_formatting.jsp" not found
In catalina.out before server start there are this lines:
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Jul 6, 2008 1:43:49 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 358 ms
Jul 6, 2008 1:43:49 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 6, 2008 1:43:49 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
Jul 6, 2008 1:43:52 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/23 config=null
Jul 6, 2008 1:43:52 AM org.apache.catalina.connector.MapperListener registerEngine
WARNING: Unknown default host: localhost
Jul 6, 2008 1:43:52 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2512 msThe file "web.xml" is located in "$Tomcat_home/conf" and it's:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>there are not web.xml file in /WEB-INF/ of the web application.
Maybe the problem it's that Tomcat want the conf file in "Server/Service/Engine/Host/Context" ? I must move the block HOST of the server.xml file in this path?
Good Sunday and thank you!
Antony. -
PLEASE HELP Can't run my servlet url-pattern with Tomcat
Hi I'm trying to run servlet with Tomcat.
I have don the servlet with tomcat ide abd its runnig ok with Forte with the internal Tomcat
When I'm runing it with external Tomacat its not running at the url that I have given in the web.xml
web.xml file:
<?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>
<servlet>
<servlet-name>ClaimsServlet</servlet-name>
<servlet-class>ild.claims.ClaimsServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>ild.claims.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ClaimsServlet</servlet-name>
<url-pattern>/ild/claims/claims</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/ild/claims/LoginServlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
90
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
default.jsp
</welcome-file>
<welcome-file>
index.html
</welcome-file>
<welcome-file>
index.htm
</welcome-file>
</welcome-file-list>
</web-app>
if I runnig the url: /ild/servlet/ild/claims/ClaimsServlet
its running
but //ild/claims/claims
I got: The requested resource (/claims/claims) is not available.
Thanks for help
SnirDo you have to use <url-pattern>/ild/claims/claims</url-pattern>
or you can use <url-pattern>/claims</url-pattern> ? -
Im running examples of the include:
<jsp:include page="xxx.jsp" flush="true">
and received error:
org.apache.jasper.JasperException: No se puede compilar la clase para JSP
An error occurred at line: 17 in the jsp file: /jsp/include/include.jsp
Generated servlet error:
/Programas/Tomcat4/work/localhost/examples/jsp/include/include$jsp.java:79: Method include(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, javax.servlet.jsp.JspWriter, boolean) not found in class org.apache.jasper.runtime.JspRuntimeLibrary.
JspRuntimeLibrary.include(request, response, "/jsp/include/foo.html" + jspxqStr, out, true);
^
Please Help me Im running this equal with:
<%@ include file="xxx.jsp" %>
and runnig fine....The two means of including files are different in their approach.
Using <jsp:include .../> compilation of the included jsp is done at run -time not during compilation.
Using <%@ include .../> compiles at compile time.
Looking at the error it seems that the method JspRuntimeLibrary.include is not being found which suggests that you may have a classpath problem. Check that there is not a servlet.jar in the classpath that is from a earlier spec than the one provided with Tomcat.
Dave -
Servlet - JSP design and performance (Tomcat)
Hi everybody.
I'm new in Tomcat and servlet/JSP development.
My current design involves only one servlet (does the business logic, JSP page selections) which delegates the requests to several JSP-s (the JSP-s are included with the "jsp:include" tag).
The questions:
1. Has this design some performance drawbacks in contrast with a design in which several servlets are used (some of the included JSP pages will be the same)?
2. How Tomcat resolves concurent requests (if the same servlet is involved or two separate servlets are involved)?
Any response is greatly appreciated.
Thanks.A few things to keep in mind:
Every JSP is really a Servlet. Behind the scenes, these are compiled into Servlets which are then run. So, you really do have an implementation with more than one Servlet.
Controller Servlet's (one per JVM) are a very popular architecture choice. Struts, Spring and a number of other frameworks use this model. There should not be a difference between running multiple versus a single Servlet, and even if there is, your application undoubtedly has scaling bottlenecks other than this (probably orders of magnitude higher) than worrying about this particular issue.
Tomcat dispatches the request to whatever Servlet satisfies the servlet-mapping that the URL matches. Since Servlet's are designed to be written thread-safe, and since the container will manage those instances, do not worry.- Saish
Maybe you are looking for
-
I have Firefox 3.6.13 on a high-resolution (1920x1200) laptop screen. It used to be that I could CTRL+ and zoom in on a website such as Facebook.com or NYT.com once, and then every time I clicked on a page within that site, such as one individuals' F
-
Unable to edit a publishing page
Hi, I have created a new page from the 'Gear' Add a Page option in a SharePoint 2013 publishing site. When I go to Edit page option, I don't see the ribbon with options to insert webpart, etc. Instead, I am presented with just filling out the page
-
Pagination issue with Command Link
Hi I have a HtmlDatatable in which I am I am using pagination. Pagination is working fine the issue is one colum has been used with commnadlink. Whne I use the pagination(Say when I click next or last) i am not getting the hyper link in that column.
-
Hi I am using Ora10gR1 and SUSE Linux Enterprise Server 9. I am getting the following message in /var/log/messages Aug 27 09:48:41 (none) logger: Oracle Cluster Ready Services disabled by corrupt install Aug 27 09:48:41 (none) logger: Could not acces
-
hi, i have created one report with layout option. but my problem is , how can i create layout screen with 'user specific' Option in Save layout? Regards, Neptune.M