• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

cannot find symbol

 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am getting the following error when running my servlet program in my linux machine.

The error is:


Outbound.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
Outbound.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Outbound.java:16: cannot find symbol
symbol: class HttpServlet
public class Outbound extends HttpServlet {
^
Outbound.java:18: cannot find symbol
symbol : class HttpServletRequest
location: class Outbound
public void doGet(HttpServletRequest request,
^
Outbound.java:19: cannot find symbol
symbol : class HttpServletResponse
location: class Outbound
HttpServletResponse response)
^
Outbound.java:20: cannot find symbol
symbol : class ServletException
location: class Outbound
throws ServletException, IOException {
^
Note: Outbound.java uses or overrides a deprecated API.
Note: Recompile with -Xlint eprecation for details.
6 errors



I have created a project folder named "webproject"inside /usr/local/apache-tomcat/webapps and created a folder named WEB-INF and web.xml file.Inside the WEB-INF i have created a folder classes.i have put my servlet code in side classes and tried to compile.but i am getting the error.please help me to solve this error.

Thanks
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai preethi

you not set the classpath for your web server... which web server you using to support your servlet files ?.

set the classpath for your webserver, your errors will be rectified.

Tell to Difficulties iam very difficult..gud luck preethi

regards
gopi
gopinath65@gmail.com
 
Author
Posts: 3473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you are missing the servlet-api.jar. Possibly other jars as well.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks gopi sri .I am using tomcat webserver.It is in the path /usr/local.How should i set the path for this and where i have to set the path?

arulk,
I am having the servlet-api,servlet jar files in /usr/local/apache-tomcat/common/lib and also in /usr/java/jdk/bin and also in /usr/java/jdk/jre/bin. what else i have to add in which path?

[ November 12, 2008: Message edited by: preethi Ayyappan ]
[ November 12, 2008: Message edited by: preethi Ayyappan ]
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Preethi If you want to compile your servlet
then set classpath to the servlet-api.jar
and then compile , Your compilation problem will be solved
Bye
 
gopi sri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello preethi....
oh great you are using good web server..you set the classpath for your web server using servlet-api.jar file.

goto->mycomputer->rightclick->properties->press Advance tab-> click EnvironmentVariables-> window open

you should enter following
variable name : classpath
variable value: D:\apache-tomcat-6.0.14\lib\servlet-api.jar;
OR
/usr/local/apache-tomcat/common/lib\servlet-api.jar;

i given D:\apache .. since i have apache tomacat in D: drive !! you enter the path where you apached is located..

tak care,
gopi
gopinath65@gmail.com
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it is present at multiple places then anyone can do, but make sure you dont run into version problems.I'll say add /usr/local/apache-tomcat/common/lib to your classpath.
More on compiling servlets here .
BTW gopi sri, preethi is using Linux and not Windows
[ November 12, 2008: Message edited by: Amit Ghorpade ]
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.I have set classpath like export CLASSPATH=/usr/local/apache-tomcat/common/lib in /etc/profile.But till the error occurs.I gave the above in the console like export CLASSPATH=/usr/local/apache-tomcat/common/lib:$CLASSPATH also and tried to compile.But i am getting the same error.I am having servlet and servlet-api.jar files in the path /usr/local/apache-tomcat/common/lib
[ November 12, 2008: Message edited by: preethi Ayyappan ]
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi preethi Ayyappan,

set classpath for each jar files separatly.

the Tomcat or java compiler wont take if you specify the path till lib.

classpath in environment varable: "C:\Tomcat 6.0\lib\servlet-api.jar"

Thanks & Regards,

Bennet Xavier.X
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having problem even in accessing the servler-examples project which is given in default.When i tried to access the tomcat page i can able to view that page.But when i tried to access http://192.168.1.147:8080/servlets-examples,i am getting the following error:


HTTP Status 404 - /servlets-examples

type Status report

message /servlets-examples

description The requested resource (/servlets-examples) is not available.
Apache Tomcat/5.5.26



why it happens.It is also due to any class path problem or tomcat is not installed properly?
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure that your TOMCAT,Catalina and Java home are set correctly.

If possible use ANT/maven scripts to compile and deply your application
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all.I have solved the problem by compiling it like
javac -cp servlet-api.jar:servlet.jar:mysql-connector-java-3.0.17-ga-bin.jar:.:asterisk-java-0.3.1.jar Outbound.java.

Now it compiles well. but tomcat projects are not opened and displaying error
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but tomcat projects are not opened and displaying error


Kindly explain more the issue you are facing. This is too fuzzy! :roll:
 
All of the following truths are shameless lies. But what about this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic