You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/06/30 22:48:45 UTC
[Bug 58086] New: Deploy WAR file using http:// throws
FileNotFoundException
https://bz.apache.org/bugzilla/show_bug.cgi?id=58086
Bug ID: 58086
Summary: Deploy WAR file using http:// throws
FileNotFoundException
Product: Tomcat 7
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: Manager
Assignee: dev@tomcat.apache.org
Reporter: ljaderdev@gmail.com
Hi all.
I have an Ant target which deploys WAR file to Tomcat7 instance using taskdef
for DeployTask class.
WAR file is passed as URL - http://
I'm executing this on Windows 7 64bit with JDK 1.7
Sample part of failing target:
<tomcat-deploy url="http://localhost:8080/manager/text" path="/testdeploy"
war="http://server.pl/app.war"
username="user" password="pass"
failOnError="true" logerror="true"/>
This execution fails and exception is thrown (sorry for Polish message):
test_deploy.xml:37: java.io.FileNotFoundException: http:\server.pl\app.war
(Nazwa pliku, nazwa katalogu lub skladnia etykiety woluminu jest niepoprawna)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:155)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
== Question ==
Does implementation of DeployTask is incorrect?
I think there is error in content of this "if" - I think it should be replaced
with "else" code:
https://github.com/apache/tomcat/blob/trunk/java/org/apache/catalina/ant/DeployTask.java#L143
Or I am using this task the wrong way?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 58086] Deploy WAR file using http:// throws
FileNotFoundException
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58086
Lukasz Jader <lj...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |---
Status|RESOLVED |REOPENED
--- Comment #2 from Lukasz Jader <lj...@gmail.com> ---
@Violeta Georgieva
I'm searching a little bit more about this and I found out,
that this is much more complicated issue - sorry for misleading you.
Previous implementation worked for all kind of local filesystem files, because
when:
a) war="C:/Users/john/app.war"
was loaded using FileInputStream
b) war="file:/C:/Users/john/app.war"
was loaded using URL and URLConnection (effectively FileURLConnection)
But it does not worked other protocols (ex. "http", "https"),
since it tried to load them using "FileInputStream".
Current implementation (AFTER FIX) does NOT WORK for any of local filesystem
files, because when:
a) war="C:/Users/john/app.war"
was loaded using URL and URLConnection - and the exception is thrown
java.net.MalformedURLException: no protocol
b) war="file:/C:/Users/john/app.war"
was is loaded using FileInputStream, which in constructor uses java.io.File,
which incorrectly handles files URIs in different situations:
https://weblogs.java.net/blog/kohsuke/archive/2007/04/how_to_convert.html
http://bugs.java.com/view_bug.do?bug_id=5086147
https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#toFile%28java.net.URL%29
I don't see any quick solution to this fix :(.
I think the best way would be reverting previous commit and figuring out
how to implement this.
For my own needs I've dirty fixed this problem to:
if (war.startsWith("file:") || war.startsWith("http:") ||
war.startsWith("https:")) {
//execute the URL code
} else {
//execute the File code as fallback
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 58086] Deploy WAR file using http:// throws
FileNotFoundException
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58086
Violeta Georgieva <vi...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Violeta Georgieva <vi...@apache.org> ---
Hi,
Thanks for the testing.
The new fix was made available in trunk, in 8.0.x for 8.0.25 and in 7.0.x for
7.0.64 onwards.
Regards,
Violeta
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 58086] Deploy WAR file using http:// throws
FileNotFoundException
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58086
Violeta Georgieva <vi...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Violeta Georgieva <vi...@apache.org> ---
Hi,
Fix was made available in trunk, in 8.0.x for 8.0.24 and in 7.0.x for 7.0.64
onwards.
Regards,
Violeta
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org