Results 1 to 8 of 8
  1. #1
    adtd8 is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default Web Application not found

    I have this web application which I run with jetty. I also this Bootstrap.java class which is responsible for starting jetty as embedded. Whenever I run the Bootstrap class, everything works fine. However if I package everything in a jar file, all of the sudden I get an error message saying

    Web application not found
    /home/andi/Documents/projects/rivy/RIVY_DEV/file:/home/andi/
    Documents/projects/rivy/RIVY_DEV/client.jar!/client


    Can anyone tell me why this is, and if there is anyway how to make it find the web application?

    Thanks a lot

    -a

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,410
    Rep Power
    25

    Default

    client.jar!/client
    It looks like there is a problem finding client in client.jar
    Check the jar file.

  3. #3
    adtd8 is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    client is the web application that the Bootstrap checks for by:
    URL url = Bootstrap.class.getResource("client")

    and it finds it.
    Also whenever I extract the jar file, "client" is indeed there .

    Any other ideas to why it's not finding it?

  4. #4
    adtd8 is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    I just wanted to add this to show the difference when i run the application directly by calling the Bootstratp, and when I try to run the Bootstrap inside the jar.

    //running the Bootstrap
    $ java rivy.web.boot.Bootstrap
    2008-07-27 15:14:57.915::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
    2008-07-27 15:14:57.999::INFO: jetty-6.1.x
    2008-07-27 15:14:57.261::INFO: Started
    SelectChannelConnector: localhost:9092

    //running Bootstrap inside the jar
    $ java -jar client.jar
    2008-07-27 15:17:05.292::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
    2008-07-27 15:17:05.378::INFO: jetty-6.1.x
    2008-07-27 15:17:05.443::WARN: Web application not found /home/andi/Documents/projects/rivy/RIVY_DEV/file:/home/andi/Documents/projects/rivy/RIVY_DEV/client.jar!/rivy/web/boot/client
    2008-07-27 15:17:05.443::WARN: Failed startup of context org.mortbay.jetty.webapp.WebAppContext 14fe5c{/,/home/andi/Documents/projects/rivy/RIVY_DEV/file:/home/andi/Documents/projects/rivy/RIVY_DEV/client.jar!/rivy/web/boot/client}
    java.io.FileNotFoundException: /home/andi/Documents/projects/rivy/RIVY_DEV/file:/home/andi/Documents/projects/rivy/RIVY_DEV/client.jar!/rivy/web/boot/client
    at org.mortbay.jetty.webapp.WebAppContext.resolveWebA pp(WebAppContext.java:945)
    at org.mortbay.jetty.webapp.WebAppContext.getWebInf(W ebAppContext.java:779)
    at org.mortbay.jetty.webapp.WebInfConfiguration.confi gureClassLoader(WebInfConfiguration.java:62)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(Web AppContext.java:444)
    at org.mortbay.component.AbstractLifeCycle.start(Abst ractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStar t(HandlerCollection.java:152)
    at org.mortbay.component.AbstractLifeCycle.start(Abst ractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(H andlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(Abst ractLifeCycle.java:39)
    at rivy.web.boot.Bootstrap.startJetty(Bootstrap.java: 56)
    at rivy.web.boot.Bootstrap.main(Bootstrap.java:29)
    2008-07-27 15:17:05.463::INFO: Started SelectChannelConnectorlocalhost:9092

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,410
    Rep Power
    25

    Default

    !/rivy/web/boot/client}
    Sorry, I'm not familiar with the BOOTSTRAP program you mention.

    The message above shows client to be in package path.
    Is that correctly set in the jar file?
    If you run the program from disk files in folders and it works, that would mean that the client class is properly placed. When you put it in the jar file, you must preserve the package path.

  6. #6
    adtd8 is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    Bootstrap is actually just a java class that stars up jetty.

    here is Bootstrap.java

    public class Bootstrap {

    public static void main(String[] args) throws Exception {
    Bootstrap bs = new Bootstrap();
    bs.startJetty();
    }

    private void startJetty() throws Exception {
    Server server = new Server(9092);
    Connector connector = new SelectChannelConnector();

    connector.setPort(9092);
    connector.setHost("localhost");

    server.setConnectors(new Connector[] {connector});

    WebAppContext webappcontex = new WebAppContext();
    webappcontex.setContextPath("/");

    URL warFile = Bootstrap.class.getResource("client");
    if(warFile == null) {
    System.out.println("ERROR, client not found");
    System.exit(-1);
    }

    webappcontex.setWar(new File( warFile.getPath()).getAbsolutePath());

    HandlerList handler = new HandlerList();
    handler.setHandlers(new Handler[]{webappcontex, new DefaultHandler()});
    server.setHandler(handler);

    server.start();
    }

  7. #7
    adtd8 is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    I believe the client directory is place in the right place in the jar file because even after I place everything inside the jar, if I take the jar in a completely different location and then extract the jar, then if i would run the Bootrstrap it works.

    As you said it works if I am running when not in the jar but i am not sure what is causing it to not see client inside the jar.

    If you look at the code, it never crashes when I check if the the variable warFile is null which tells me that it sees that..

    I observed from my debugging that up to the last step "server.start()" it never crashes, and then as soon as i uncomment the line server.start(), that's when it throws the error

    Do i need to add "client" to the class path in the manifest file?

  8. #8
    adtd8 is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    Does my jar syntax lool correct?

    <jar jarfile="${client.file}"
    basedir="${build.dir}/${war.dir}"
    update="yes"
    duplicate="fail">
    <manifest>
    <attribute name="Built-By" value="${user.name}"/>
    <attribute name="Main-Class" value="rivy.web.boot.Bootstrap"/>
    </manifest>
    </jar>

Similar Threads

  1. GeoPoint Not found
    By nvidia in forum NetBeans
    Replies: 2
    Last Post: 05-28-2008, 09:31 PM
  2. symbol not found error
    By rmartyce in forum New To Java
    Replies: 1
    Last Post: 05-23-2008, 05:58 AM
  3. could not be found in the registry
    By alam99 in forum Eclipse
    Replies: 0
    Last Post: 01-08-2008, 08:21 AM
  4. 404 Not Found
    By mary in forum Java Servlet
    Replies: 5
    Last Post: 11-07-2007, 10:15 AM
  5. ConnectException not found
    By tamayo in forum New To Java
    Replies: 1
    Last Post: 07-23-2007, 08:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •