Jetty

Jetty Maven Plugin 7.0.0.1beta2 has problems with spaces in class path resource references

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Maven
  • Labels:
    None
  • Environment:
    jetty-maven-plugin:7.0.0.1beta2, windows xp sp3
  • Number of attachments :
    0

Description

I was trying out jetty-maven-plugin:7.0.0.1beta2 and encountered a bug when jetty is being started (using deploy-war mojo). Here is the relevant stack trace snippet:

java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/s.slavic/.m2/repository/org/mortbay/jetty/jetty-maven-plugin/7.0.0.1beta2/jetty-maven-plugin-7.0.0.1beta2.jar
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at java.net.URL.toURI(URL.java:918)
at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:79)
at org.mortbay.jetty.plugin.MavenWebInfConfiguration.preConfigure(MavenWebInfConfiguration.java:39)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:343)
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:56)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:164)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:56)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:164)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:56)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
at org.eclipse.jetty.server.Server.doStart(Server.java:225)
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:69)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:56)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:423)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:366)
at org.mortbay.jetty.plugin.JettyRunWarMojo.execute(JettyRunWarMojo.java:68)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)

Issue Links

Activity

Hide
Stevo Slavic added a comment -

Can not edit the issue to append to the environment details, so I'm adding this through a comment, maven 2.1.0 was used.

Show
Stevo Slavic added a comment - Can not edit the issue to append to the environment details, so I'm adding this through a comment, maven 2.1.0 was used.
Hide
Jan Bartel added a comment -

Pasting from the jetty-dev list:

From: Jan Bartel
Date: 4 July 2009
Stevo,

Darn! This is a bit problematic. It appears the problem is that the
maven is not escaping the jar urls it adds onto its classpath. Here's the bug:

http://jira.codehaus.org/browse/MNG-3607

As the downstream user of a URLClassloader, I don't believe I have
any way of knowing if the urls in it have already been escaped or not.
The only idea that occurs to me at the moment is for the jetty plugin
to create a fresh classloader as a child of the system classloader and
then populate it with the (url escaped) plugin dependencies and use that as the parent classloader of the webapp. I think some people have asked
for that in the past anyway, so maybe it's the way to go.

Does anybody else have any other suggestions?

Show
Jan Bartel added a comment - Pasting from the jetty-dev list: From: Jan Bartel Date: 4 July 2009 Stevo, Darn! This is a bit problematic. It appears the problem is that the maven is not escaping the jar urls it adds onto its classpath. Here's the bug: http://jira.codehaus.org/browse/MNG-3607 As the downstream user of a URLClassloader, I don't believe I have any way of knowing if the urls in it have already been escaped or not. The only idea that occurs to me at the moment is for the jetty plugin to create a fresh classloader as a child of the system classloader and then populate it with the (url escaped) plugin dependencies and use that as the parent classloader of the webapp. I think some people have asked for that in the past anyway, so maybe it's the way to go. Does anybody else have any other suggestions?
Hide
Jan Bartel added a comment -

Pasting from the jetty-dev list:

From: Jesse McConnell
Date: 4th July 2009

We can also set the minimum maven version to 2.1 since the issue seems
to indicate the old 2.0.x series are only ones effected..

Show
Jan Bartel added a comment - Pasting from the jetty-dev list: From: Jesse McConnell Date: 4th July 2009 We can also set the minimum maven version to 2.1 since the issue seems to indicate the old 2.0.x series are only ones effected..
Hide
Jan Bartel added a comment -

Pasting from the jetty-dev list:

From: Stevo Slavic
Date: 5th July 1009

Sorry, I forgot to enter maven version for the Jetty issue (added now as comment), maven 2.1.0 was used when issue occurred, so even though maven issue (for which I just voted) was reported for 2.0.9, it's present in 2.1.0 as well. By the "fix version" value, it won't be fixed before maven 3 is out, so until then a workaround is needed.

