Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331370 - ExtensionsHookConfigurator breaks resource loading in Pax Web/Felix Webconsole
Summary: ExtensionsHookConfigurator breaks resource loading in Pax Web/Felix Webconsole
Status: CLOSED NOT_ECLIPSE
Alias: None
Product: Virgo
Classification: RT
Component: unknown (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Chris Frost CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-29 13:43 EST by Peter Gardfjäll CLA
Modified: 2011-02-08 05:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Gardfjäll CLA 2010-11-29 13:43:04 EST
Build Identifier: 2.1.0.RELEASE

I've been trying to get the Apache Felix webconsole bundle (http://felix.apache.org/site/apache-felix-web-console.html) and Pax-Web (http://wiki.ops4j.org/display/paxweb/Pax+Web) going in a bare Virgo kernel distribution.

The problem with this set up is that the appearance of the web console is not the same as when executed in a "naked" Equinox setup. More specifically, in the Virgo kernel the webconsole's stylesheets and javascripts don't seem to be handled correctly. Digging deeper, I found that it is the ExtensionsHookConfigurator that seems to be causing problems since when taken out of the equation the webconsole displays as it should.


Reproducible: Always

Steps to Reproduce:
First, you need to download the following bundle files and add them under lib/kernel

  https://ebr.springsource.com/repository/app/bundle/version/d ownload?name=com.springsource.javax.servlet&version=2.5. 0&type=binary
  http://repo2.maven.org/maven2/org/ops4j/pax/web/pax-web-jett y-bundle/0.8.1/pax-web-jetty-bundle-0.8.1.jar
  http://apache.dataphone.se//felix/org.apache.felix.webconsol e-3.1.6.jar

Then make the following configuration changes:

First, add the bundles to the launcher.bundles property in the lib/org.eclipse.virgo.kernel.launch.properties file:

+  file:lib/kernel/com.springsource.javax.servlet-2.5.0.jar@start,\
+  file:lib/kernel/pax-web-jetty-bundle-0.8.1.jar@start,\
+  file:lib/kernel/org.apache.felix.webconsole-3.1.6.jar@start
 

Second, we turn off the user region for these tests.
In config/org.eclipse.virgo.kernel.userregion.properties comment out the baseBundles property.

# baseBundles = \
#  file:lib/kernel/org.eclipse.virgo.kernel.userregion-2.1.0.RELEASE.jar@start,\
#  file:lib/kernel/org.eclipse.virgo.kernel.osgicommand-2.1.0.RELEASE.jar@start


Now, start Virgo via the startup script (NOTE: ExtensionsHookConfigurator is enabled at this point) and go to http://localhost:8080/system/console. 
Note that the page appearance is quite bleak.

Now, try the same thing with the ExtensionsHookConfigurator disbabled:
Comment out the following line in lib/org.eclipse.virgo.kernel.launch.properties and then restart Virgo. 

#osgi.hook.configurators.include=org.eclipse.virgo.osgi.extensions.equinox.hooks.ExtensionsHookConfigurator


Now, the appearance of the webconsole page is a lot more sophisticated.
Comment 2 Glyn Normington CLA 2010-12-03 05:43:11 EST
Thanks for raising this Peter!
Comment 3 Chris Frost CLA 2011-01-20 06:57:29 EST
Hi Peter,

I have managed to recreate the problem and I am investigating the cause.

I would like to point out the way to extend the server. Simply drop the bundles in the repository and then reference them with the 'initialArtifacts' property in the 'org.eclipse.virgo.kernel.userregion.properties' file.

This is how I recreated the problem and will proceed with. The way you are using to start bundles should only be used for system bundles etc...

(For anyone else trying this, the id/password is admin and admin)

Chris.
Comment 4 Chris Frost CLA 2011-01-20 10:54:20 EST
Well, the cause is that the css is sent back with a header of 'Content-Type: content/unknown' as such the browser doesn't know what to do with it. The actually content is correct. Will now focus on why this is happening.
Comment 5 Chris Frost CLA 2011-01-20 10:56:44 EST
Should be 'text/css'
Comment 6 Peter Gardfjäll CLA 2011-01-23 05:04:58 EST
(In reply to comment #5)
> Should be 'text/css'

I browsed the PAX-WEB mailing list and found the following thread
  http://lists.ops4j.org/pipermail/general/2011q1/005229.html
which may be related to this problem, I can't say for sure. 
Maybe it's not only Virgo that is at fault here, although it appears like the ExtensionsHookConfigurator does cause some problems.
Comment 7 Chris Frost CLA 2011-02-03 11:37:07 EST
Hi Peter,

Thanks for the pointer, it seems to be the same problem but unfortunately no one has solved it over there either. The mime.properties file is correctly loaded but it seems when the request is made by the browser the MimeTypes object is not consulted (via org.eclipse.jetty.server.handler.ContextHandler) to get the header for the extension for some reason. 

After further investigation I have found that the interesting code is in org.ops4j.pax.web.service.jetty.internal.ResourceServlet.java. In this file the request comes in and is dealt with. The requested css file is found just fine but when it tries to figure out the mime type to set on the response it first consults org.apache.felix.webconsole.internal.servlet.OsgiManagerHttpContext which returns null so then it opens a url connection to the css file and attempts to get a mime type from that, this returns with 'content/unknown' which is set on the response. 

I can't find any possible code path between the ResoureServlet in pax web and Jettys ContextHandler which is set up and ready to determine the content type from the '.css' extension. This might be because the OsgiManagerHttpContext is an OSGi HttpService provided by the Felix webconsole itself. All around the code where this HttpService is provide it is also setting up a String called 'webManagerRoot'. The post you sent me to talks about this problem 'It might be possible this happened when the patch for the webroot path came in something got screwed.' 

I don't think the Jetty guys can help as they seem to be keeping up their side of things. I will get some second opinions at this point and comment back here on what I find out but it looks likely to be a problem with the Felix Web console itself. I'm not sure how but it is possible that unplugging our ExtensionsHookConfigurator could cause things to work but finding out the connection would require further debugging of the Felix Web consoles 'OsgiManagerHttpContext'

Chris.
Comment 8 Peter Gardfjäll CLA 2011-02-04 16:09:39 EST
(In reply to comment #7)
Chris,

sounds like you've been doing some serious digging. :)
Just thought I'd let you know that I just tried out the latest Pax-Web (1.0.0) and Felix Web Console (3.1.6) release on a Virgo kernel and the web console now renders properly.

Probably not a problem with Virgo but rather a problem with Pax-Web and/or Felix Web Console. 

Anyhow, thanks a lot for your efforts! ...and sorry for (perhaps?) wasting your time! =)


best regards, Peter
Comment 9 Chris Frost CLA 2011-02-07 05:50:30 EST
(In reply to comment #8)
> (In reply to comment #7)
> Chris,
> 
> sounds like you've been doing some serious digging. :)
> Just thought I'd let you know that I just tried out the latest Pax-Web (1.0.0)
> and Felix Web Console (3.1.6) release on a Virgo kernel and the web console now
> renders properly.
> 
> Probably not a problem with Virgo but rather a problem with Pax-Web and/or
> Felix Web Console. 
> 
> Anyhow, thanks a lot for your efforts! ...and sorry for (perhaps?) wasting your
> time! =)
> 
> 
> best regards, Peter

Hi,

I'm just glad it's all working on Virgo now, I guess we will never know why removing our extension hooks made it work. I'm going to close the issue off now. It wasn't a total waste as it's good for me to learn more about Jetty and web stuff in General.

Just out of interest, what is your requirement for running the Felix admin console on Virgo?

Chris.
Comment 10 Chris Frost CLA 2011-02-07 05:51:10 EST
Working in the latest Pax-Web 1.0.0
Comment 11 Peter Gardfjäll CLA 2011-02-07 15:09:31 EST
I guess the Virgo Web Server would be an alternative (with its admin console).

However, we have a legacy "platform" of shared library bundles, including Apache CXF and the org.apache.servicemix.cxf.transport.osgi which require the OSGi HttpService to be available. The Tomcat server delivered with the Virgo Web Server does not publish a HttpService so we had to go with Pax-Web. 

I can't remember if we ever tried using the Virgo admin console with Pax-Web, but Felix Web Console worked right out of the box so we decided to go for it.

/Peter

(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > Chris,
> > 
> > sounds like you've been doing some serious digging. :)
> > Just thought I'd let you know that I just tried out the latest Pax-Web (1.0.0)
> > and Felix Web Console (3.1.6) release on a Virgo kernel and the web console now
> > renders properly.
> > 
> > Probably not a problem with Virgo but rather a problem with Pax-Web and/or
> > Felix Web Console. 
> > 
> > Anyhow, thanks a lot for your efforts! ...and sorry for (perhaps?) wasting your
> > time! =)
> > 
> > 
> > best regards, Peter
> 
> Hi,
> 
> I'm just glad it's all working on Virgo now, I guess we will never know why
> removing our extension hooks made it work. I'm going to close the issue off
> now. It wasn't a total waste as it's good for me to learn more about Jetty and
> web stuff in General.
> 
> Just out of interest, what is your requirement for running the Felix admin
> console on Virgo?
> 
> Chris.
Comment 12 Chris Frost CLA 2011-02-08 05:21:22 EST
Hi,

Thanks for the feedback, it is useful to have.

Chris.