ITMill running as a OSGI Bundle

Hello Guys,

I ‘m creating a test tool where each piece of test code will be an OSGI bundle (like an Eclipse plug-in). So, to create the user interface for this tool, I’m trying to use ITMill inside an Equinox (OSGI) bundle. I followed the below tutorial to execute, with success, a simple Servlet inside a bundle:

http://www.eclipse.org/equinox-portal/tutorials/server-side/

However, I can’t execute the ITMill Servlet inside a bundle running with Jetty. I’m catching a null pointer, please see the below logs.

Do you know anyone that tried to execute ITMill as an OSGI bundle? If you have curiosity, my code is available to download (eclipse project):

http://www.prestesmachado.com.br/exemplos/SoaTestWeb.zip

I’d like to work with and contribute to solve this issue, I believe that it’s really cool to execute ITMill as a OSGI bundle.

Thank you
Rodrigo

My logs:

osgi> 01/10/2008 00:35:47 org.mortbay.http.HttpServer doStart
INFO: Version Jetty/5.1.x
01/10/2008 00:35:47 org.mortbay.util.Container start
INFO: Started org.eclipse.equinox.http.jetty.internal.Servlet25Handler@1addb59
01/10/2008 00:35:47 org.mortbay.util.Container start
INFO: Started HttpContext
[/,/]
01/10/2008 00:35:47 org.mortbay.http.SocketListener start
INFO: Started SocketListener on 0.0.0.0:8080
01/10/2008 00:35:47 org.mortbay.util.Container start
INFO: Started org.mortbay.http.HttpServer@16c9867
java.lang.NullPointerException
at com.itmill.toolkit.terminal.gwt.server.WebApplicationContext.equals(WebApplicationContext.java:127)
at org.mortbay.jetty.servlet.AbstractSessionManager$Session.setAttribute(AbstractSessionManager.java:835)
at org.eclipse.equinox.http.servlet.internal.HttpSessionAdaptor.setAttribute(HttpSessionAdaptor.java:96)
at com.itmill.toolkit.terminal.gwt.server.WebApplicationContext.getApplicationContext(WebApplicationContext.java:109)
at com.itmill.toolkit.terminal.gwt.server.ApplicationServlet.service(ApplicationServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:269)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
01/10/2008 00:36:08 org.mortbay.jetty.servlet.ServletHandler handle
WARNING: EXCEPTION
javax.servlet.ServletException
at com.itmill.toolkit.terminal.gwt.server.ApplicationServlet.service(ApplicationServlet.java:545)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:269)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
01/10/2008 00:36:08 org.mortbay.jetty.servlet.ServletHandler handle
SEVERE: /soatest:
java.lang.NullPointerException
at com.itmill.toolkit.terminal.gwt.server.WebApplicationContext.equals(WebApplicationContext.java:127)
at org.mortbay.jetty.servlet.AbstractSessionManager$Session.setAttribute(AbstractSessionManager.java:835)
at org.eclipse.equinox.http.servlet.internal.HttpSessionAdaptor.setAttribute(HttpSessionAdaptor.java:96)
at com.itmill.toolkit.terminal.gwt.server.WebApplicationContext.getApplicationContext(WebApplicationContext.java:109)
at com.itmill.toolkit.terminal.gwt.server.ApplicationServlet.service(ApplicationServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:269)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

I’ll can check this out. Based on your logs, this might be of an classloader issue…

Hmm, for some reason I cannot run even “HelloWorld” example plugin (run with OSGI) without whole lot bunch of errors, but this is because Eclipse wants to use JavaSE-1.6 which is not the default on my system (I’m a Mac guy). Even though dependencies are set to 1.5.


org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.6

For this test I used Eclipse 3.4.1 (M20080911-1700), this is Ganymede relese which should include all stuff required.

Eclipse plug-in examples run fine.

Well, I gave it a shot but run out of time :frowning: Hope someone else tries this too!

As you probably know running Toolkit with Jetty should be fine as our release uses Jetty for running all the demos.

I checked your plugin code and to me it tries to launch correct servlet class with correct init parameters (your tk app class).

Don’t know if it helps anything but the first exception comes from WebApplicationContext which is tightly related to HttpSession object, that object is null for some reason.

WebApplicationContext contains references to single client’s all Toolkit applications within the client’s HttpSession.

[quote=Jani Laakso]
Eclipse wants to use JavaSE-1.6 which is not the default on my system (I’m a Mac guy).
[/quote]Just ask Matti here at the office for Java 6 for OS X (I’m running it also). Might help you to solve this issue.

Ahh ok, I got it installed but I’ve been afraid to set 1.6 as default… This is a Mac thing :slight_smile: I’ll discuss with Matti later this day…

Hello Guys,

In my environment I was using Eclipse the latest version of “Eclipse for RCP/Plug-in Developers (175 MB)” (http://www.eclipse.org/downloads/), JavaSE-1.6 and Ubuntu. However, in the first moment I have tried to execute that tutorial with Eclipse Webtools and for some reason it doesn’t work for me. So, I suggest you download the latest version of Eclipse RCP/Plugin and make sure that the one “simple servlet” bundle works fine. If you need help, I can provide you an Eclipse project with this “simple servlet” bundle.

Thank you for addressing this issue

Rodrigo

Ok, I try to squeeze some time to try this out. In the mean time could you try if below line throws an exception on your working “Hello World servlet”:

System.out.println(“servletContext=”+request.getSession().getServletContext());

I want to understand if this is an classloader issue or not.

it doesn’t return an exception, it returns the below line:



servletContext=org.eclipse.equinox.http.servlet.internal.ServletContextAdaptor@10fe2b9

Ok, thanks. I’ll try to check this today more.

Hello Jani,

Have you had the opportunity to investigate this issue?

Regards
Rodrigo

Tomorrow, at least there is a decent chance (time) for me, I’ll get back to this!

Thank you to try execute Itmill as an osgi bundle … !

Rodrigo

So sorry, deadlines are everywhere, squeezing time for this has been impossible. I tried to ask some help from few of my colleagues who got Windows OS and all… I truly hope they can help you with this asap!

so … let’s wait

Hi!

Seems to have been a while since anyone had a look at this. I tried to use Equinox today, run into the same problem and managed to find the reason for the NullPointerException (see http://dev.itmill.com/ticket/2525 for details).

I fixed this issue right away and now Equinox seems to work just fine. The fix will appear in the next nightly build and in RC10.