Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » register servlet manually at HttpService
register servlet manually at HttpService [message #553113] Mon, 16 August 2010 13:50 Go to next message
chrisatpinguin  is currently offline chrisatpinguin Friend
Messages: 18
Registered: May 2010
Junior Member
Hi,

I try to register a Servlet manually to the HttpService provided by Virgo.

This is my Code:
final HttpService httpService = (HttpService) context
		.getService(reference);
		
		try {
			httpService.registerServlet(url, servlet, null, null);
		} catch (final Exception e) {
		    //some logging code
		}

It seems that this works, but i could not find my Servlet at the URL I configured.

Example: url = "/myTestServlet", I expected the complete URL is
http://localhost:8080/myTestServlet.
But everything I get is a 404 error from tomcat and I do not find anything in the logfiles.

Do I have to use a different URL?

Re: register servlet manually at HttpService [message #553182 is a reply to message #553113] Mon, 16 August 2010 15:45 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
I am pretty sure HttpService is not deployed out of the box with virgo.

try this:

start server
telnet localhost 2401
> services
or
> services (objectClass=*HttpService)

You will not find it. You can deploy any http service implementation if you want. I wonder if just deploying war files or web bundles be enough for you? The org.eclipse.gemini.web will pick those up automatically.

http://wiki.eclipse.org/Gemini/Web
Re: register servlet manually at HttpService [message #553308 is a reply to message #553182] Tue, 17 August 2010 06:41 Go to previous messageGo to next message
chrisatpinguin  is currently offline chrisatpinguin Friend
Messages: 18
Registered: May 2010
Junior Member
Hi,

thanks for the reply and you are absolute right... there is no HttpService Smile I thought there is one because I could not find any error messages in my log files, but I debugged and found out that my method with the code was never called...

Thanks for the hint with the Gemini Project. I tried it this way because
I play around with the server and osgi itself to know whats possible and collect some Ideas. So I think making servlets available by deploying a war file will be much easier Wink





Re: register servlet manually at HttpService [message #554434 is a reply to message #553308] Mon, 23 August 2010 07:14 Go to previous messageGo to next message
chrisatpinguin  is currently offline chrisatpinguin Friend
Messages: 18
Registered: May 2010
Junior Member
Hi,

I could not help doing it one more time, I try to install a HttpService and register the Servlet manually Wink, but know I'm running into a Problem I do not understand.

I try to install Jetty. I downloaded version 7.1.6.v20100715 and put all libraries in a new repository for virgo an add the repo in the repo-chain. No Problems so far, but if I try to deploy and start the bundle jetty-osgi-boot-7.1.6-v20100715.jar I get a java.lang.SecurityException (log extract is attached).

I check all jars with jarsigner -verify and none of them is signed. So what do I have to do?

After that I created a plan (see below) for deploying another version of jetty (6.1.15) and this works fine.

<artifact name="org.eclipse.equinox.registry" type="bundle" />
<artifact name="org.eclipse.equinox.servletbridge" type="bundle" />
<artifact name="org.eclipse.equinox.http.servlet" type="bundle" />
<artifact name="org.eclipse.equinox.http.servletbridge" type="bundle" />
<artifact name="org.mortbay.jetty.util" type="bundle" />
<artifact name="org.mortbay.jetty.server" type="bundle" />
<artifact name="org.eclipse.equinox.http" type="bundle" />
<artifact name="org.eclipse.equinox.http.jetty" type="bundle" />

Could someone help me with this?

Re: register servlet manually at HttpService [message #556750 is a reply to message #554434] Thu, 02 September 2010 14:09 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
I think Jetty expertise is a bit thin on this forum, so you might like to try the Jetty forum if you haven't already.

Note that another way to run a servlet under Virgo is to use the Virgo web server and package your code either as a WAR or as a web bundle, which complies with the OSGi Web Application specification (implemented by Gemini Web which is imbedded by the Virgo web server).

If for some reason you prefer to "do it yourself" with Virgo and Jetty, you'd probably want to use the Virgo kernel to avoid loading the Tomcat based Gemini Web in addition to Jetty and probably getting all kinds of port clashes.

Note that we plan to support Jetty in Virgo - see bug 321726.
Re: register servlet manually at HttpService [message #607695 is a reply to message #553182] Tue, 17 August 2010 06:41 Go to previous messageGo to next message
chrisatpinguin  is currently offline chrisatpinguin Friend
Messages: 18
Registered: May 2010
Junior Member
Hi,

thanks for the reply and you are absolute right... there is no HttpService :) I thought there is one because I could not find any error messages in my log files, but I debugged and found out that my method with the code was never called...

Thanks for the hint with the Gemini Project. I tried it this way because
I play around with the server and osgi itself to know whats possible and collect some Ideas. So I think making servlets available by deploying a war file will be much easier ;)
Re: register servlet manually at HttpService [message #607733 is a reply to message #607695] Mon, 23 August 2010 07:14 Go to previous messageGo to next message
chrisatpinguin  is currently offline chrisatpinguin Friend
Messages: 18
Registered: May 2010
Junior Member
Hi,

I could not help doing it one more time, I try to install a HttpService and register the Servlet manually ;), but know I'm running into a Problem I do not understand.

I try to install Jetty. I downloaded version 7.1.6.v20100715 and put all libraries in a new repository for virgo an add the repo in the repo-chain. No Problems so far, but if I try to deploy and start the bundle jetty-osgi-boot-7.1.6-v20100715.jar I get a java.lang.SecurityException (log extract is attached).

I check all jars with jarsigner -verify and none of them is signed. So what do I have to do?

After that I created a plan (see below) for deploying another version of jetty (6.1.15) and this works fine.

<artifact name="org.eclipse.equinox.registry" type="bundle" />
<artifact name="org.eclipse.equinox.servletbridge" type="bundle" />
<artifact name="org.eclipse.equinox.http.servlet" type="bundle" />
<artifact name="org.eclipse.equinox.http.servletbridge" type="bundle" />
<artifact name="org.mortbay.jetty.util" type="bundle" />
<artifact name="org.mortbay.jetty.server" type="bundle" />
<artifact name="org.eclipse.equinox.http" type="bundle" />
<artifact name="org.eclipse.equinox.http.jetty" type="bundle" />

Could someone help me with this?



Re: register servlet manually at HttpService [message #608509 is a reply to message #607733] Thu, 02 September 2010 14:09 Go to previous message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
I think Jetty expertise is a bit thin on this forum, so you might like to try the Jetty forum if you haven't already.

Note that another way to run a servlet under Virgo is to use the Virgo web server and package your code either as a WAR or as a web bundle, which complies with the OSGi Web Application specification (implemented by Gemini Web which is imbedded by the Virgo web server).

If for some reason you prefer to "do it yourself" with Virgo and Jetty, you'd probably want to use the Virgo kernel to avoid loading the Tomcat based Gemini Web in addition to Jetty and probably getting all kinds of port clashes.

Note that we plan to support Jetty in Virgo - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=321726
Previous Topic:Question about dynamically reload bundles
Next Topic:Build RAP with Virgo
Goto Forum:
  


Current Time: Sat Apr 20 03:33:21 GMT 2024

Powered by FUDForum. Page generated in 0.03765 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top