• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

servlet/jsp not running in tomcat

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I am trying to deploy am application in tomcat
I installed tomcat and my TOMCAT_HOME, JAVA_HOME are set properly.
When I am trying to compile my servlets and java bean I am getting the compilation errors for all the servletAPI classes like, "HttpServlet not found".
Can anyone help
Thanks
 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Giri
u need to have the sevlet API's from the java.sun.com as they don't come standard with the jdk1.3. u need to download the java webserver as the Servlets API's come with that. and then include the new API's in your classpath or add it to the already existing classes file that comes with the jdk1.3, i think it is the rt.jar file.
 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lee
But I think the servlet related classes are there in the tomcat/lib directory???
I am using JDK1.2
I included the tomcat/lib to my classpath too.
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally, I would add each of the jar files in the lib
folder to the classpath.
regds.
- satya
 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Madhav
Cahnging theCLASSPATH to point to all the jars is working. But have another problem.......
I placed all classes, JSP and html as per deployment documentation by tomcat. But my bean class which is in the WE_INF.classes is not getting recognized by my JSPs
Any light on this
Thanks again
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But my bean class which is in the WE_INF.classes is not getting recognized by my JSPs
Not sure what you mean by WE_INF.classes
If you don't mean the foll., then it would help.
The class files are supposed to be in the WEB-INF/classes
dir not the WEB-INF. Also, if you have a package structure, then
the class files should be in the correct package under the
WEB-INF/classes dir.
regds.
- satya

[This message has been edited by Madhav Lakkapragada (edited March 19, 2001).]
 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are in the correct packege under the WE-INF/classes, Madhav.
Still I am getting the error

 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the error you are getting? Did you spell the class name correctly in jsp files? Please post the initial code part of your bean .java file and the .jsp file which uses it.
regds
maha anna
 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maha
Following is the outline of code

package net.sbcis.dn_worksheet;
import java.beans.*;
import javax.servlet.http.*;
import javax.servlet.*;
public class WorksheetBean {
// variables declaration
// public get methods
//public set methods
}
Here is the JSP call for bean
<jsp:useBean id="worksheet_bean" class="net.sbcis.dn_worksheet.WorksheetBean" sc
ope="request"/>
<jsp:setProperty name="worksheet_bean" property="*"/>
This is how the bean methods are called
<td nowrap><input type="radio" name="reg_internic" value="yes" <%=worksheet_bean
.getReg_internic_c("yes")%>>Yes <input type="radio" name="reg_inte
rnic" value="no" <%=worksheet_bean.getReg_internic_c("no")%>>No</td>
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Giri,
Your bean is within a package called net.sbcis.dn_worksheet . So, you have to create 3 physical dirs under .../web-inf/classes directory and place your bean's class there. In other words your WorksheetBean.class file must be placed like following.

Give it a try and let us know!
regds
maha anna
 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The bean is in the proper directory Maha.
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I simulated your package in my machine and able to run the jsp. No errors.
Are you able to run the examples which come with Tomcat itself? When you type http://localhost:8080, Tomcat main page will be displayed with links to 'Servlet' and 'JSP' examples. Are you able to run them properly?
What's your webAppContext Name? Did your bean class name exactly as 'WorksheetBean' (case sensitive!)
Here is my classpath setup line in c:\autoexec.bat

regds
maha anna

[This message has been edited by maha anna (edited March 20, 2001).]
 
Giri Prasad
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I redeployed everything again and the code is working fine. Don't know where I was wrong previously
Thanks to all
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to know [somehow ] we got it working. Sometimes its kind of annoying even if we get it working when we can't get convinced ourselves what went wrong. Isn't? It happened to me sometimes.
regds
maha anna
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If using Windows and you are setting your classpath statically in tomcat.bat, put this line in your tomcat.bat file.
if exist "%TOMCAT_HOME%\lib\servlet.jar" set CP=%CP%;%TOMCAT_HOME%\lib\servlet.jar
You can put a copy of the servlet.jar in the TOMCAT_HOME\lib directory.
Cheers,
Dave McQ.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic