Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ResourceServlet throws "java.lang.IllegalArgumentException: URI is not hierarchical" on JB
ResourceServlet throws "java.lang.IllegalArgumentException: URI is not hierarchical" on JB [message #892216] Wed, 27 June 2012 12:31 Go to next message
Thomas  Küstermann is currently offline Thomas Küstermann
Messages: 5
Registered: June 2012
Junior Member
Hi,

My RAP application (1.4.2, 1.5-RC3) is deployed as war onto a JBoss AS 5.1.2.ER2. The AS ships with a custom file protocol url handler [1] that essentially performs the following operation in order to open a connection to a file url:

this.file = new File(url.toURI());


When a resource is requested, e.g the favicon, I receive the following exception on the console:

ERROR [[equinoxbridgeservlet]] Servlet.service() for servlet equinoxbridgeservlet threw exception
java.lang.IllegalArgumentException: URI is not hierarchical
	at java.io.File.<init>(File.java:363)
	at org.jboss.net.protocol.file.FileURLConnection.<init>(FileURLConnection.java:62)
	at org.jboss.net.protocol.file.Handler.openConnection(Handler.java:40)
	at java.net.URL.openConnection(URL.java:945)
	at org.eclipse.equinox.http.servlet.internal.ResourceServlet$1.run(ResourceServlet.java:63)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.equinox.http.servlet.internal.ResourceServlet.writeResource(ResourceServlet.java:60)
	at org.eclipse.equinox.http.servlet.internal.ResourceServlet.service(ResourceServlet.java:50)
        ... and more ...


I tracked the problem down to org.eclipse.rap.rwt.osgi.internal.HttpContextWrapper#getResource(String) which seems to generate a wrong resource URL, e.g file:C:/path/to/resource/favicon.png instead of file:/C:/path/to/resource/favicon.png.

File file = new File( name );
if( file.exists() && !file.isDirectory() ) {
    result = new URL( "file", "", name );
}


Is this a bug that has to fixed in RAP?

Thanks for any advise,
Thomas

[1] repository.jboss.org/nexus/index.html#nexus-search;gav~org.jboss~jboss-common-core~2.2.18.GA~jar~
Re: ResourceServlet throws &quot;java.lang.IllegalArgumentException: URI is not hierarchical& [message #892313 is a reply to message #892216] Wed, 27 June 2012 17:07 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1290
Registered: July 2009
Senior Member

Hi Thomas,

this sounds like a bug. I guess the URL should be created using
File.toURI().toURL().

Could you please report it in our bugzilla [1]?

Thanks,
Ralf

[1] http://eclipse.org/bugs/


--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: ResourceServlet throws &quot;java.lang.IllegalArgumentException: URI is not hierarchical& [message #892314 is a reply to message #892313] Wed, 27 June 2012 17:09 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1290
Registered: July 2009
Senior Member

> [1] http://eclipse.org/bugs/

.... sorry, wrong URL. It's http://eclipse.org/rap/bugs/


--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: ResourceServlet throws &quot;java.lang.IllegalArgumentException: URI is not hierarchical& [message #892395 is a reply to message #892314] Thu, 28 June 2012 06:03 Go to previous message
Thomas  Küstermann is currently offline Thomas Küstermann
Messages: 5
Registered: June 2012
Junior Member
Created bug 383718 (bugs.eclipse.org/bugs/show_bug.cgi?id=383718)
Previous Topic:Problem accessing /rap. Reason: ProxyServlet: /rap HTTP ERROR 404
Next Topic:[ANN] RAP 1.5 released
Goto Forum:
  


Current Time: Mon Sep 22 02:27:25 GMT 2014

Powered by FUDForum. Page generated in 0.02384 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software