Servlet - unable to compile my simple servlet
I downdloaded the servlet api, I changed the classpath to point to the directory that I extracted to. However, I still cannot compile a simple servlet. I am sure I did not install the servlet api the right way. Can somebody help?
Thanks
This may sound silly, but you did UNZIP the servlet API, right?
Where did you set the classpath? Through an environment variable? Through a command line?
Best,
brumalis
Similar Messages
-
Noobie: unable to compile a simple test
Hello all,
I'm unable to compile a simple test to connect to the database, here is the env data:
OS: windowsXP (32bit).
compiler/linker: mingw.
IDE: codeblocks.
the program is:
#include <iostream>
#include <algorithm>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
class occicoll
private:
Environment *env;
Connection *conn;
Statement *stmt;
string tableName;
string typeName;
public:
occicoll (string user, string passwd, string db)
env = Environment::createEnvironment (Environment::OBJECT);
conn = env->createConnection (user, passwd, db);
~occicoll ()
env->terminateConnection (conn);
Environment::terminateEnvironment (env);
int main()
return 0;
and I get this compiler errors:
|=== TestOCCI, Debug ===|
C:\XEClient\oci\include\oratypes.h|98|Error E2257 : , expected|
C:\XEClient\oci\include\oratypes.h|99|Error E2238 : Multiple declaration for '_int64'|
C:\XEClient\oci\include\oratypes.h|98|Error E2344 : Earlier declaration of '_int64'|
C:\XEClient\oci\include\oratypes.h|99|Error E2257 : , expected|
C:\XEClient\oci\include\oratypes.h|104|Error E2257 : , expected|
C:\XEClient\oci\include\oratypes.h|105|Error E2257 : , expected|
main.cpp|33|Error E2176 : Too many types in declaration|
main.cpp|34|Error E2111 : Type 'occicoll' may not be defined here|
main.cpp|36|Error E2034 : Cannot convert 'int' to 'occicoll' in function main()|
||=== Build finished: 9 errors, 0 warnings ===|
most like I'm missing a few flags, any Ideas?
thanks,
GalHi,
OS: windowsXP (32bit).
compiler/linker: mingw.
On Windows the only supported environment is Visual Studio / cl.exe (the Microsoft compiler).
Regards,
Mark -
I am unable to compile a simple Java Interface
Following is the interface that I am trying to compile:
import java.rmi.Remote;
import java.rmi.RemoteException;
interface Scheduler extends Remote {
void startServer() throws RemoteException;
using the following command:
$ rmic -vcompat -classpath $CLASSPATH Scheduler
Following are messages/errors that I am getting:
error: Scheduler is an interface; stubs are needed only for remote object classes.
1 error
What exactly does this mean?
TIA
SaleemIt mean that rmic wants to compile an object, not an
interface.Objects are not and cannot be compiled. As far as the original question is concerned you need to compile the rmi server i.e the class implementing he forementioned interface and not the interface itself. -
Unable to compile servlet files in javac
i am unable to compile servlet *.java files in javac.as far as i can see my path is correct.
Kindly provide a solution as soon as possible.
My jdk1.3 is in my c drive and my tomcat in my d drive.
if you are able to compile kindly let me know your path.
it says symbol not resolved.i think that it is unable to import from javaxAssuming that your jdk is in c drive as c:\jdk1.3 set the path and the classpath like as shown below. Remember that you have to set the classpath for the classes in the javax.servlet and javax.servlet.http packages. I know how to do it for JavaWebServer. JavaWebServer has a jar called servlet.jar that contains all these classes. What you need to do is to put this jar file in your classpath. There will be a similar jar file for Tomcat server also. You need to refer the Tomcat server documentation for that.
The path and the classpath have to be set like this...
d:\>path=%path%;.;c:\jdk1.3\bin;
d:\>set classpath=%classpath%;.;c:\jdk1.3\lib;c:\JavaWebServer2.0\lib\servlet.jar;
assuming tht JWS is installed in c:\JavaWebServer2.0
Also note that there should be no spaces in between while setting the classpath. In your case you have to change the last part of the classpath to customize your requirement.
Hope that will help.
Regards
Jaydeep -
Generated servlet error - unable to compile class for JSP - using NB5.5/SS9
I am using NB5.5 beta2 and Sun server 9.0 with JSF 1.1 - all is OK when I am creating firts JSF application - welcomeJSF.jsp page is rendered normally - but when I am adding one more jsp with JSP view and so on - then - I am getting errors in both JSF pages - both - in original welcomeJSF and the new invoice.jsp page
here is code for typical error
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:99: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.jsf_core.ViewTag
[javac] jspxth_f_view_0.setJspId("id7");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:144: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.html_basic.OutputTextTag
[javac] jspxth_h_outputText_0.setJspId("id17");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:145: setValue(java.lang.String) in com.sun.faces.taglib.html_basic.OutputTextTag cannot be applied to (javax.el.ValueExpression)
[javac] jspxth_h_outputText_0.setValue(org.apache.jasper.runtime.PageContextImpl.getValueExpression("Java Server Faces", (PageContext)_jspx_page_context, java.lang.Object.class, null));
[javac] ^
[javac] 3 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:384)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:461)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:528)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:414)
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:455)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:139)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
note The full stack trace of the root cause is available in the Sun Java System Application Server Platform Edition 9.0 logs.
and there is output for another error:
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:144: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.html_basic.OutputTextTag
[javac] jspxth_h_outputText_0.setJspId("id17");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:145: setValue(java.lang.String) in com.sun.faces.taglib.html_basic.OutputTextTag cannot be applied to (javax.el.ValueExpression)
[javac] jspxth_h_outputText_0.setValue(org.apache.jasper.runtime.PageContextImpl.getValueExpression("Java Server Faces", (PageContext)_jspx_page_context, java.lang.Object.class, null));
[javac] ^
[javac] 3 errors
and here is code of my new invoice.jsp page:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1><h:outputText value="Java Server Faces" /></h1>
<h:inputText value="#{managerBean.currentInvoice.id}"/>
<h:inputText value="#{managerBean.currentInvoice.description}"/>
<h:inputText value="#{managerBean.currentInvoice.total}"/>
<h:commandButton value="new_invoice"
type="submit"
actionListener="#{managerBean.createNewInvoice}"/>
</body>
</f:view>and faces-config.xml file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config>
<managed-bean>
<managed-bean-name>managerBean</managed-bean-name>
<managed-bean-class>com.brl.ERPSolution.ui.ManagerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>managerBean was intended to be backing beans which will call the facaed beans of EJB 3.0 entity beans - but at presnet - almost empty methods are declared there:
package com.brl.ERPSolution.ui;
import javax.faces.event.ActionEvent;
import com.brl.solutions.EJB3.*;
* @author Administrator
public class ManagerBean {
protected int currentInvoiceId;
protected Invoices currentInvoice;
protected InvoicesFacade invoicesFacade;
/** Creates a new instance of ManagerBean */
public ManagerBean() {
/* business methods */
public void createNewInvoice(ActionEvent actionEvent)
invoicesFacade.create(this.currentInvoice);
public Invoices getCurrentInvoice()
return this.currentInvoice;
public void setCurrentInvoice(Invoices currentInvoice)
this.currentInvoice=currentInvoice;
}I read in one blog (actually - the only page which was returned by yahoo - so - this should be very rare error!!!) to try to use Sun server's verifier.bat - and - it reported 0 errors and 0 warning. Build was succesfull as well and also - deployment was without errors - but - above mentioned error appeared during the automatic compilation of jsp pages/servlet when newly deployed jsps are first accessed from remote browser.
So - is it possible, please, to receive some advice - what to do further? I feel that my invoice.jsp page can be with errors, - however - the original welcomeJSF.jsp should be working without errors even the erronwous JFS jsp page is added to web application.
Thans for any adice or hint in advance!!!OK - I have made 'clean and build main project' from NB menu and the deployed the resulting *.war and the error messages have disappeared... So - it seems to be bug...
-
How to install servlet classes in order to compile a simple servlet...
When trying to compile a simple servlet (java file), I get errors having to do with not finding any object of the javax.servlet class. I am using J2SE v.1.4, and from what I know, it does not have built-in support for Servlets-JSP.
Do I need to install myself the servlet classes (downloaded from Sun's site) in order for my servlet to be able to compile and work under tomcat? And if so, where should I put them? Or is there something else I have to do?
Thank you in advance for your assistance!If you have Tomcat already, the files you require are in:
(Tomcat4)
[TOMCAT_HOME]/common/lib/servlet.jar
or
(Tomcat5)
[TOMCAT_HOME]/common/lib/servlet-api.jar
[TOMCAT_HOME]/common/lib/jsp-api.jar
This file needs to be added to your classpath when compiling a servlet. -
I am unable to compile a java servlet program.
the message thrown ou by the compiler is
"Class java.servlet not found in import"You need to find where the servlet.jar file is on your system. For example i'm running tomcat on a linux machine, this is what i type to compile servlets.
javac -classpath /var/tomcat4/common/lib/servlet.jar yourFile.java -
Unable to compile class for JSP. apache-tomcat-6. What could be wrong?
Hello, I am new to JSP and I am trying a very basic jsp and class file on Windows XP. I get the Unable to compile class for JSP.
Steps that I have done:
javac ch06_01.java , placed the ch06_01.class under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes
Then grabbed the ch06_02.jsp and placed it under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\
When I run it (by placing this into Explorer or Firefox URL
http://localhost:8080/ch06/ch06_02.jsp) I get the error further
below. Things I have done and made sure they are in place are:
set up JAVA_HOME to C:\Apps\jdk1.6.0_06
Using CATALINA_BASE: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_HOME: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_TMPDIR: C:\Apps\apache-tomcat-6.0.16\temp
Using JRE_HOME: C:\Apps\jre1.6.0_06
I did a google on the error and I found people saying to place the
tools.jar from the jsk into the lib directory under CATALINA_HOME. But
the examples still don't work. What step could I be missing? Your help is greatly
appreciated.
This is the simple jsp file:
<%@ page import="ch06_01" %>
<HTML>
<HEAD>
<TITLE>Using a JavaBean</TITLE>
</HEAD>
<BODY>
<H1>Using a JavaBean</H1>
<% ch06_01 messager = new ch06_01(); %>
The message is: <%= messager.msg() %>
</BODY>
</HTML>
this is the simple ch6_01 java file:
public class ch06_01
public ch06_01()
public String msg()
return "Hello from JSP!";
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:
An error occurred at line: 6 in the generated java file
The import ch06_01 cannot be resolved
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Edited by: indikon1 on Jun 12, 2008 1:18 PM
I just updated the directories of the variables to reflect the current status of my system.What is wrong is that you are using an "old" jsp tutorial :-)
Since Java 1.4, JSPs have been unable to access classes in the "default" package.
What you need to do:
Put the java class ch06_01 in a package.
Steps to do this
- Edit ch06_01 and add the following to the very top of the file (without the quotes): "package mypackage;"
- create a folder "mypackage"
- move ch06_01.java into that folder
- compile that class (now in the mypackage package)
- place ch06_01.class under C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes\mypackage
In your jsp:
<%@ page import="mypackage.ch06_01" %>
I would suggest using a more up-to-date tutorial that uses JSTL.
Take a look at this [Apache Tomcat tutorial|http://www.coreservlets.com/Apache-Tomcat-Tutorial/index.html] -
Tomcat 4.1 Bean error (Unable to compile class for JSP)
Help,
I am using Tomcat 4.1 with with JDK1.3.1_01. I have a JSP page in which I try to use a Bean, but I get the following error from Tomcat.
The JSP page is very simple. I am using package names in the import statement. Code below.
I've put the class files under
<TOMCAT>\webapps\projectname\WEB-INF\classes under the appropriate packages. What else is missing? I can not figure out what I am doing wrong.
***************** START JSP CODE *********************
<html>
<head>
<title>User Information</title>
</head>
<%@ page session="true" %>
<%@ page import="com.xxx.yyy.data.*" %>
<body>
<P> </P>
<P> </P>
<P> </P>
<!--
<jsp:useBean id="user" class="com.xxx.yyy.data.User" scope="session"/>
-->
<%
User user = (User) session.getAttribute("user");
%>
UserID = <%= user.getUserID() %><BR>
User Name = <%= user.getUserName() %><BR>
Password = <%= user.getPassword() %><BR>
Password Hint = <%= user.getPasswordHint() %><BR>
</body>
</html>
***************** END JSP CODE *********************
***************** START TOMCAT ERROR MESSAGE *********************
org.apache.jasper.JasperException: Unable to compile class for JSP
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:477)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 20 in the jsp file: /userInfo.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:7: package com.xxx.yyy.data does not exist
import com.xxx.yyy.data.*;
^
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:61: package com.xxx.yyy.data does not exist
com.xxx.yyy.data.User user = null;
^
An error occurred at line: 20 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:63: package com.xxx.yyy.data does not exist
user = (com.xxx.yyy.data.User) pageContext.getAttribute("user", PageContext.SESSION_SCOPE);
^
An error occurred at line: 20 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:66: package com.xxx.yyy.data does not exist
user = (com.xxx.yyy.data.User) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.xxx.yyy.data.User");
^
An error occurred at line: 25 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:77: cannot resolve symbol
symbol : class User
location: class org.apache.jsp.userInfo_jsp
User user = (User) session.getAttribute("user");
^
An error occurred at line: 25 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:77: cannot resolve symbol
symbol : class User
location: class org.apache.jsp.userInfo_jsp
User user = (User) session.getAttribute("user");
^
6 errors
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:326)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)
***************** END TOMCAT ERROR MESSAGE *********************Hi
I am running my Tomcat apps (on a Windows dev machine) in an alternate location (ie. not default webapps). The same crap comes to me every time. Unable to install etc. I have tried every trick in the book regarding classpath settings etc.
When I use 'javap' to check the classpath from any location on my machine, its works and javap returns the signature of my class.
When I use it though Tomcat (with the import set to include the filename), it get the error. I have heard rumors that using JDK 1.3 in stead of 1.4 helps, but I just want it to work with 1.4 :)
So if any of you can help me on this, please.
PS. On my linux server it works just fine, as does every other thing on that machine ;)
Chris (chris.schuit <at> euronet.nl) -
Unable to compile class for JSP. package not found
Hello folks,
I was trying to build a simple web application using Eclipse IDE, tomcat 5.x server and ant to build and deploy the application.
I referenced the following tutorial:
http://www.onjava.com/pub/a/onjava/2003/01/08/tomcat4.html
I was able to create a war file, deploy it in tomcat. When i invoke a simple jsp it works fine. However if I try to import any source pkg into jsp it throws error. Below is stack trace.
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
C:\tomcat\work\Catalina\localhost\aweb\org\apache\jsp\web\Home_jsp.java:6:
package com.ak.test does not exist
import com.ak.test.*;
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994)
org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:343)
org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Any clue what is the issue?Additional Info:
Location of files
==================
My jsp file is located at:
C:\eclipse\workspace\aweb\web\Home.jsp
my class is located in:
C:\eclipse\workspace\aweb\WEB-INF\classes\com\ak\test
Webapplication Dir Structure:C:\eclipse\workspace:
aweb(webapplication name)
+web
-----+Home.jsp
+src
------+com.ak.test.MyJava.java
+WEB-INF
------+Classes
--------+com.ak.test.MyJava.class
------+lib
----------struts.jar
------+web.xml
------+struts-config.xml
-aweb.war(build.xml creates war file as per WAR format)
Ant task which installs the webapplication in Tomcat:
<target name="install" description="Installs the Web Application" depends="package">
<echo message="Installing ${app.name} ..."/>
<install url="${manager.url}" username="${username}" password="${password}" path="/${app.name}"
config="file:${basedir}/war/META-INF/context.xml" war="file:${basedir}/${app.name}.war"/>
</target>
build.properties file
app.name=aweb
manager.url=http://localhost:8080/manager
tomcat.home=C:/tomcat
username=user
password=user
Contents of the jsp file
=======================
<%@ page import="com.ak.test.MyJava" %>
<html>
<head>
<title>Home Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
</body>
</html> -
Appserver unable to Compile JSP pages
Hello
I have deployed a webapplication on SunONE application server installed on a SunOS 5.8 box. When I try to access any page , I keep getiing errors indicating that the page could not be compiled. An attempt to compile the page seperately using the javac installed with the App server however succeeds.
The errors I get are as shown. The same webapp runs fine when installed on SunONE application server installed on Windows 2000 machine. Any help would be greatly appreciated
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred at line: 175 in the jsp file: /filesfolders/process_parameters.jsp
Generated servlet error:
/actu01/appserver7/appserv/instances/server1/generated/jsp/j2ee-modules/ap/_jasper/_filesfolders/_index_jsp.java:1962: Variable jbs may not have been initialized.
bFilter = jbs.isDocChanFiltersEnabled();
^
An error occurred between lines: 175 and 176 in the jsp file: /filesfolders/process_parameters.jsp
Generated servlet error:
/actu01/appserver7/appserv/instances/server1/generated/jsp/j2ee-modules/ap/_jasper/_filesfolders/_index_jsp.java:1970: Variable bFolders may not have been initialized.
boolean bEmptyRS = !(bFolders || bExecutables || bDocuments);
Thanks
-AniruddhaI am having a similar problem on Windows 2000. Servlets run but jsp's all hit this error. Here is a copy of the log:
[15/May/2003:07:40:16] INFO ( 1924): CORE1116: Sun ONE Application Server 7.0^M
[15/May/2003:07:40:20] INFO ( 1924): CORE5076: Using [Java HotSpot(TM) Server VM
, Version 1.4.1_01] from [Sun Microsystems Inc.]^M
[15/May/2003:07:40:35] INFO ( 1924): JMS5023: JMS service successfully started.
Instance Name = domain1_server1, Home = [C:\tools\as7se\imq\bin].^M
[15/May/2003:07:40:40] INFO ( 1924): JTS5014: Recoverable JTS instance, serverId
= [100]^M
[15/May/2003:07:40:41] INFO ( 1924): RAR5060: Install JDBC Datasources ...^M
[15/May/2003:07:40:41] INFO ( 1924): RAR5059: Binding [JDBC DataSource Name: jdb
c/jdbc-simple, Pool Name: PointBasePool]^M
[15/May/2003:07:40:42] INFO ( 1924): JMS5015: Install JMS resources ...^M
[15/May/2003:07:40:44] INFO ( 1924): WEB0100: Loading web module [webapps-simple
] in virtual server [server1] at [webapps-simple]^M
[15/May/2003:07:40:48] INFO ( 1924): HTTP3072: HTTP listener http-listener-1 [ht
tp://LINDENBERGR-LT01:80] ready to accept requests^M
[15/May/2003:07:40:48] INFO ( 1924): CORE3274: successful server startup^M
[15/May/2003:07:40:48] INFO ( 1924): CORE5053: Application onReady complete.^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: java.lang.ClassFormatE
rror: sun/tools/java/Parser (Illegal constant pool index)^M
[15/May/2003:07:42:53] SEVERE ( 1924): StandardWrapperValve[jsp]: Servlet.servic
e() for servlet jsp threw exception^M
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:322
)^M
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)^M
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)^M
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(St
andardWrapperValve.java:720)^M
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrap
perValve.java:118)^M
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperVa
lve.java:278)^M
at java.security.AccessController.doPrivileged(Native Method)^M
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:274)^M
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:505)^M
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:212)^M
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:505)^M
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:203)^M
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:505)^M
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProce
ssor.java:157)^M
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)^M
^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.defineClass0(Native Method)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.defineClass(ClassLoader.java:502)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.security
.SecureClassLoader.defineClass(SecureClassLoader.java:123)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader.defineClass(URLClassLoader.java:250)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader.access$100(URLClassLoader.java:54)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader$1.run(URLClassLoader.java:193)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.security
.AccessController.doPrivileged(Native Method)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader.findClass(URLClassLoader.java:186)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.loadClass(ClassLoader.java:299)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at sun.misc.Laun
cher$AppClassLoader.loadClass(Launcher.java:265)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.loadClass(ClassLoader.java:255)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.loadClassInternal(ClassLoader.java:315)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.defineClass0(Native Method)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.defineClass(ClassLoader.java:502)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.security
.SecureClassLoader.defineClass(SecureClassLoader.java:123)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader.defineClass(URLClassLoader.java:250)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader.access$100(URLClassLoader.java:54)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader$1.run(URLClassLoader.java:193)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.security
.AccessController.doPrivileged(Native Method)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.net.URLC
lassLoader.findClass(URLClassLoader.java:186)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.loadClass(ClassLoader.java:299)^M
@[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at sun.misc.Laun
cher$AppClassLoader.loadClass(Launcher.java:265)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.loadClass(ClassLoader.java:255)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at java.lang.Cla
ssLoader.loadClassInternal(ClassLoader.java:315)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at sun.tools.jav
ac.BatchEnvironment.parseFile(BatchEnvironment.java:453)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at sun.tools.jav
ac.Main.compile(Main.java:486)^M
[15/May/2003:07:42:53] WARNING ( 1924): CORE3283: stderr: at org.apache.ja
sper.compiler.SunJavaCompiler$JavacTask.run(SunJavaCompiler.java:240)^M
Thanks,
Bob -
Unable to compile class for JSP
Please can anyone help me to solve this.
Actually,this is the condition.
In my db,there is a table called UserPassword, which has 4
fields(empNo,UserName,password,level). Now I want to do these things:
When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
1)To check the empNo,if it is already exist in the DB,
if empNo =exist then display error.(record already exist)
if empNo =notexist then do task 2).
2)check the UserName,if it is already exist in the db,
if UserName=exist then display error.(because it's a primary key)
if UserName=notexist then do task 3).
3)Create a new user account and save it to the db.
To do these tasks,I never create a new objects for the tasks 1) and 2).
only for task 3)create an object.
Is it the right way?
Here is the file CreateAcc.jsp
<%@ page language="java" %>
<%@ page import="core.UserAccManager" %>
<%@ page import="data.UserPassword" %>
<jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
<jsp:setProperty name="UserAccManager" property="*"/>
<jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
<jsp:setProperty name="UserPassword" property="*"/>
<%
String nextPage ="MainForm.jsp";
if(UserPassword.verifyEmpno()){
if(UserPassword.verifyUsername()){
if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>The directory structure:
UserPassword.java- F:/Project/core/data/UserPassword.java
UserAccManager.java - F:/Project/core/UserAccManager.java
Now both are compiling.I put the class files into the TOMCAT,as follows.
UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
Here is the full code of the file UserAccManager.java.
package core; //Is this right?
import data.UserPassword; //Is this right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class UserAccManager{
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager(){
// Initializes the connection and statements
public static void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
// Prepare the statements
sql = "SELECT * FROM UserPassword where empNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql = "SELECT UserName FROM UserPassword where UserName= ?";
pstmt2 = connection.prepareStatement(sql);
sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
pstmt3 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
// Closes the connection and statements
// Method to be called by main class when finished with DB
public void closeConnection() {
//same as previous
public static boolean verifyEmpno(int empno) {
boolean emp_no_select_ok = false;
int emp = -1;
initConnection();
try {
pstmt1.setInt(1, empno);
ResultSet rs1 = pstmt1.executeQuery();
while(rs1.next()){
emp=rs1.getInt("empNo");
if(emp>0)
emp_no_select_ok = false;
} else{
emp_no_select_ok = true;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return emp_no_select_ok;
public static boolean verifyUsername(String username) {
boolean user_name_select_ok = false;
String user = "xxxx";
initConnection();
try {
pstmt2.setString(1, username);
ResultSet rs2 = pstmt2.executeQuery();
while(rs2.next()){
user=rs2.getString("UserName");
if(!user.equals("xxxx"))
user_name_select_ok = false;
} else{
user_name_select_ok = true;
rs2.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return user_name_select_ok;
public static boolean createAcc(int empno, String username, String password, int
level){
boolean create_acc_ok = false;
initConnection();
try{
//create a new object,from the UserPassword table.
UserPassword useraccount = new UserPassword();
useraccount.setEmpno(empno);
useraccount.setUsername(username);
useraccount.setPassword(password);
useraccount.setLevel(level);
//assign value for ???
pstmt3.setInt(1, useraccount.getEmpno());
pstmt3.setString(2, useraccount.getUsername());
pstmt3.setString(3, useraccount.getPassword());
pstmt3.setInt(4, useraccount.getLevel());
if(pstmt3.executeUpdate()==1) create_acc_ok=true;
pstmt3.close();
//con.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return create_acc_ok;
}here is the bean (part of it)
package data; //is it right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
private int empno;
private String username;
private String password;
private int level;
// Constructor
public UserPassword()
this.empno = empno;
this.username = username;
this.password = password;
this.level = level;
// setters and getters are here.
// public boolean verifyEmpno() {
// return UserAccManager.verifyEmpno(empno);
// public boolean verifyUsername(String username) {
// return UserAccManager.verifyUsername(username);
// These 2 methods not compile with or without para's.So I leave that job for the
//controll class UserAccManager.java.
Now my problem is this: When I submit data, there is an error;org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
cannot access core.data.UserPassword
bad class file: C:\Program Files\Apache Group\Tomcat
4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
class file contains wrong class: data.UserPassword
Please remove or make sure it appears in the correct subdirectory of the classpath.
import core.data.UserPassword;
^
1 error
Are there any mistakes? If so tell me where is it and how to change them.Please help.I try it that way, but it don't compile.
Error:core\data\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
core\data\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Then it compile well.I goto the directory to get the .class files.
But there is only UserPassword.class inside the data folder. There is not
UserAccManager.class in the core folder.
Then I try this way,I put my 2 java files in to a new folder,
F:\SystemName\com
When I try it that way, but it don't compile.
javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
com\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Now both are compiling well.There was 2 class files.
I put them in to the WEB-INF/classes/com directory.
Start the server.But it gave errors:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserPassword.verifyEmpno(empno)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
verifyUsername(java.lang.String) cannot be referenced from a static context
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
context
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
things.
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*; //otherwise it tells an error.(package
//javax.servlet does not exist)
//import javax.servlet.http.*;
public class UserAccManager {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager() {
// Initializes the connection and statements
private static void initConnection() {
//same
// Closes the connection and statements
// Method to be called by main class when finished with DB
public static void closeConnection() {
//same
public static boolean verifyEmpno(int empno) {
// same.
public static boolean verifyUsername(String username) {
//same.
public static boolean createAcc(int empno, String username, String password, int
level){
//same
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*;
//import javax.servlet.http.*;
public class UserPassword {
// same
Again compile those files and put .class filses into the WEB-INF/classes/com directory.
When i submits the data via the form it generates an error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyEmpno(empno)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
6 errorshere is the CreateAcc.jsp file
<%@ page language="java" %>
<%@ page import="com.UserAccManager" %>
<%@ page import="com.UserPassword" %>
<jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
<jsp:setProperty name="userPassword" property="*" />
<%
String nextPage ="MainForm.jsp";
if(UserAccManager.verifyEmpno(empno)){
if(UserAccManager.verifyUsername(username)){
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
Thanks. -
Unable to compil class for jsp
error is
HTTP Status 500 -
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:
An error occurred at line: 6 in the generated java file
Syntax error on token ".", Identifier expected after this token
An error occurred at line: 7 in the generated java file
Syntax error on token ".", Identifier expected after this token
An error occurred at line: 9 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
6: <BODY>
7: <H1>issue books</H1>
8: <CENTER>
9: <jsp:useBean id="student"
10: type="LibraryStudent"
11: scope="session" />
12: student name:
An error occurred at line: 9 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
6: <BODY>
7: <H1>issue books</H1>
8: <CENTER>
9: <jsp:useBean id="student"
10: type="LibraryStudent"
11: scope="session" />
12: student name:
An error occurred at line: 13 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
10: type="LibraryStudent"
11: scope="session" />
12: student name:
13: <jsp:getProperty name="student" property="studentName" />
14:
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
An error occurred at line: 16 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
13: <jsp:getProperty name="student" property="studentName" />
14:
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
17:
18: <jsp:getProperty name="student"
19: property="issueData" />
An error occurred at line: 18 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
17:
18: <jsp:getProperty name="student"
19: property="issueData" />
20: </FORM>
21: </CENTER>LibraryStudent.java is
import java.util.*;
import java.text.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class LibraryStudent {
private String emailAddress, s,password, sname,bname;
private String date,value;
public String getStudentName() {
return(sname);
public void setStudentName(String sname) {
this.sname = sname;
public String getEmailAddress() {
return(emailAddress);
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
public String getPassword() {
return(password);
public void setPassword(String password) {
this.password = password;
public String getBookName() {
return(bname);
public void setBookName(String bname) {
this.bname = bname;
public String getDate() {
return(date);
public void setDate(String date) {
this.date = date;
public String getIssueData() //method that create connection withh database
throws ServletException,IOException{
try{
getDate(); //and add a entry in database
getBookName();
getStudentName();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:db2");
Statement st=con.createStatement();
String sql =
"insert into table1 (bookname,studentname,date) values(bname,sname,date)";
st.executeUpdate(sql);
System.out.println(sql);
String s= "your book has been issued ";
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
public String getSumbitData()
throws ServletException,IOException{
try
getBookName();
getStudentName();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:db2");
Statement st=con.createStatement();
String sql =
"delete from db2 where bookname='bname' and studentname=sname";
st.executeUpdate(sql);
System.out.println(sql);
String s="your book has been sumbitted ";
return(s) ;
catch(Exception e)
e.printStackTrace();
return "failed";
public static int findStudent //to validate customer
(String emailAddress,
String password) throws ServletException,IOException{
try
if (emailAddress == null) {
return(0);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:user");
Statement st=con.createStatement();
String sql="select * from user where name='"+emailAddress+"' and password='"+password+"'";
System.out.println(sql);
ResultSet rs=st.executeQuery(sql);
if(rs.next())
return(1);
else
return(0);
}catch(Exception e)
e.printStackTrace();
return (0);}
to be continued.............and Library.java is import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Library extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String emailAddress = request.getParameter("emailAddress");//use to email&pass
String password = request.getParameter("password");//from html page
LibraryStudent student = new LibraryStudent();//Make a student Object
int a=LibraryStudent.findStudent(emailAddress, password);//to validate student
if (a==0) {
gotoPage("/library/accounts.jsp", request, response);
else
student.setStudentName(request.getParameter("sname"));//use to sent other textbox
student.setBookName(request.getParameter("bname"));//data in librarystudent
student.setDate(request.getParameter("date"));//class after validation
HttpSession session = request.getSession(true);
session.putValue("student", student);
//for moving different page
if (request.getParameter("issue") != null) {
gotoPage("/travel/issue.jsp",
request, response);
} else if (request.getParameter("sumbit") != null) {
gotoPage("/travel/sumbit.jsp",
request, response);
} else if (request.getParameter("search") != null) {
gotoPage("/travel/search.jsp",
request, response);
} else if (request.getParameter("account") != null) {
gotoPage("/travel/EditAccounts.jsp",
request, response);
} else {
gotoPage("/travel/IllegalRequest.jsp",
request, response);
private void gotoPage(String address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(address);
dispatcher.forward(request, response);
} issue.jsp is
<%@page import="java.io.,java.util.,java.sql.*"%>
<HTML>
<HEAD>
<TITLE>issue books</TITLE>
</HEAD>
<BODY>
<H1>issue books</H1>
<CENTER>
<jsp:useBean id="student"
type="LibraryStudent"
scope="session" />
student name:
<jsp:getProperty name="student" property="studentName" />
book name:
<jsp:getProperty name="student" property="bookName" />
<jsp:getProperty name="student"
property="issueData" />
</FORM>
</CENTER>
</BODY>
</HTML> plz solve my problem .i m new to servlet and jsp and i have keen desire to learn this topic -
Unable to compile class for JSP--- help me plz!!!!!
hi friends;
Pease suggest me where i am wrong, i think javabean is not instantiated in jsp file.may be it is related to the classpath of javabean. i have not set any variable for javabean classpath. and i put javabean class file in
TOMCAT_HOME/webapps/test3/WEB-INF/UseDta.class
and all the jsp and html in /test3. my jsp an javabeans are--
1. GetName.html
<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
2. SaveName.jsp
<jsp:useBean id="user" class="UserData" scope="session">
<jsp:setProperty name="user" property="*"/>
</jsp:useBean>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
3. UserData.java
public class UserData {
String username;
String email;
int age;
public UserData(){}
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
4. NextPage.jsp
<jsp:useBean id="user" class="UserData" scope="session"/>
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>
url: http://localhost:8080/test3/GetName.html
is it related to context path??
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
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:44: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
UserData user = null;
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:46: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:48: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = new UserData();
^
3 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
Apache Tomcat/5.0.30
please Reply me ASAP
i'll be glad if you reply. pleaseI am using Tomcat 6.0.
I have put my UserData class in user package and
used in below jsp(SaveName.jsp)
<%@ page import="user.UserData" %>
<jsp:useBean id="user" class="user.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
I have already set my classpath as C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes;
UserData class is in C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes\user
My UserData class is
package user;
public class UserData {
String username;
String email;
int age;
public UserData(){
this("","",0);
System.out.println("najn thanne puli");
public UserData(String username,String email,int age){
this.username=username;
this.email=email;
this.age=age;
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
But running SaveName.jsp shows exception
org.apache.jasper.JasperException: /SaveName.jsp(2,0) The value for the useBean class attribute user.UserData 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:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Generator.generate(Generator.java:3372)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Please help me.thanks in advance. -
Unable to compile add.jsp
I am able to run the examples in the tomcat, but unable to run my own add.jsp which tries to connect to oracle9i. The following error is displayed. add.jsp file is copied at the end of this error message.
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
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat 4.1\work\Standalone\localhost\examples\add_jsp.java:7: '.' expected
import DbConnect1;
^
1 error
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)
The add.jsp contents are
<%@page contentType="text/html" import="DbConnect1,java.util.*,java.sql.*,java.lang.*"%>
<html>
<head><title>JSP Page</title></head>
<%
String no,name,c;
//int n;
no=request.getParameter("NUMBER");
//n=Integer.parseInt(no);
name=request.getParameter("NAME");
c=request.getParameter("check");
if(c==null) c="";
if(c.equals("1"))
out.println("Retry Again");
if(name==null )
{name="";}
if(!name.equals(""))
try{
DbConnect1 t=new DbConnect1();
t.insert(no,name);
response.sendRedirect("display.jsp");
}catch(Exception e){response.sendRedirect("add.jsp?check=1");
else {%>
<form action="add.jsp" method=post>
<input type=hidden name=check>
<BODY BGCOLOR=PURPLE>
<BR><PRE><FONT COLOR=WHITE SIZE=4 STYLE="WESTERN"><B><BR><BR><BR><BR> NUMBER <INPUT TYPE=TEXT SIZE=10 NAME="NUMBER">
<BR><BR> NAME <INPUT TYPE=TEXT SIZE=20 NAME="NAME"><BR>
<BR><BR><BR><BR> <INPUT TYPE="SUBMIT" VALUE="ADD" onClick="display()">
</FORM>
</form>
<%}%>
<SCRIPT LANGUAGE ="JavaScript">
function display()
window.location="/project/display.jsp"; }
</SCRIPT>
</html>
Any help would be greatly appreciated.
Thanks
Geethaif you want to know how to declare a package for your classes
Follow the steps to make your application work
Make this as the first statement in your DbConnect1 class
package DbConnect1;
Compile the class and place the DbConnect1.class file into
Tomcat/webapps/<yourapplication>\WEB-INF\classes\package\ directory
for eg : if your package name is test then place the class files under
Tomcat/webapps/<yourapplication>\WEB-INF\classes\test directory
This is where Tomcat looks for class files
If you have any doubts regarding directory dtructure to be followed in Tomcat please refer to some of the example packages under Root directory
In your JSP say
page import = packageName. DbConnect1
-Hope this helps
Regards
Manikantan
Maybe you are looking for
-
How to connect to remote server with jmx from jvisualvm
I have a WL 10.3.2 domain running on a single box. The adminserver and managed server are running on the same box, on different ports (7001 and 8001, respectively). I have a Spring application deployed to the managed server and I've configured it to
-
I have an iPod Nano 4GB that was formatted for Windows a couple of years ago. Shortly afterwards I bought and iMac and would like to like to be able to sync my iPod with the iMac. Most songs were loaded from CDs. However, a few were purchased from iT
-
I had a box on the top of the browser that has written, you got mail. The problem is it keeps repeating you got mail. I don't want to hear it. This is an unsolicited ad for "winning" an I phone. I am very tired of winning all this junk. I certainly d
-
Hi guys I'm having trouble with a intel CD Mac mini. For no apparent reason it's decided to think there are no sound devices. I've never seen this kind of thing before and I'm hoping that it isn't a hardware fault 'cause as far as I know the audio is
-
ALR reports showing data mismatch from Detail reports
In our scenario WBS element i.e projects is converted through settlement into AUC & later onward AUC is converted into Assets. We are seeing report T-Code CJE0 u2013 12KSTIA(Budget/Actual /commitment / Rem. plan/assigned), in this the field for Actua