• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Stuck on MVC BeeServlet Example

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm stuck getting the MVC BeeServlet example to work. Here's what I have so far.

- I copied jr.jar to /usr/local/tomcat/lib/

- I copied Bee.jsp to /usr/local/tomcat/webapps/ROOT/

- I compile BeeServlet using -classpath /usr/local/tomcat/lib/servlet-api.jar
This gives me BeeServlet.class, BeeServlet$1.class, and BeeServlet$Default.class.
(Does jr.jar also need to be in the classpath?)

- I move the three class files to /usr/local/tomcat/webapps/ROOT/WEB-INF/classes

- I point my browser to http://localhost:8080/servlet/BeeServlet and get HTTP Status 500, The Server encountered an internal error etc.

- I also tried putting the three class files in /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/com/javaranch/drive/ and then point my browser to http://localhost:8080/servlet/com/javaranch/drive/BeeServlet and get HTTP Status 404 - requested resource is not available.

Any help would be most appreciated!

Thanks.
- Dan
 
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- I also tried putting the three class files in /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/com/javaranch/drive/ and then point my browser to http://localhost:8080/servlet/com/javaranch/drive/BeeServlet and get HTTP Status 404 - requested resource is not available.
[/i]
404 - page not found. Did you copy the jsp to the server?
 
Daniel Loranz
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Daniel Loranz:

- I copied Bee.jsp to /usr/local/tomcat/webapps/ROOT/



Bee.jsp is the JSP - correct?
 
Marilyn de Queiroz
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that should be bee.jsp ... case is important in java.
 
Marilyn de Queiroz
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Daniel Loranz:
- I compile BeeServlet using -classpath /usr/local/tomcat/lib/servlet-api.jar
This gives me BeeServlet.class, BeeServlet$1.class, and BeeServlet$Default.class.
(Does jr.jar also need to be in the classpath?)



It appears that you have jr.jar in your compile classpath, else you wouldn't be getting those class files.

You'll be happy to hear that ant makes all this much simpler (when you get that far).
 
Daniel Loranz
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dang! I totally missed the lowercase 'b' on that. Thanks.

I haven't had a chance to try it out with the correct name yet - been in class and meetings all day. I'll try it out tomorrow.

Thanks again!
 
Daniel Loranz
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK - still stuck getting MVC flavor of BeeServlet to work. Just taking things one at a time ...


The following does NOT compile.
javac BeeServlet.java -classpath /usr/local/tomcat/lib/jr.jar

The following appears to compile just fine - but I don't understand why I don't need to include the jr.jar.
javac BeeServlet.java -classpath /usr/local/tomcat/lib/servlet-api.jar

The following also appears to compile fine.
javac BeeServlet.java -classpath /usr/local/tomcat/lib/jr.jar:/usr/local/tomcat/lib/servlet-api.jar

In no case am I successful in the next step - pointing my browser to BeeServlet and seeing the result. Is something weird happening in the compilation step? Again, I was surprised the compiler seemed OK if I left off the jr.jar classpath.

Thanks.
- Dan
 
Marilyn de Queiroz
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jr.jar depends on the servlet stuff
I'm guessing you already have jr.jar in your classpath, although I thought that the '-classpath' overrode the original classpath... maybe that has changed.

"In no case am I successful in the next step - pointing my browser to BeeServlet and seeing the result."

You can look for clues in your server logs ...
Are you getting errors? blank page? 404?
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic