the exploded wars could not be deployed

Description

maybe this issue still exist in new version。
War-Deployer doesn't deploy exploded wars anymore

the exception is:the same with

--------exception begin------------
2015-07-05 16:15:44,075 | ERROR | lop\karaf/deploy | fileinstall | 7 - org.apache.felix.fileinstall - 3.4.2 | Failed to install artifact: D:\Develop\karaf\deploy\apidoc.war
java.net.MalformedURLException: Invalid syntax for instruction [Bundle-SymbolicName=D:\Develop\karaf\deploy\apidoc.war]. Take a look at http://www.aqute.biz/Code/Bnd.
at org.ops4j.pax.swissbox.bnd.BndUtils.parseInstructions(BndUtils.java:302)[2:org.ops4j.pax.url.wrap:2.3.0]
at org.ops4j.pax.url.wrap.internal.Parser.<init>(Parser.java:116)[2:org.ops4j.pax.url.wrap:2.3.0]
at org.ops4j.pax.url.wrap.internal.Connection.<init>(Connection.java:67)[2:org.ops4j.pax.url.wrap:2.3.0]
at org.ops4j.pax.url.wrap.internal.Activator$1.createConnection(Activator.java:59)[2:org.ops4j.pax.url.wrap:2.3.0]
at org.ops4j.pax.url.wrap.internal.Activator$1.createConnection(Activator.java:49)[2:org.ops4j.pax.url.wrap:2.3.0]
at org.ops4j.pax.url.commons.handler.HandlerActivator$Handler.openConnection(HandlerActivator.java:222)[2:org.ops4j.pax.url.wrap:2.3.0]
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.openConnection(URLHandlersStreamHandlerProxy.java:271)[org.apache.felix.framework-4.2.1.jar:]
at java.net.URL.openConnection(URL.java:971)[:1.7.0_72]
at java.net.URL.openStream(URL.java:1037)[:1.7.0_72]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:943)[7:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:865)[7:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:482)[7:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358)[7:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310)[7:org.apache.felix.fileinstall:3.4.2]

--------exception end------------

i check the code modify record:
when modify this bug:
delete this code:

try {

  • if (!artifact.isFile() || !artifact.getName().endsWith(".war")) {

  • return false;

  • }

  • jar = new JarFile(artifact);

and add this code:

+ if (artifact.isFile()) {
+ // if it's a file it needs to end with war
+ if (!artifact.getName().endsWith(".war"))
+ return false;
+ } else {
+ // if it isn't a file it needs to end with .war.jar
+ if (!artifact.getName().endsWith(".war.jar"))
+ return false;
+ }
+
+ jar = new JarFile(artifact);

why the dir extend name change from .war to the .war.jar.

2:how to deploy a exploded wars by bundle:install command
i try this commane:
bundle:install -s "webbundle:file:war/api-doc.war?Bundle-SymbolicName=api-doc&Web-ContextPath=/api-doc"
it occur this exception: may be the code want to unzip the war ,but this is a exploded wars, it is unpacked ,did the command can not use for this war format ?

Caused by: java.lang.Exception: Unable to install bundle webbundle:file:war/api-doc.war?Bundle-SymbolicName=api-doc&Web-ContextPath=/api-doc
at org.apache.karaf.bundle.command.Install.doExecute(Install.java:45)
... 17 more
Caused by: org.osgi.framework.BundleException: Unable to cache bundle: webbundle:file:war/api-doc.war?Bundle-SymbolicName=api-doc&Web-ContextPath=/api-doc
at org.apache.felix.framework.Felix.installBundle(Felix.java:2870)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
at org.apache.karaf.bundle.command.Install.doExecute(Install.java:43)
... 17 more
Caused by: java.io.FileNotFoundException: war\api-doc.war (拒绝访问。)
at java.util.zip.ZipFile.open(Native Method)[:1.7.0_72]
at java.util.zip.ZipFile.<init>(ZipFile.java:215)[:1.7.0_72]
at java.util.zip.ZipFile.<init>(ZipFile.java:145)[:1.7.0_72]
at java.util.jar.JarFile.<init>(JarFile.java:154)[:1.7.0_72]
at java.util.jar.JarFile.<init>(JarFile.java:91)[:1.7.0_72]
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)[:1.7.0_72]
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)[:1.7.0_72]
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:109)[:1.7.0_72]
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)[:1.7.0_72]
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)[:1.7.0_72]
at org.ops4j.pax.url.war.internal.AbstractConnection.extractJarListFromWar(AbstractConnection.java:360)
at org.ops4j.pax.url.war.internal.AbstractConnection.generateClassPathInstruction(AbstractConnection.java:214)
at org.ops4j.pax.url.war.internal.AbstractConnection.getInputStream(AbstractConnection.java:139)
at org.ops4j.pax.url.war.internal.WarConnection.getInputStream(WarConnection.java:33)
at org.apache.felix.framework.util.SecureAction.getURLConnectionInputStream(SecureAction.java:524)
at org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:165)
at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:77)
at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:878)
at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
at org.apache.felix.framework.Felix.installBundle(Felix.java:2866)

Environment

win 8.1 + karaf3.0.3

Status

Assignee

Achim Nierbeck

Reporter

imacming

Labels

Components

Fix versions

Affects versions

Priority

Major
Configure