aspose file tools*
The moose likes Cattle Drive and the fly likes Stuck on MVC BeeServlet Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Stuck on MVC BeeServlet Example" Watch "Stuck on MVC BeeServlet Example" New topic
Author

Stuck on MVC BeeServlet Example

Daniel Loranz
Ranch Hand

Joined: Jun 17, 2008
Posts: 41
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
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
- 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?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Daniel Loranz
Ranch Hand

Joined: Jun 17, 2008
Posts: 41
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

Joined: Jul 22, 2000
Posts: 9043
    
  10
I believe that should be bee.jsp ... case is important in java.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
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

Joined: Jun 17, 2008
Posts: 41
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

Joined: Jun 17, 2008
Posts: 41
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

Joined: Jul 22, 2000
Posts: 9043
    
  10
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?
 
Consider Paul's rocket mass heater.
 
subject: Stuck on MVC BeeServlet Example
 
Similar Threads
unable to compile
problem with first servlet
simple question
Ant building error
error javac + javaee.jar : custom classpath