Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Running an IApplication when deploying to Tomcat with servletbridge
Running an IApplication when deploying to Tomcat with servletbridge [message #532230] Fri, 07 May 2010 15:33 Go to next message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
Hi,

I have a web application that I'm going to deploy in Tomcat using
servletbridge and I thought I would deploy a CDO server
(http://eclipse.org/cdo/) along with it. But I could not find how to
automatically start the CDO server application
org.eclipse.emf.cdo.server.app when the war file is deployed. Is this
supported? If so, where do I put the application's id? Thanks.

BTW. when I try to start the application manually from the OSGi console
I get this exception:

org.osgi.service.application.ApplicationException
at
org.eclipse.equinox.internal.app.EclipseAppContainer.launch( EclipseAppContainer.java:328)
at
org.eclipse.equinox.internal.app.EclipseAppDescriptor.launch Specific(EclipseAppDescriptor.java:93)
at
org.osgi.service.application.ApplicationDescriptor.launch(Ap plicationDescriptor.java:315)
at
org.eclipse.equinox.internal.app.AppCommands._startApp(AppCo mmands.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:155)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:157)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru nConsole(FrameworkConsole.java:142)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:106)
at java.lang.Thread.run(Thread.java:636)

Michal
Re: Running an IApplication when deploying to Tomcat with servletbridge [message #532240 is a reply to message #532230] Fri, 07 May 2010 16:18 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
By default extensions to the applications extension point (org.eclipse.core.runtime.applications) define applications that are required to run on the main thread. The issue here is that there is no main thread available for the eclipse application container to use when embedded in a web application.

The error message (or lack there of) needs to be improved/added. Could you open a bug about that against Equinox->Compendium? The application container cannot launch the application because there is no main thread available for it to launch the application. You will have to define an application extension that specifies it can run on "any" thread in order to allow it to work in the web application environment ...

<application
thread="any">
<run class="ApplicationClass"/>
</application>

HTH

Tom.
Re: Running an IApplication when deploying to Tomcat with servletbridge [message #532282 is a reply to message #532240] Fri, 07 May 2010 18:49 Go to previous messageGo to next message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
On 05/07/2010 06:18 PM, Thomas Watson wrote:
> By default extensions to the applications extension point
> (org.eclipse.core.runtime.applications) define applications that are
> required to run on the main thread. The issue here is that there is no
> main thread available for the eclipse application container to use when
> embedded in a web application.
>
> The error message (or lack there of) needs to be improved/added. Could
> you open a bug about that against Equinox->Compendium?

No problem, I opened bug 312109.

> The application
> container cannot launch the application because there is no main thread
> available for it to launch the application. You will have to define an
> application extension that specifies it can run on "any" thread in order
> to allow it to work in the web application environment ...
>
> <application
> thread="any">
> <run class="ApplicationClass"/>
> </application>

Ok, I got it. I changed it and now I can start the application manually
from the osgi console. But how would I make it start automatically once
the war file is deployed in the container? Is there a command-line
option I could put in web.xml or a property I could put in launch.ini?

Thanks,

Michal

>
> HTH
>
> Tom.
>
Re: Running an IApplication when deploying to Tomcat with servletbridge [message #532293 is a reply to message #532282] Fri, 07 May 2010 19:31 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
The configuration option eclipse.application can be used to specify the extension id of the application you want to launch when the platform is launched.

HTH

Tom.
Re: Running an IApplication when deploying to Tomcat with servletbridge [message #532308 is a reply to message #532293] Fri, 07 May 2010 21:07 Go to previous messageGo to next message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
Thanks, it works perfectly.

Michal

On 05/07/2010 09:31 PM, Thomas Watson wrote:
> The configuration option eclipse.application can be used to specify the
> extension id of the application you want to launch when the platform is
> launched.
>
> HTH
>
> Tom.
Re: Running an IApplication when deploying to Tomcat with servletbridge [message #532800 is a reply to message #532308] Tue, 11 May 2010 09:10 Go to previous messageGo to next message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
Actually it doesn't work that well.

While the console shows that the application is running...

osgi> apps
org.eclipse.emf.cdo.server.app [running] [not launchable]
org.eclipse.equinox.app.error [not launchable]

osgi> activeApps
org.eclipse.emf.cdo.server.app.0 [running]

....it isn't really. It turns out that
org.eclipse.osgi.service.runnable.ApplicationLauncher service is not
available during startup which prevents
org.eclipse.equinox.internal.app.EclipseAppContainer from launching the
default application and defers its launch. However this service is not
available anytime later either. That is because it is only registered
by org.eclipse.core.runtime.adaptor.EclipseStarter which is not used
when the osgi container is deployed inside the servlet container via
servletbridge.

Starting the application from the OSGi console manually works however
(although the application, the one which has never really started, has
to be stopped first).

It would probably work if the application was started as a non-default
one, using AnyThreadAppLauncher.launchEclipseApplication(). This however
is not the case when it's specified using eclipse.application option.

Is there a solution here that I cannot see? Or should it be considered a
bug in the way servletbridge works (which would be not registering the
ApplicationLauncher service)?

Thanks for your help,

Michal

On 05/07/2010 11:07 PM, Michal Tkacz wrote:
> Thanks, it works perfectly.
>
> Michal
>
> On 05/07/2010 09:31 PM, Thomas Watson wrote:
>> The configuration option eclipse.application can be used to specify the
>> extension id of the application you want to launch when the platform is
>> launched.
>>
>> HTH
>>
>> Tom.
>
Re: Running an IApplication when deploying to Tomcat with servletbridge [message #532950 is a reply to message #532800] Tue, 11 May 2010 16:01 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
I had forgotten about the change we made in bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=301262

We now require the ApplicationLauncher to be registered before launching the default application no matter what the thread type is. I can see two options for you:

1) Have a bundle that registers its won ApplicationLauncher service. I would recommend it throw unsupported operation exceptions. This way you will be able to launch the default application as long as it is an any thread app.

2) Have another bundle lookup the ApplicationDescription service for the application you want to launch and launch it yourself instead of depending on the default application.

There are a couple of options for us to fix this in Equinox:

1) Have the application container check to see if the framework is in the process of STARTING; if it is then monitor events to determine when the framework is active and then launch the default application any threaded application. If the framework is already active then we still may have to wait for the application launcher service

2) Have the servlet equinox launcher register an ApplicationLauncher service for you.

Could you open a bug to continue the discussion?

Thanks.

Tom.
Re: Running an IApplication when deploying to Tomcat with servletbridge [message #533112 is a reply to message #532950] Wed, 12 May 2010 09:20 Go to previous message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
Thanks for these workaround suggestions and possible solutions. I filed
bug 312551.

Michal

On 05/11/2010 06:01 PM, Thomas Watson wrote:
> I had forgotten about the change we made in bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=301262
>
> We now require the ApplicationLauncher to be registered before launching
> the default application no matter what the thread type is. I can see two
> options for you:
>
> 1) Have a bundle that registers its won ApplicationLauncher service. I
> would recommend it throw unsupported operation exceptions. This way you
> will be able to launch the default application as long as it is an any
> thread app.
>
> 2) Have another bundle lookup the ApplicationDescription service for the
> application you want to launch and launch it yourself instead of
> depending on the default application.
>
> There are a couple of options for us to fix this in Equinox:
>
> 1) Have the application container check to see if the framework is in
> the process of STARTING; if it is then monitor events to determine when
> the framework is active and then launch the default application any
> threaded application. If the framework is already active then we still
> may have to wait for the application launcher service
>
> 2) Have the servlet equinox launcher register an ApplicationLauncher
> service for you.
>
> Could you open a bug to continue the discussion?
>
> Thanks.
>
> Tom.
Previous Topic:Splash screen not showing up for a shared bundles installation
Next Topic:Start p2 installer with java
Goto Forum:
  


Current Time: Wed Apr 24 17:44:38 GMT 2024

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

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

Back to the top