The Artima Developer Community
Sponsored Link

Java Answers Forum
embedded jetty

2 replies on 1 page. Most recent reply: Jun 27, 2005 11:12 AM by Eddy Young

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
bailey

Posts: 2
Nickname: crue
Registered: Jun, 2005

embedded jetty Posted: Jun 25, 2005 9:14 PM
Reply to this message Reply
Advertisement
I am using jetty as embedded server as part of other application. The problem I have is I can't seem to start the server. The file (i'm pretty new to java, so this is probably a sloppy programming style):
----------
// import org.mortbay.jetty.Server; and all files dependecies needed
public class startserver {
public void starting() throws IOException {
Server server = new Server();
SocketListener listener = new SocketListener();
listener.setPort(9999); server.addListener(listener);
server.addWebApplication("localhost","root of the web app in physical dir");
try {
server.start();
} catch (MultiException e) {
throw new RuntimeException("Exception starting Jetty", e);
}
}

public static void main(String args[]) {
startserver ss = new startserver();
try {
ss.starting();
} catch (IOException o) {
throw new RuntimeException("Error...........", o);
}
}
}
------------------
This compiled fine, but the when I tried to execute, I got the exception error ('Exception starting Jetty' error) when trying to start the server. Any suggestion will be very much helpful.

Thx,
crue


bailey

Posts: 2
Nickname: crue
Registered: Jun, 2005

Re: embedded jetty Posted: Jun 26, 2005 6:45 PM
Reply to this message Reply
yeah... forgot to import one class that is used to start the server, it's working fine now. - crue

Eddy Young

Posts: 1
Nickname: jeyoung439
Registered: Jun, 2005

Re: embedded jetty Posted: Jun 27, 2005 11:12 AM
Reply to this message Reply
> I am using jetty as embedded server as part of other
> application. The problem I have is I can't seem to start
> the server. The file (i'm pretty new to java, so this is
> probably a sloppy programming style):
> ----------
> // import org.mortbay.jetty.Server; and all files
> dependecies needed
> public class startserver {
> public void starting() throws IOException {
> Server server = new Server();
> SocketListener listener = new SocketListener();
> listener.setPort(9999); server.addListener(listener);
> server.addWebApplication("localhost","root of the web
> eb app in physical dir");
> try {
> server.start();
> } catch (MultiException e) {
> throw new RuntimeException("Exception starting
> ion starting Jetty", e);
> }
> }
>
> public static void main(String args[]) {
> startserver ss = new startserver();
> try {
> ss.starting();
> } catch (IOException o) {
> throw new RuntimeException("Error...........",
> ..........", o);
> }
> }
> }
> ------------------
> This compiled fine, but the when I tried to execute, I got
> the exception error ('Exception starting Jetty' error)
> when trying to start the server. Any suggestion will be
> very much helpful.
>
> Thx,
> crue

You ha

Flat View: This topic has 2 replies on 1 page
Topic: Applets - Phased out in the near future? Previous Topic   Next Topic Topic: how to change HttpURLConnection to socket connection

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use