Solved

sample jsp via Tomcal

Posted on 2012-03-24
4
387 Views
Last Modified: 2012-03-28
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
Comment
Question by:Mike Eghtebas
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:mrcoffee365
ID: 37762945
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
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37764568
>>>>>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
 
LVL 20

Accepted Solution

by:
Sathish David  Kumar N earned 500 total points
ID: 37764595
>>>>>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
 
LVL 26

Expert Comment

by:mrcoffee365
ID: 37778387
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now