Note that there are some explanatory texts on larger screens.

plurals
  1. PODeploy war files in Apache Felix?
    primarykey
    data
    text
    <p>I'm trying to deploy an application to Apache Felix. It was a gwt application but I've been simplifying the problem until just a hello world html file so my problem is to deploy any kind of web application in a war file. I've also tried to deploy the generated wars in Apache Karaf and they worked without any problems (once you <a href="http://karaf.apache.org/manual/latest-2.2.x/users-guide/web-applications.html" rel="nofollow">install feature war</a>).</p> <p>So, right now I have this:</p> <pre><code>blaxter@duffman:~/devel/webapp $ tree . ├── pom.xml ├── src    └── main    ├── resources    └── webapp    ├── foobar.html └── WEB-INF    └── web.xml </code></pre> <p>The pom.xml is pretty straightforward, the interesting part is related with felix plugin, but for this war without any compiled code it doesn't matter...</p> <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.mycompany&lt;/groupId&gt; &lt;artifactId&gt;webapp&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;name&gt;webapp Maven Webapp&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;servlet-api&lt;/artifactId&gt; &lt;version&gt;2.5&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;finalName&gt;webapp&lt;/finalName&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.felix&lt;/groupId&gt; &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.7&lt;/version&gt; &lt;extensions&gt;true&lt;/extensions&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;bundle-manifest&lt;/id&gt; &lt;phase&gt;process-classes&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;manifest&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;supportedProjectTypes&gt; &lt;supportedProjectType&gt;jar&lt;/supportedProjectType&gt; &lt;supportedProjectType&gt;bundle&lt;/supportedProjectType&gt; &lt;supportedProjectType&gt;war&lt;/supportedProjectType&gt; &lt;/supportedProjectTypes&gt; &lt;instructions&gt; &lt;Bundle-SymbolicName&gt;${project.artifactId}&lt;/Bundle-SymbolicName&gt; &lt;Bundle-Version&gt;${project.version}&lt;/Bundle-Version&gt; &lt;Embed-Dependency&gt;*;scope=compile|runtime&lt;/Embed-Dependency&gt; &lt;Embed-Directory&gt;WEB-INF/lib&lt;/Embed-Directory&gt; &lt;Embed-Transitive&gt;true&lt;/Embed-Transitive&gt; &lt;Import-Package&gt;*;resolution:=optional&lt;/Import-Package&gt; &lt;Web-ContextPath&gt;/sample&lt;/Web-ContextPath&gt; &lt;Webapp-Context&gt;/sample&lt;/Webapp-Context&gt; &lt;_wab&gt;src/main/webapp&lt;/_wab&gt; &lt;/instructions&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.ops4j&lt;/groupId&gt; &lt;artifactId&gt;maven-pax-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;provision&gt; &lt;param&gt;--platform=felix&lt;/param&gt; &lt;param&gt;--profiles=compendium,web,war,log&lt;/param&gt; &lt;param&gt;--log=debug&lt;/param&gt; &lt;/provision&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt; &lt;version&gt;2.1.1&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;compile&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;exploded&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;webappDirectory&gt;${webappDirectory}&lt;/webappDirectory&gt; &lt;archive&gt; &lt;!-- add the generated manifest to the war --&gt; &lt;manifestFile&gt;${project.build.outputDirectory}/META-INF/MANIFEST.MF&lt;/manifestFile&gt; &lt;/archive&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>The pax plugin is also there because I've tried to run the application with that, but I got the same result. The web.xml is an empty one:</p> <pre><code>&lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" &gt; &lt;web-app&gt; &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;foobar.html&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;/web-app&gt; </code></pre> <p>Once you execute <em>mvn package</em> to generate the war file, if I deploy it in Apache Felix I get no errors, the bundle state is active but I only get 404 errors trying to access /sample paths. I've tried put both sample and /sample as context path values. The same behaviour happens running <em>mvn pax:run</em>. If I deploy the war in Apache karaf, it works so I'd assume I'm doing something really wrong with felix.</p> <p>My current list of bundles is:</p> <pre><code>g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.0.2) 1|Active | 1|JXSE (2.7.0) 2|Active | 1|Apache Felix Bundle Repository (1.6.6) 3|Active | 1|Apache Felix Configuration Admin Service (1.2.8) 4|Active | 1|Apache Felix EventAdmin (1.2.14) 5|Active | 1|Apache Felix File Install (3.2.0) 7|Resolved | 1|Apache Felix Security Provider (2.0.1) 8|Active | 1|Apache Felix Gogo Command (0.12.0) 9|Active | 1|Apache Felix Gogo Runtime (0.10.0) 10|Active | 1|Apache Felix Gogo Shell (0.10.0) 11|Active | 1|Apache Felix Http Api (2.2.0) 12|Active | 1|Apache Felix Http Base (2.2.0) 13|Active | 1|Apache Felix Http Bridge (2.2.0) 14|Active | 1|Apache Felix Http Bundle (2.2.0) 15|Active | 1|Apache Felix Http Jetty (2.2.0) 16|Active | 1|Apache Felix Log Service (1.0.1) 17|Active | 1|Apache Felix Shell Service (1.4.2) 18|Active | 1|OPS4J Pax Logging - API (1.6.3) 19|Active | 1|OPS4J Pax Logging - Service (1.6.3) 20|Active | 1|OPS4J Pax Url - mvn: (1.2.8) 21|Active | 1|OPS4J Pax Url - war (1.2.8) 22|Active | 1|OPS4J Pax Url - wrap: (1.2.8) 23|Active | 1|OPS4J Pax Web - API (1.0.9) 24|Active | 1|OPS4J Pax Web - FileInstall Deployer (1.0.9) 25|Active | 1|OPS4J Pax Web - Extender - WAR (1.0.9) 26|Active | 1|OPS4J Pax Web - Extender - Whiteboard (1.0.9) 27|Active | 1|OPS4J Pax Web - Jetty Bundle (1.0.9) 28|Active | 1|OPS4J Pax Web - Jsp Support (1.0.9) 29|Active | 1|OPS4J Pax Web - Runtime (1.0.9) 30|Active | 1|OPS4J Pax Web - Service SPI (1.0.9) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload