0

I just start learning how to build a bnd OSGI project. I try to run a very simple project without any error message,but when I go to localhost, it shows "HTTP ERROR: 404".

the simple class:

enter image description here

an Activator class: enter image description here

rest build dependencies

enter image description here

Run dependencies

enter image description here

http error:

enter image description here

Thanks for your helps!!

xiao
  • 542
  • 1
  • 9
  • 16

2 Answers2

4

The latest 2.0.4 release of the org.amdatu.web.rest.wink bundle doesn't play well with Felix Http Jetty 3.x.

If you pin the version of that bundle to the 2.0.3 version things should work as expected. To do this change the org.amdatu.web.rest.wink entry your runbnd.bndrun -runbundles to:

org.amdatu.web.rest.wink;version='[2.0.3,2.0.3]'

  • I think this is it. The demo bundle had the same problem, see the mailing list: http://lists.amdatu.org/pipermail/users/2016-May/000455.html – Jeroen Jun 24 '16 at 07:34
3

Your class is annotated with jax-rs annotations and publishes an OSGi service. If this exposes the services as a REST resources depends on the bundles you install.

You have to install a bundle that watches for such services and creates the REST endpoints for them.

See enter link description here I think you at least need to also add the org.amdatu.web.wink bundle to your bdnrun file.

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • I have added several bundles (web.wink included) and try to create a activator class, but it doesn't work...I am new in this, thanks for your helps – xiao Jun 22 '16 at 09:30
  • You are currently using declarative services. So you should not use an Activator. If you want to run something when a component comes up then use the @Activate annotation. – Christian Schneider Jun 22 '16 at 09:39
  • Sorry.. I think I gave you the wrong hint. @Component hinted that you use DS but I looked it up in the Amdatu tutorial and it seems to be a DM annoation. So you will indeed need some kind of Activator for felix dependency manager to work. I am not familiar with it though. – Christian Schneider Jun 22 '16 at 10:01
  • So he's using DM, which supports both annotations and using an Activator to programmatically publish services. The example above does both. That is not necessary, so either loose the Activator or the @Component annotation. From looking a the list of bundles you run I don't immediately see something that is missing, but since you've added the shell to your project, you might want to type "dm wtf" to figure out if there are service dependencies missing in your setup. If you can't figure this out, please push your project to some public git repository so we can take a look. – Marcel Offermans Jun 23 '16 at 21:47
  • Another thing you could do is to start by following the tutorial, as its first step is to get a REST endpoint up and running. See: http://amdatu.org/tutorial/intro.html – Marcel Offermans Jun 23 '16 at 21:51
  • dm wtf ... I like that syntax :-) – Christian Schneider Jun 24 '16 at 07:03