This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Now when i use http://localhost:8080/Beer-v1/form.html and click on the submit button to invoke the servlet, then instead of invoking the servlet it give the following exception.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class com.example.web.BeerSelect or a class it depends on org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) java.lang.Thread.run(Unknown Source)
*********
Now i have checked that BeerSelect class is present in Tomcat 5.0\webapps\Beer-v1\WEB-INF\classes\com\examples\web, so i dont know what to do next...
After you compiled the servlet and copied it into the Tomcat 5.0\webapps\Beer-v1\WEB-INF\classes\com\examples\web directory and saved the web.xml file. did you restart Tomcat?
if not go to Start->Settings->Control Panel->Administrative Tools->Services Highlight Apache Tomcat (2nd entry in my list) and go to Action->restart
once it has restarted give it 5 seconds and then in a new browser window type in the url to the form.html page again and try clicking the button. It may be that Tomcat just has not loaded the servlet.
Plz ensure that u've placed the .class file in the correct location.If you are following the same package structure as given in the code then see to that BeerSelect.class file is placed in WEB-INF/classes/com/example/web. It should work if u assert the above case.
Hope it helps!!
Regards, Priya.
Mannu hak
Ranch Hand
Joined: Apr 26, 2005
Posts: 50
posted
0
Hi Mat and Priya,
Thanks for replying...But i have already looked into those pitfalls...
Anyway, I am in the office now, will give it a try after going home in the evening and then might come back for help.
Mannu hak
Ranch Hand
Joined: Apr 26, 2005
Posts: 50
posted
0
ok, guys I'm back.
Its still not working for me... any suggestions....
Mat Williams
Ranch Hand
Joined: Jul 20, 2005
Posts: 215
posted
0
Hi,
wow more ideas , it works here for me so I guess that is is either something is in the wrong spot, or there is an error somewhere, cos I have done something different without realising it.
Is there an error in the logs that will shed some light on things. The easiest way is to stop the tomcat service. open a explorer window in {tomcat installation directory}\logs and delete all the files. then restart tomcat and see if there are any errors reported in the log files, they would probably be in the stdout.log file. It is worth noting that the stdout.log file takes, depending on the speed of your pc, 10 seconds or so to be fully populated after restarting Tomcat.
The reason I suggest that you stop Tomcat and delete the logs is that sometimes old errors can confuse the situation more, so best to start with a clean slate.
i got the same problem as you as i first time click on "submit" button. And it gave me exceptions page as you mentioned..but then i check my path and tomcat service...
i stop tomcat, and restart it in the Control Panel path that you taught me one...remember??? right-click and select "restart". ------------------------------------------------------------ here is what under Tomcat directory ----------------------------------- my BeerSelect class = C:\Tomcat_5.5\webapps\Beer-v1\WEB-INF\classes\com\example\web
my web.xml = C:\Tomcat_5.5\webapps\Beer-v1\WEB-INF
my form.html = C:\Tomcat_5.5\webapps\Beer-v1
---------------------------------------------- here is what under development directory ------------------------------------------ my form.html = C:\MyProjects\beerV1\web
my web.xml = C:\MyProjects\beerV1\etc
my BeerSelect java file = C:\MyProjects\beerV1\src\com\example\web
my BeerSelect class file = C:\MyProjects\beerV1\classes\com\example\web
i guess this is it ....i follow exactly what HFSJ said....esp the page 72 and 73. i look for that 2 pages for so many times....haha...
well...hope you can "heal" the problem you facing...okay.....all the best...
From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Nicky Eng
Ranch Hand
Joined: Mar 26, 2005
Posts: 378
posted
0
i have a question. i dont wanna open a new thread, so i just continue with this thread, do you mind, Mannu?
when i compile the "BeerExpert.java", every path was correct, but after compile it, it give me something like this :
what is that means??? anyone know???
[ September 13, 2005: Message edited by: Nicky Eng ] [ September 13, 2005: Message edited by: Nicky Eng ]
Mat Williams
Ranch Hand
Joined: Jul 20, 2005
Posts: 215
posted
0
Hi Nicky,
from memory you have Java 1.5 installed, if that is correct then I found this on the sun java forums site - it should explain things far better than I could.
these messages occur when you are using classes that support the new J2SE 1.5 feature - generics. You get them when you do not explicitly specify the type of the collection's content.
For example:
List l = new ArrayList(); list.add("String"); list.add(55);
If you want to have a collection of a single data type you can get rid of the messages by:
List<String> l = new ArrayList<String>(); list.add("String");
If you need to put multiple data types into once collection, you do:
List<Object> l = new ArrayList<Object>(); list.add("String"); list.add(55);
If you add the -Xlint:unchecked parameter to the compiler, you get the specific details about the problem.
HTH
Mat
Mannu hak
Ranch Hand
Joined: Apr 26, 2005
Posts: 50
posted
0
got it working guys...
can't belive i was doing such a stupid mistake...
I had wrongly named my example folder as examples
thanks guys..
Mat Williams
Ranch Hand
Joined: Jul 20, 2005
Posts: 215
posted
0
Hi,
Well done - those sorts of problems are really really annoying when they happen. Well spotted.
Mat
Nicky Eng
Ranch Hand
Joined: Mar 26, 2005
Posts: 378
posted
0
hi Mat, thanks for your explanation...now i understand...thanks alot.
by the way, i know there is a topic where a guy having problem when compiling "BeerSelect.java" (version 2), stated that :
import com.example.model.*; <---------------give me "package does not exits" error
BeerExpert.java --------------------------------
BeerSelect.java ------------------
so i am facing the same problem...from yesterday until i try to check, fix...but no solution.....is it really classpath issue???