Show
Jan Bartel added a comment - Pasting from the jetty-dev list: From: Stevo Slavic Date: 5th July 1009 Sorry, I forgot to enter maven version for the Jetty issue (added now as comment), maven 2.1.0 was used when issue occurred, so even though maven issue (for which I just voted) was reported for 2.0.9, it's present in 2.1.0 as well. By the "fix version" value, it won't be fixed before maven 3 is out, so until then a workaround is needed.
Hide
Jan Bartel added a comment -

Stevo,

The quick workaround is to move your m2 repo directory to be in a place without spaces in the folder names.

As this issue is caused by a problem with maven, and one that is slated to be fixed, I can't really justify prioritizing
re-writing the whole classloading mechanism for the jetty plugin very highly. I realize its a bit of a pain,
but if you move your m2 repo to a location without spaces, then most probably you'll avoid a whole bunch
of other problems using maven too.

Of course, if a gazillion jetty users vote for this issue, then that would help boost the priority I guess

cheers
Jan

Show
Jan Bartel added a comment - Stevo, The quick workaround is to move your m2 repo directory to be in a place without spaces in the folder names. As this issue is caused by a problem with maven, and one that is slated to be fixed, I can't really justify prioritizing re-writing the whole classloading mechanism for the jetty plugin very highly. I realize its a bit of a pain, but if you move your m2 repo to a location without spaces, then most probably you'll avoid a whole bunch of other problems using maven too. Of course, if a gazillion jetty users vote for this issue, then that would help boost the priority I guess cheers Jan
Hide
Stevo Slavic added a comment -

Understood, this is a Maven issue, so AFAIAC this issue can be closed.

Show
Stevo Slavic added a comment - Understood, this is a Maven issue, so AFAIAC this issue can be closed.
Hide
Jan Bartel added a comment -

Whew, I'm happy to close this one too

Jan

Show
Jan Bartel added a comment - Whew, I'm happy to close this one too Jan
Hide
Khayretdinov Dmitriy added a comment -

at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:79)
containerUris[i++] = new URI(u.toString().replaceAll(" ", "%20"));

Show
Khayretdinov Dmitriy added a comment - at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:79) containerUris[i++] = new URI(u.toString().replaceAll(" ", "%20"));
Hide
ian pojman added a comment -

Looks like someone provided a change, can it be fixed?

Show
ian pojman added a comment - Looks like someone provided a change, can it be fixed?
Hide
David Smiley added a comment -

If this is going to closed and considered a maven bug, then please point to the maven bug issue URL. I'm using the latest Maven 2.2.1 and the problem is still here.

Show
David Smiley added a comment - If this is going to closed and considered a maven bug, then please point to the maven bug issue URL. I'm using the latest Maven 2.2.1 and the problem is still here.
Hide
Jan Bartel added a comment -

David,

In my first response on 23 August 2009 I posted the link to the maven issue. Here it is again for your convenience:
http://jira.codehaus.org/browse/MNG-3607

Note that the maven project has fixed this for maven-3, but not backported to maven-2.

regards
Jan

Show
Jan Bartel added a comment - David, In my first response on 23 August 2009 I posted the link to the maven issue. Here it is again for your convenience: http://jira.codehaus.org/browse/MNG-3607 Note that the maven project has fixed this for maven-3, but not backported to maven-2. regards Jan
Hide
Khayretdinov Dmitriy added a comment -

It is not the maven problem that is an old java bug.
URL.toURI() it doesn't work properly. Use the following code to fix this problem:
new URI(url.toString().replaceAll(" ", "%20"))

Show
Khayretdinov Dmitriy added a comment - It is not the maven problem that is an old java bug. URL.toURI() it doesn't work properly. Use the following code to fix this problem: new URI(url.toString().replaceAll(" ", "%20"))
Hide
Jan Bartel added a comment -

Putting a fix into jetty that should only kick in if a uri format exception happens.

Show
Jan Bartel added a comment - Putting a fix into jetty that should only kick in if a uri format exception happens.
Hide
Jan Bartel added a comment -

Fix in jetty 7 r 2296.

Only applied %20 escape if URI format exception occurs.

Show
Jan Bartel added a comment - Fix in jetty 7 r 2296. Only applied %20 escape if URI format exception occurs.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: