• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compiling the servlet

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam using JRun 3.0 Developer's Edition for Windows2000 and when i try to compile the servlet getting an error as
package javax.servlet does not exist
Here is my code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWeb extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>");
out.println("Hello Web");
out.println("</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("Hello Web!");
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
public void doPost (HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
doGet(request, response);
}
}
I try to compile the servlet under
E:\<JRun directory>\servers\default\default-app\WEB-INF\classes \HelloWeb.java
Any followup???
 
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure that j2ee.jar is in your classpath.
 
Neem Red
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not find any j2ee.jar under jrun, how should i go on with it.
 
Neem Red
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And also when i try to start the JRun Default Server getting a prompt as JRun exited abnormally.
Please check the JRun event log file.
Where is the JRun event log file placed under JRun.
Any help would be very much appreciated.
 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I've never used JRun.
But if you're getting package javax.servlet package does not exist, you need to include j2ee.jar in your CLASSPATH.
I have no idea if this ships with JRun, but can be downloaded from sun.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Neem Red,
You have to add
servlet.jar to your class path. Then it will works fine(According to my knowledge). You can find servlet jar in JRun directory/lib/ext. Try it and send me the result.
Padmaja Kalimireddy.
 
Neem Red
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Padmaja ,
Iam able to compile the servlet but when i try to start the JRun Default Server getting a prompt as JRun exited abnormally.
Please check the JRun event log file.
Where is the JRun event log file placed under JRun.
And also how do i go on looking a servlet in the browser.
Any help Padmaja?
 
Neem Red
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks alot padmaja now iam able to compile the servlets and
also able to open the servlet in the browser.
I have to specify the following URL http://localhost:8100/servlet/MyFirstServlet
But one thing is when i try to open the
JRun Default Server under JRun getting the same prompt as
JRun exited abnormally.
Please check the JRun event log file.
Look at this url: http://localhost:8000/quickStart/howdoi/servletStart.jsp it asks us to Ensure that the JRun default server is running.
before opening a http://localhost:8100/servlet/MyFirstServlet in the browser.
Any help???
 
Padmaja Kalimireddy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Neem Red,
Good to know that you are able to compile. I think if you can see the servlet in browser it means it is working. Am I correct? I am not sure about the abmormally exit of jrun. When I got similar error I reinstalled Jrun and somehow the problem has gone. I don't think that is the right solution.
Let me know if you find anything.

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually when we have gotten the JRun has exited abnormally message it means that somewhere there is another instance of JRun running on the same port. So if you installed JRun as a service that starts up automatically on port 8100, then you try and manually start JRun again on the same port, you will get this message.
If it doesn't look like there are are any other instances of JRun running, make sure and check in your task manager and see if there are any instances running that just didn't get shut down properly by the OS.
HTH
BRian
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
When I compile servlet, I got the similar error. I already include the jsdk.jar in classpath. What's the problem could be?
Thanks,
Mike
 
reply
    Bookmark Topic Watch Topic
  • New Topic