-
1. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
bosschaert Jul 19, 2012 9:32 AM (in response to thehashcoder)1 of 1 people found this helpfulHi Ranis,
WAB support was provided in AS 7.0 through a variant of pax-web. However shipping this out of the box didn't work out well for everyone, so it was removed from the default configuration from AS 7.1. Setting the start level to 3 only worked in 7.0 as for that start level the org.jboss.osgi.webapp module was defined in the 7.0 standalone.xml.
You can still deploy the webapp support in AS 7.1 how this is done is described here: https://docs.jboss.org/author/display/JBOSGI/Provided+Examples#ProvidedExamples-WebApplication
In the mean time we're replacing the PAX-based WebApplication support with our own native AS7 Web support, you can track the progress for that here: https://issues.jboss.org/browse/AS7-5083
Not sure what AS7 version you were trying this with, but you have a couple of options:
* You can download 7.0.x and then what you're trying should work by changing the start level to 3.
* You can take 7.1 and then add WAB support manually by adding capabilities in as described in the JBoss OSGi documentation.
* You could even build the latest 7.2 stream and try out the native WAB support, however that still isn't implemented fully.
Hope this helps,
David
-
2. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
thehashcoder Jul 23, 2012 3:06 PM (in response to bosschaert)Hi David,
Thanks a lot for having a look into this. Your answer helped to get some insight into JBoss OSGi stuff. I gave some tries and below are my results.
I added below lines to my standalone.xml
<capability name=
"org.ops4j.pax.web:pax-web-jetty-bundle:1.1.2"
/>
<capability name=
"org.ops4j.pax.web:pax-web-jsp:1.1.2"
/>
<capability name=
"org.ops4j.pax.web:pax-web-extender-war:1.1.2"
/>
All the above bundles were deployed in the server, but when I attempted to start the the third bundle it threw me the below exception.
21:44:23,468 ERROR [stderr] (HttpManagementService-threads - 4) 2012-07-23 21:44:23.468:INFO:oejsh.ContextHandler:stopped HttpServiceContext{httpContext=org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext@f14aae}
21:44:23,468 INFO [org.ops4j.pax.web.service.internal.HttpServiceFactoryImpl] (HttpManagementService-threads - 4) Unbinding bundle: [RanisWAB:0.0.0]
21:44:23,500 INFO [org.jboss.osgi.framework] (HttpManagementService-threads - 4) JBOSGI011003: Bundle stopped: org.ops4j.pax.web.pax-web-extender-war:1.1.2
21:44:35,671 INFO [org.jboss.osgi.framework] (HttpManagementService-threads - 6) JBOSGI011002: Bundle started: org.ops4j.pax.web.pax-web-extender-war:1.1.2
21:44:35,671 INFO [org.ops4j.pax.web.extender.war.internal.WebXmlObserver] (Executor: 1) Using [RanisWAB] as web application context name
21:44:35,671 INFO [org.ops4j.pax.web.extender.war.internal.WebXmlObserver] (Executor: 1) Using [] as web application root path
21:44:35,718 INFO [org.ops4j.pax.web.service.internal.HttpServiceFactoryImpl] (Executor: 1) Binding bundle: [RanisWAB:0.0.0] to http service
21:44:35,718 ERROR [stderr] (Executor: 1) 2012-07-23 21:44:35.718:INFO:oejsh.ContextHandler:started HttpServiceContext{httpContext=org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext@1e2bad0}
21:44:35,765 WARN [org.ops4j.pax.web.jsp.internal.JasperClassLoader] (Executor: 1) Exception while calculating location of imported bundles: java.net.MalformedURLException: unknown protocol: javax.servlet.api
at java.net.URL.<init>(URL.java:574) [rt.jar:1.6.0_23]
at java.net.URL.<init>(URL.java:464) [rt.jar:1.6.0_23]
21:44:35,765 WARN [org.ops4j.pax.web.jsp.internal.JasperClassLoader] (Executor: 1) Exception while calculating location of imported bundles: java.n
at java.net.URL.<init>(URL.java:574) [rt.jar:1.6.0_23]
at java.net.URL.<init>(URL.java:464) [rt.jar:1.6.0_23]
at java.net.URL.<init>(URL.java:413) [rt.jar:1.6.0_23]
at org.ops4j.pax.web.jsp.internal.JasperClassLoader.getLocationsOfBundlesInClassSpace(JasperClassLoader.java:177)
at org.ops4j.pax.web.jsp.internal.JasperClassLoader.getClassPathJars(JasperClassLoader.java:157)
at org.ops4j.pax.web.jsp.internal.JasperClassLoader.<init>(JasperClassLoader.java:73)
at org.ops4j.pax.web.jsp.JspServletWrapper.<init>(JspServletWrapper.java:59)
at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerJsps(HttpServiceStarted.java:490)
at org.ops4j.pax.web.service.internal.HttpServiceProxy.registerJsps(HttpServiceProxy.java:194)
at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit(RegisterWebAppVisitorWC.java:169)
at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:590)
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.register(WebAppPublisher.java:170)
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:155)
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:119)
at org.ops4j.pax.swissbox.tracker.ReplaceableService.setService(ReplaceableService.java:114)
at org.ops4j.pax.swissbox.tracker.ReplaceableService.access$100(ReplaceableService.java:28)
at org.ops4j.pax.swissbox.tracker.ReplaceableService$CollectionListener.serviceAdded(ReplaceableService.java:183)
at org.ops4j.pax.swissbox.tracker.ServiceCollection$Tracker.addingService(ServiceCollection.java:181)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
at org.ops4j.pax.swissbox.tracker.ServiceCollection.onStart(ServiceCollection.java:139)
at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)
at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)
at org.ops4j.pax.swissbox.tracker.ReplaceableService.onStart(ReplaceableService.java:146)
at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)
at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:81)
at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.deploy(WebXmlObserver.java:200)
at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.addingEntries(WebXmlObserver.java:159)
at org.ops4j.pax.swissbox.extender.BundleWatcher$3.run(BundleWatcher.java:224)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_23]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_23]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_23]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) [rt.jar:1.6.0_23]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) [rt.jar:1.6.0_23]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_23]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_23]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_23]
I am attaching the screenshot of my OSGi console for your reference (I couldn't find a way here to attach my WAB). It would be of great help if you can throw some light on this.
Thanks
Ranis MK
-
3. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
thomas.diesler Jul 24, 2012 3:14 AM (in response to thehashcoder)21:44:35,765 WARN [org.ops4j.pax.web.jsp.internal.JasperClassLoader] (Executor: 1) Exception while calculating location of imported bundles: java.n at java.net.URL.<init>(URL.java:574) [rt.jar:1.6.0_23] at java.net.URL.<init>(URL.java:464) [rt.jar:1.6.0_23] at java.net.URL.<init>(URL.java:413) [rt.jar:1.6.0_23] at org.ops4j.pax.web.jsp.internal.JasperClassLoader.getLocationsOfBundlesInClassSpace(JasperClassLoader.java:177)
That would be a silly bug in PaxWeb. Generally, you cannot assume that the bundle location
- Is a valid URL
- If it is a URI that it points to some meaningful location
Intead PaxWeb should obtain the URL for a well known resource entry and work with that.
Anyway, in jboss-as-7.2.0.Alpha1 we have thrown out PaxWeb and replaced that with our own implementation on top on JBossWeb. Your OSGi webapps would get access to the same set of functionality (i.e. security, session fail over, load balancing, ejb/cdi integration, resource injection, etc) as other enterprise webapps that run on AS7
Perhaps you like to give that a try and provide feedback on the latest. You can build 7.2.0.Alpha1-SNAPSHOT from here: https://github.com/jbossas/jboss-as
-
4. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
thehashcoder Jul 24, 2012 1:22 PM (in response to thomas.diesler)Hi Thomas,
Thanks for the response. We would be using JBoss EAP 6 - ( Org decision). I guess it include AS 7.1. Is there any way to make the WAB work in 7.1 version, with some configuration tweaks? It would be great if you can guide me on this.
I am not sure I have done proper configuration changes and installation of neccessary bundles. I have gone through the JBoss' provided examples ( like HTTPService example,WebApp example) but couldn't understand how the code work as a whole project.
Thanks
Ranis MK
-
5. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
thehashcoder Jul 24, 2012 1:29 PM (in response to bosschaert)Hi David,
I forgot to mention some points in my previous reply.
As you guessed I am trying out on AS 7.1. We would be using JBoss EAP 6 which has AS 7.1 (Org decision). So your suggestion to try out AS 7.0/7.2 might not work out.
Thanks
Ranis MK
-
6. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
thehashcoder Jul 25, 2012 2:47 PM (in response to bosschaert)Hi,
Just adding some more progress.
I am now able to start pax-web-extender. I am getting the below messages when I deploy my WAB. But still I'm unable to access the servlet.
23:21:55,296 INFO [org.jboss.osgi.framework] (HttpManagementService-threads - 6) JBOSGI011002: Bundle started: org.ops4j.pax.web.pax-web-extender-war:1.1.2
00:12:53,843 INFO [org.jboss.osgi.framework] (MSC service thread 1-4) JBOSGI011005: Bundle uninstalled: RanisWAB:0.0.0
00:12:54,156 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment RanisWAB.war in 329ms
00:12:54,281 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "RanisWAB.war"
00:13:24,375 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "RanisWAB.war"
00:13:24,671 INFO [org.jboss.osgi.framework] (MSC service thread 1-2) JBOSGI011001: Bundle installed: RanisWAB:0.0.0
00:13:24,812 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "RanisWAB.war"
Do I need to explicitely publish the installed WAB? I saw some examples as such, but I couldn't get the complete example code.
Thanks
Ranis MK
-
7. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
bosschaert Jul 26, 2012 4:09 AM (in response to thehashcoder)From what I can see, your RanisWAB bundle is installed but not started.
In any case, I would recommend you to take a look at the latest AS 7.2 master, as Thomas mentioned, you can build that from here: https://github.com/jbossas/jboss-as
This provides native WAB support and although it's not yet fully complete you should be able to do a lot with it. It is the way WABs will be supported going forward.
With AS 7.2 you don't need to install Pax or anything else. You can just deploy your WAB and it should work.
For a test that shows how this works today, have a look at http://github.com/jbossas/jboss-as/blob/master/testsuite/integration/smoke/src/test/java/org/jboss/as/test/smoke/osgi/SimpleWebAppTestCase.java
-
8. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
bosschaert Jul 26, 2012 4:11 AM (in response to bosschaert)Ok - I see that you are working from a management decision to use AS 7.1. Let me see if I can get a example that works on that and I'll post it back here.
-
9. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
bosschaert Jul 26, 2012 5:17 AM (in response to bosschaert)Hi Ranis,
I tried this with AS 7.1.2 which I think is the version that is bundled with EAP 6.
First of all, I added the following configuration to standalone.xml to enable pax-web:
{code}<capability name="org.ops4j.pax.web:pax-web-jetty-bundle:1.1.2" startlevel="1"/>
<capability name="org.ops4j.pax.web:pax-web-jsp:1.1.2" startlevel="1"/>
<capability name="org.ops4j.pax.web:pax-web-extender-war:1.1.2" startlevel="1"/>{code}
Note that I added startlevel="1" to these capabilities to ensure they are started. (I updated the documentation with this too)
Now I'm deploying a testwab osgi-demo-wab.jar which I created for a previous post.
Next I'm using the CLI to deploy and start my Web Application Bundle:
{code}$ bin/jboss-cli.sh -c
[standalone@localhost:9999 /] deploy /home/someuser/osgi-demo-wab.jar
[standalone@localhost:9999 /] /subsystem=osgi/bundle=osgi-demo-wab.jar:start
{"outcome" => "success"}{code}
Note that for this specific version of OSGi in AS 7.1.2, you need to start the bundle explicitly either through the CLI as I did here or through the Web Console). This needs to be done regardless of how the bundle was deployed. In newer versions of AS7 the bundle is automatically started if possible.
When started, there is an exception on the console, which is the Pax-web bug that you can Thomas identified before (https://community.jboss.org/message/749778#749778) but the web application does work, I can access it from http://localhost:8090/TestWab/DemoServlet (note port 8090):
Hope this works for you too.
-
10. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
thomas.diesler Jul 26, 2012 7:44 AM (in response to bosschaert)Here is the compatibility matrix.
-
11. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
thehashcoder Jul 30, 2012 1:57 AM (in response to bosschaert)Hi David,
Thanks a lot for looking into this. That worked for me too.
I tried all types of deployment models, even the 'drag and drop' into 'deployments' worked. Only thing we need to do extra is to explicitely start the bundle ( without caring the pax-web exceptions).
Thanks
Ranis MK
-
12. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
crramirez Aug 30, 2012 1:36 PM (in response to bosschaert)Hello David,
I am searching in forums and looking for your answers regarding "so it was removed from the default configuration from AS 7.1." and I cannot find where I can download and how to install pax-web for Jboss 7.1. I have downloaded the bundles from pax-web but I don't know how to install them in order to work. I have dropped in deployments folder without result.
Regards,
Carlos
-
13. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
bosschaert Aug 31, 2012 2:57 AM (in response to crramirez)Hi Carlos,
Depending on the specific version of AS7 that you're using the bundles may need to be explicitly started.
If you're using a capability to deploy the bundles adding the startlevel attribute will start them. If you're using another mechanism to deploy you can start them via the CLI or Web Console. This is described in my earlier reply, here: https://community.jboss.org/message/750403#750403
-
14. Re: Getting 404 when hitting OSGi WAB servlet deployed on JBoss AS7
crramirez Aug 31, 2012 12:50 PM (in response to bosschaert)Hello David,
I have JBoss AS 7.1.1 and after enabling the capabilities:
In 7.1.1.Final, 7.1.2.Final add these capabilities
<capability name=
"org.ops4j.pax.web:pax-web-jetty-bundle:1.1.2"
startlevel=
"1"
/>
<capability name=
"org.ops4j.pax.web:pax-web-jsp:1.1.2"
startlevel=
"1"
/>
<capability name=
"org.apache.felix:org.apache.felix.webconsole:3.1.8"
startlevel=
"1"
/>
But I don't know where download the correct jars and how to deploy them. If I put these files in deployment folder jboss complains:
pax-web-extender-war-1.1.4.jar
pax-web-extender-whiteboard-1.1.4.jar
pax-web-jetty-1.1.4.jar
pax-web-jetty-bundle-1.1.4.jar
pax-web-jsp-1.1.4.jar
pax-web-spi-1.1.4.jar
So this is my doubt after adding the capabilities what is the next step
Regards,
Carlos