• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 407
  • Last Modified:

sample jsp via Tomcal

I wonder if someone could help me with the following questions.

This is a part of path for your consideration:
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\begjsp-ch04\classes

1. I have installed Tomcat and not sure how to start it.

2. When I reboot my computer, I get “Access is denied, Unable to open service 'Tomcat7' “
Is this my laptop firewall preventing it from running? What can I do to run Tomcat without turning off my security software off?

3. I have made a jsp page coppied to:
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\begjsp-ch04\classes\carPage2.jsp

4. There is also a Car class prepared not sure where it goes.

Any kind of help is appreciated.

Thank you,
0
Mike Eghtebas
Asked:
Mike Eghtebas
  • 2
  • 2
1 Solution
 
mrcoffee365Commented:
It looks as if you're following a book or tutorial -- which one?

Some answers:
>>C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\begjsp-ch04\classes

That path should have ROOT as part of it.  So you should create a subdirectory under webapps, like this:
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT\

Jsp pages -- things called xxx.jsp -- can be put in the ROOT directory

Under ROOT you need a WEB-INF directory
[tomcat home]\webapps\ROOT\WEB-INF
under WEB-INF goes the classes directory
[tomcat home]\webapps\ROOT\WEB-INF\classes
Also in WEB-INF goes the web.xml file for your webapp.  If you're working from a book or tutorial, there should be a sample web.xml file, something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
</web-app>

This is a nice tutorial on setting up Tomcat 7:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/
You don't have to use Eclipse, which is a Java development tool, but you're welcome to try it if you want.  The coreservlets.com site also gives directions for setup without Eclipse, which you could follow for your work.

Check if Tomcat is started and running correctly.  This is a good set of steps for that:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/test-server.html

>>2.  I get “Access is denied, Unable to open service 'Tomcat7' “
Yes, the normal install from Tomcat is to run as a service.  However, the user which tries to run it does not have sufficient privileges.  There are various solutions, see below for some options:
http://superuser.com/questions/284657/tomcat7-service-cannot-start-on-windows-7-even-when-it-is-set-to-log-in-as-admin

>>3.  jsp page
As mentioned above, a .jsp page should go someplace like this:
[tomcat home]\webapps\ROOT\xxx.jsp

>>4. Car class
I'm assuming that you mean a .jar class.  It's best to put it in the lib directory for your webapp:
[tomcat home]\webapps\ROOT\WEB-INF\lib
0
 
Sathish David Kumar NCommented:
>>>>>1. I have installed Tomcat and not sure how to start it.

go to  command promt C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin> java    -jar bootsriploader.jar


this will start your application . or you can use startup.bat in C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin folder
0
 
Sathish David Kumar NCommented:
>>>>>2. When I reboot my computer, I get “Access is denied, Unable to open service 'Tomcat7' “
Is this my laptop firewall preventing it from running? What can I do to run Tomcat without turning off my security software off?


this problem occur in windows 7 only its OS problem not tomcat problem jsut config ur tomcat in ur IDE(Net beans ) start and stop when you need .

try to create web application and write your code there dont put in tomcat . thats is for only deployment(after finish all your development you will put it there )

http://netbeans.org/kb/docs/web/mysql-webapp.html

http://netbeans.org/kb/docs/web/quickstart-webapps.html
0
 
mrcoffee365Commented:
Presumably your problem is fixed.  It's odd that you did not give the points to the first correct answer -- did you know that you can give it to the first person who answers, or to 2 people if you feel a second person contributed something different?  Just FYI for the next time you're interested in help from experts.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now