Results 1 to 8 of 8
Thread: Web Application not found
- 07-27-2008, 09:24 PM #1
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
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
- 07-27-2008, 10:42 PM #2
It looks like there is a problem finding client in client.jarclient.jar!/client
Check the jar file.
- 07-27-2008, 11:48 PM #3
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
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?
- 07-28-2008, 12:21 AM #4
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
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
- 07-28-2008, 12:53 AM #5
Sorry, I'm not familiar with the BOOTSTRAP program you mention.!/rivy/web/boot/client}
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.
- 07-28-2008, 01:47 AM #6
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
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();
}
- 07-28-2008, 01:59 AM #7
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
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?
- 07-28-2008, 02:05 AM #8
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
GeoPoint Not found
By nvidia in forum NetBeansReplies: 2Last Post: 05-28-2008, 09:31 PM -
symbol not found error
By rmartyce in forum New To JavaReplies: 1Last Post: 05-23-2008, 05:58 AM -
could not be found in the registry
By alam99 in forum EclipseReplies: 0Last Post: 01-08-2008, 08:21 AM -
404 Not Found
By mary in forum Java ServletReplies: 5Last Post: 11-07-2007, 10:15 AM -
ConnectException not found
By tamayo in forum New To JavaReplies: 1Last Post: 07-23-2007, 08:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks