Results 1 to 8 of 8
- 06-21-2012, 04:50 AM #1
Senior Member
- Join Date
- Apr 2012
- Posts
- 199
- Rep Power
- 0
Debugging Dynamic Web App in Eclipse
Hello,
I was able to successfully access an example java application on a Tomcat v7 web server.
Now, I want to be able to the same thing for an application that I created (called PuzzleApp).
I initially tried to do so by updating the jnlp file and replacing the jar file with my PuzzleApp application. When I try to access the file using firefox, Webstart starts up, but then vanishes after a short while with no exception dialog box being displayed.
I need to debug what's going on between the Tomcat server and my application, but I don't know how to set up that debug environment in Eclipse.
Could some please point me in the right direction.
Thanks,
StephenLast edited by shall; 06-21-2012 at 08:38 PM.
- 06-21-2012, 10:13 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Debugging Dynamic Web App in Eclipse
I doubt you can, since the app isn't starting up.
Does your app have any logging in it?
What happens when you try and start your app from the command line (I'm assuming it's a jar)?Please do not ask for code as refusal often offends.
- 06-21-2012, 05:36 PM #3
Senior Member
- Join Date
- Apr 2012
- Posts
- 199
- Rep Power
- 0
Re: Debugging Dynamic Web App in Eclipse
Thanks for the reply.
It runs fine in Netbeans, but, just now when ran it from the command line the following exception occurs: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: URI is not hierarchical
The following code is at that line:
bookXmlURI as a string is (as run in Netbeans):Java Code:doc = docBuilder.parse(new File(bookXmlURI));
file:/C:/Users/earth/Documents/NetBeansProjects/PuzzleApp/build/classes/puzzleapp/PuzzlePieces/PuzzlePiecesInfo.xml
The absolute path may be a problem for the jar file.
How do I correct the problem?
- 06-21-2012, 06:07 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Debugging Dynamic Web App in Eclipse
You cannot access files in a jar file using the normal file system methods, as it is not a file system.
You need to access them using the <class>.getResource() or getResourceAsStream() methods.Please do not ask for code as refusal often offends.
- 06-21-2012, 08:07 PM #5
Senior Member
- Join Date
- Apr 2012
- Posts
- 199
- Rep Power
- 0
Re: Debugging Dynamic Web App in Eclipse
Actually, I did use getResource. Here's some more of the code:
Java Code:DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder; docBuilder = docBuilderFactory.newDocumentBuilder(); URL bookXmlURL = this.getClass().getResource(resourceName); URI bookXmlURI = bookXmlURL.toURI(); doc = docBuilder.parse(new File(bookXmlURI));
- 06-21-2012, 10:21 PM #6
Senior Member
- Join Date
- Apr 2012
- Posts
- 199
- Rep Power
- 0
Re: Debugging Dynamic Web App in Eclipse
Yahoooooo! (and I don't mean the website).
Thanks a lot. you pointed me in the right direction.
I replaced that big block of code above with the following:
InputStream is = getClass().getResourceAsStream(resourceName);
doc = docBuilder.parse(is);
After that modification, webstart was able to run the puzzleapp.
Running Jar files just do not act the same way as running class files.
StephenLast edited by shall; 06-21-2012 at 10:23 PM.
- 06-22-2012, 10:08 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Debugging Dynamic Web App in Eclipse
Yep, it was because you were taking the URI for the resource (which points to a thing in the jar file) and then hand that to a File, which will look for it on the file system.
Please do not ask for code as refusal often offends.
- 06-22-2012, 08:04 PM #8
Senior Member
- Join Date
- Apr 2012
- Posts
- 199
- Rep Power
- 0
Similar Threads
-
Eclipse Debugging Help
By kuttam in forum EclipseReplies: 5Last Post: 12-02-2011, 09:28 AM -
Debugging with Eclipse 3.4.0
By edcaru in forum New To JavaReplies: 2Last Post: 11-07-2008, 06:27 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks