Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Running Xtext on Karaf Felix
Running Xtext on Karaf Felix [message #1705984] Thu, 20 August 2015 16:41 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm trying to get an Xtext DSL (based on v2.8.3 and without UI) up and
running on Karaf with Felix as OSGi framework. I manually start the
Xtext bundle and keep adding bundles as I get messages about missing
bundles or packages. I end up having to add org.eclipse.equinox.common
and org.eclipse.osgi. When starting the latter, I get a
ClassCastException stating that
org.eclipse.osgi.framework.internal.core.SystemBundleActivator cannot
be cast to org.osgi.framework.BundleActivator.

Anybody know how I resolve (pun intended) this issue?

Hallvard
--
Hallvard Trætteberg (hal@xxxxxxxx.no)
Associate Professor, IS group, Dept. of Computer and Information
Science at the
Norwegian Univ. of Science and Technology
Re: Running Xtext on Karaf Felix [message #1706029 is a reply to message #1705984] Fri, 21 August 2015 08:42 Go to previous messageGo to next message
Dennis Huebner is currently offline Dennis HuebnerFriend
Messages: 257
Registered: July 2009
Senior Member

Hi,
I heard that some guy successfully get xtext running with felix (there should be a bug report in eclipse bugzilla).

The problem that you has is described here:
https://developer.jboss.org/thread/246632

Long story short, you can not use org.eclipse.osgi bundle. We use package import ''org.osgi.framework" where possible, so the needed classes should be provided by felix. If you see some require dependency to org.eclipse.osgi please open a bug report.



+Dennis Huebner

Get professional support from the Xtext committers at www.typefox.io
Re: Running Xtext on Karaf Felix [message #1706051 is a reply to message #1706029] Fri, 21 August 2015 12:11 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 2015-08-21 08:42:10 +0000, Dennis Huebner said:

> Hi,
> I heard that some guy successfully get xtext running with felix (there
> should be a bug report in eclipse bugzilla).
>
> The problem that you has is described here:
> https://developer.jboss.org/thread/246632
>
> Long story short, you can not use org.eclipse.osgi bundle. We use
> package import ''org.osgi.framework" where possible, so the needed
> classes should be provided by felix. If you see some require dependency
> to org.eclipse.osgi please open a bug report.

That's what I expected, too. That at some point it would pick up Felix'
classes, and hence resolve.

I found a bug discussion about Xtext and Concierge, which is another
OSGi framework (within Eclipse):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=434490. There it is
stated that there is a dependency on org.eclipse.equinox.common and
that this bundle can run on Concierge, but as far as I could tell, it
was this bundle that caused the problem on Felix. It has the following
package imports: org.eclipse.equinox.log,
org.eclipse.osgi.framework.log, org.eclipse.osgi.service.datalocation,
org.eclipse.osgi.service.debug, org.eclipse.osgi.service.localization,
org.eclipse.osgi.service.urlconversion,org.eclipse.osgi.util,org.osgi.framework,org.osgi.service.log,
org.osgi.service.packageadmin and
org.osgi.service.url,org.osgi.util.tracker.

I would expect some of these to be provided by felix (those beginning
with org.osgi), but others, e.g. org.eclipse.osgi.framework.log, seems
to require Eclipse specific bundles and this ends up with the mentioned
conflict.

Hallvard
--
Hallvard Trætteberg (hal@xxxxxxxx.no)
Associate Professor, IS group, Dept. of Computer and Information
Science at the
Norwegian Univ. of Science and Technology
Re: Running Xtext on Karaf Felix [message #1706152 is a reply to message #1706051] Mon, 24 August 2015 08:39 Go to previous messageGo to next message
Dennis Huebner is currently offline Dennis HuebnerFriend
Messages: 257
Registered: July 2009
Senior Member

Hi Hallvard,
I see what you mean. Yes, we depend on org.eclipse.equinox.common because of one used class org.eclipse.core.runtime.OperationCanceledException

As you already mentioned equinox.common depends only on org.eclipse.osgi where the problematic class org.eclipse.osgi.internal.framework.SystemBundleActivator is located.

I'm not sure how to solve the problem on our side.

I was thinking about a test setup for our test server where we can test that xtext can be used in other OSGI frameworks. Do you have an example project/setup so I can try it out?



+Dennis Huebner

Get professional support from the Xtext committers at www.typefox.io
Re: Running Xtext on Karaf Felix [message #1710911 is a reply to message #1705984] Sat, 10 October 2015 19:50 Go to previous messageGo to next message
Markus Rathgeb is currently offline Markus RathgebFriend
Messages: 105
Registered: August 2014
Senior Member

Hello,

are there any news / a resolution?

> Yes, we depend on org.eclipse.equinox.common because of one used class org.eclipse.core.runtime.OperationCanceledException

If the one exception is the only reason to depend on org.eclipse.equinox.common (that themselves depends on org.eclipse.osgi) why not using another / a self-made exception?

[Updated on: Tue, 27 October 2015 08:24]

Report message to a moderator

Re: Running Xtext on Karaf Felix [message #1714155 is a reply to message #1706152] Tue, 10 November 2015 10:23 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I've recently revisited this issue, as I needed to demonstrate that
(the runtime part of) an application built on Eclipse could be moved
onto Karaf and deployed in the cloud. As mentioned, the issue was that
Xtext requires the org.eclipse.equinox.common bundle, and this bundle
cannot be moved to Karaf, since it depends on (an)other
Equinox-specific bundle(s).

My solution was to make a "fake" org.eclipse.equinox.common bundle
containing only the classes that Xtext actually uses. Through trial and
error, I found that two classes are needed (not one as stated below),
org.eclipse.core.runtime.OperationCanceledException and
org.eclipse.core.runtime.IProgressMonitor. I copied these into the fake
bundle and deployed it with Xtext, and it worked! By worked, I mean
that I could load DSL instances, which is what I need. I take care to
call the generated StandaloneSetup.doSetup() first, so the DSL file
extension is recognized and the correct ResourceFactory is used.

Note that my fake org.eclipse.equinox.common bundle was built outside
Eclipse with maven, or else Eclipse would think it was a replacement
for its internal one and lots of things would break. I also needed to
take care to not run "maven install", but only "maven package", since
install makes the bundle available locally and will trick Tycho into
using it instead of the real one.

Could Xtext have made it easier? The best would be if the dependency
was optional, i.e. Xtext could detect the presence without trying to
load the classes, and then only use them only if they are available.
Perhaps Xtext could provide two "glue" bundles (fragments), one for use
with Equinox and one for other frameworks? I think it also would be
better if the dependency was to a specific package, so I needn't name
the bundle the same as the original, e.g. provide a "compatibility"
bundle.

I'll gladly help you try it out, now that I have at least one
"solution" working.

Hallvard

On 2015-08-24 08:39:28 +0000, Dennis Huebner said:

> Hi Hallvard,
> I see what you mean. Yes, we depend on org.eclipse.equinox.common
> because of one used class
> org.eclipse.core.runtime.OperationCanceledException
>
> As you already mentioned equinox.common depends only on
> org.eclipse.osgi where the problematic class
> org.eclipse.osgi.internal.framework.SystemBundleActivator is located.
>
> I'm not sure how to solve the problem on our side.
>
> I was thinking about a test setup for our test server where we can test
> that xtext can be used in other OSGI frameworks. Do you have an
> example project/setup so I can try it out?


--
Hallvard Trætteberg (hal@xxxxxxxx.no)
Associate Professor, IS group, Dept. of Computer and Information
Science at the
Norwegian Univ. of Science and Technology
Re: Running Xtext on Karaf Felix [message #1714271 is a reply to message #1714155] Wed, 11 November 2015 09:21 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Hallvard,

could you read through https://bugs.eclipse.org/bugs/show_bug.cgi?id=434490
and describe how your case there and how it is different?

Cheers,
Sven
Re: Running Xtext on Karaf Felix [message #1714272 is a reply to message #1714155] Wed, 11 November 2015 09:22 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Hallvard,

could you read through https://bugs.eclipse.org/bugs/show_bug.cgi?id=434490
and add a comment about your case and how it is different?

Cheers,
Sven
Re: Running Xtext on Karaf Felix [message #1714339 is a reply to message #1714272] Wed, 11 November 2015 22:16 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
I have added a comment
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=434490#c11). I didn't
reopen the issue, but I believe it should be.

Hallvard

On 2015-11-11 09:22:19 +0000, Sven Efftinge said:

> Hi Hallvard,
>
> could you read through https://bugs.eclipse.org/bugs/show_bug.cgi?id=434490
> and add a comment about your case and how it is different?
>
> Cheers,
> Sven
> --


--
Hallvard Trætteberg (hal@xxxxxxxx.no)
Associate Professor, IS group, Dept. of Computer and Information
Science at the
Norwegian Univ. of Science and Technology
Previous Topic:Override 'Couldn't resolve reference' quickfix
Next Topic:File header not propagated to generated ecore model
Goto Forum:
  


Current Time: Tue Mar 19 10:39:24 GMT 2024

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

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

Back to the top