Stefano,

Which IDE are you using? Most don't require an extra class, you can usually
just include the webserver.jar and servlet.jar in the classpath and specify
com.sun.web.shell.Startup as the start class.

J++ can certainly do this.

>From memory, VCafe can't specify a start class that isn't in the project (ie
that you have source for?), although this may be changed now....

Geoff

-----Original Message-----
From: Stefano Locati <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, 2 September 1999 18:33
Subject: Debugging in any IDE and jswdk-1.0


>Dear friends on this mailing list,
>
>This is my first post here. My name is Stefano Locati, I'm from Italy
>where I'm studying computer science at the university and I'm doing my
>final work.
>
>I'm trying to debug servlets using my ide, and I've read the thread on
>this mailing list. From the post <The
>"Debug-your-servlet-in-any-IDE"-tutorial> of Christof Baumgaertner
><[EMAIL PROTECTED]> dated back 10 Sep
>1998 there is a simple stub to start the little webserver contained in
>the package sun.servlet.http.*.
>
>Since I'm using jswdk-1.0 I've noted that the package name has changed
>to com.sun.web.server.* and also the api has changed. So the program
>doesn't work with a simple import change. Unfortunately this api doesn't
>seem to be documented, so I've used the etc/SimpleStartup.java example
>and modified it. The initialization gave me a null pointer exception
>that I could easily solve, but any connection to the server gives me
>this error message (on the browser). Anyone can help me?
>
>-The error message-
>Error: 500
>
>Internal Servlet Error:
>
>java.lang.NoSuchMethodError: javax.servlet.ServletContext: method
>getResource(Ljava/lang/String;)Ljava/net/URL; not found
>        at com.sun.web.core.DefaultServlet.doGet(DefaultServlet.java:54)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
>        at
>com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155)
>        at com.sun.web.core.Context.handleRequest(Context.java:414)
>        at
>com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139)
>
>-The source-
>
>import com.sun.web.core.*;
>import com.sun.web.server.*;
>import java.net.*;
>
>public class ServletTester
>{
>
>    /** Starts the server */
>    public static void main(String[] args)
>    {
>        int port = 8080;
>        InetAddress inet = null; // null uses all inets on the machine
>        String hostname = "locati";
>        HttpServer server = new HttpServer(port, inet, hostname);
>        try {
>            URL url = resolveURL("../../public");
>            server.setDocumentBase(url);
>            System.out.println("Starting with docbase of: " + url);
>            server.start();
>        } catch (MalformedURLException mue) {
>            System.out.println("Malformed URL Exception for doc root");
>            System.out.println(mue.getMessage());
>        } catch (HttpServerException hse) {
>            System.out.println("Server threw an exception");
>            System.out.println(hse.getMessage());
>        }
>        file://when you want to stop the server, simply call
>        file://server.stop();
>    }
>
>    /** Builds an absolute url from a relative one, or does nothing if
>     *  the url already contains :/
>     */
>    private static URL resolveURL(String s) throws MalformedURLException
>
>    {
>        file://if the string contains the magic :/, then we assume
>        file://that it's a real URL and do nothing
>        if (s.indexOf(":/") > -1) {
>            return new URL(s);
>        }
>        file://otherwise, we assume that we've got a file name and
>        file://need to construct a file url appropriately.
>        if (s.startsWith("/")) {
>            return new URL("file", null, s);
>        } else {
>            String pwd = System.getProperty("user.dir");
>            return new URL("file", "", pwd + "/" + s);
>        }
>    }
>
>}
>----
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to