Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » OM2M » migrate OM2M bundle to apache felix
migrate OM2M bundle to apache felix [message #1665885] Wed, 11 March 2015 12:40 Go to next message
Ravi Teja is currently offline Ravi TejaFriend
Messages: 13
Registered: February 2015
Junior Member
Hi Mahdi Ben Alaya

OM2M bundle which presently is in equinox runtime, i want to migrate it to apache felix
so that i can build that bundle for android.

below is the link i am following
http://felix.apache.org/site/apache-felix-framework-and-google-android.html

How should i proceed.

Will the above step will help me to build OM2M in android.

thanks in advance.
Re: migrate OM2M bundle to apache felix [message #1671481 is a reply to message #1665885] Fri, 13 March 2015 16:24 Go to previous messageGo to next message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 229
Registered: November 2013
Senior Member
Hello Ravi,

Your link is not working.
I tested successfully Felix in android in another project, so it should work for you.
We are using the JAXB library for the XML/object mapping, however JAXB classes are not compatible with Android due to lack of support for XML annotations.

You can check this tutorial: "JAXB can be made to run on Android" http://www.docx4java.org/blog/2012/05/jaxb-can-be-made-to-run-on-android/

As alternative, JAXB can be replaced with the SimpleXML library which work very well in Android with good performance.
Check SimpleXML here: http://simple.sourceforge.net/

Mahdi

[Updated on: Fri, 13 March 2015 16:42]

Report message to a moderator

Re: migrate OM2M bundle to apache felix [message #1678611 is a reply to message #1671481] Mon, 16 March 2015 09:06 Go to previous messageGo to next message
Ravi Teja is currently offline Ravi TejaFriend
Messages: 13
Registered: February 2015
Junior Member
OM2M bundle which presently is in equinox runtime, i want to migrate it to apache felix

Please send some steps to achive it.

Thank you in advance.
Re: migrate OM2M bundle to apache felix [message #1688345 is a reply to message #1678611] Fri, 20 March 2015 14:11 Go to previous messageGo to next message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 229
Registered: November 2013
Senior Member
Hello Ravi,

I don't have the detailed steps to convert an Equinox project to Felix.
I think it is better to ask your question directly to the Equinox Forum: eclipse.org/forums/eclipse.technology.equinox

But the main steps are:
1) Download Apache Felix framework
2) Add the OM2M required bundles to Felix OSGi container.
3) Configure OM2M bundles auto start using Felix.
4) Enter required OM2M parameters into Felix.
5) Start OM2M plugins using Felix

For step 2) and 3)
You have to add the following bundles to your Felix OSGi container, and start the required plugins as explained:

javax.servlet_3.1.0.v20140303-1611.jar
javax.xml_1.3.4.v201005080400.jar
org.apache.commons.codec_1.6.0.v201305230611.jar
org.apache.commons.httpclient_3.1.0.v201012070820.jar
org.apache.commons.logging_1.1.1.v201101211721.jar
org.apache.felix.gogo.command_0.10.0.v201209301215.jar -> (Need to be started)
org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar -> (Need to be started)
org.apache.felix.gogo.shell_0.10.0.v201212101605.jar -> (Need to be started)
org.eclipse.equinox.console_1.1.0.v20140131-1639.jar -> (Need to be started)
org.eclipse.equinox.http.jetty_3.0.200.v20131021-1843.jar -> (Need to be started)
org.eclipse.equinox.http.servlet_1.1.500.v20140318-1755.jar
org.eclipse.jetty.continuation_8.1.14.v20131031.jar
org.eclipse.jetty.http_8.1.14.v20131031.jar
org.eclipse.jetty.io_8.1.14.v20131031.jar
org.eclipse.jetty.security_8.1.14.v20131031.jar
org.eclipse.jetty.server_8.1.14.v20131031.jar
org.eclipse.jetty.servlet_8.1.14.v20131031.jar
org.eclipse.jetty.util_8.1.14.v20131031.jar
org.eclipse.om2m.comm.coap_1.0.0.20141127-1705.jar -> (Need to be started)
org.eclipse.om2m.comm.http_1.0.0.20141127-1705.jar -> (Need to be started)
org.eclipse.om2m.comm.service_1.0.0.20141127-1705.jar
org.eclipse.om2m.commons_1.0.0.20141127-1705.jar
org.eclipse.om2m.core_1.0.0.20141127-1705.jar -> (Need to be started)
org.eclipse.om2m.core.service_1.0.0.20141127-1705.jar
org.eclipse.om2m.ipu.service_1.0.0.20141127-1705.jar
org.eclipse.om2m.webapp.resourcesbrowser_1.0.0.20141127-1705.jar -> (Need to be started)

For step 4)
You have to configure the OM2M parameters (NSCL or GSCL) defined in "config.ini" to Felix specific config file.
For example for the GSCL the following parameters must be available:

org.eclipse.om2m.sclBaseAddress=127.0.0.1
org.eclipse.equinox.http.jetty.http.port=8181
org.eclipse.om2m.remoteNsclId=nscl
org.eclipse.om2m.sclType=GSCL
org.eclipse.om2m.ipu.hue.bridgeip=192.168.0.31
eclipse.p2.profile=DefaultProfile
org.eclipse.om2m.dbFile=gscl.db4o
osgi.framework.extensions=
osgi.bundles.defaultStartLevel=4
org.eclipse.om2m.reset=true
org.eclipse.om2m.sclBaseId=gscl
org.eclipse.om2m.maxNrOfInstances=100
org.eclipse.om2m.remoteNsclCoapPort=5683
org.eclipse.om2m.remoteNsclPort=8080
org.eclipse.om2m.guestRequestingEntity=guest/guest
org.eclipse.om2m.coapPort=5684
org.eclipse.om2m.dbDefragmentPeriod=86400000
org.eclipse.om2m.remoteNsclContext=/om2m
org.eclipse.om2m.adminRequestingEntity=admin/admin
org.eclipse.om2m.remoteNsclAddress=127.0.0.1
org.eclipse.om2m.sclBaseContext=/om2m
org.eclipse.om2m.sclBaseProtocol.default=http

Hope this can help,
Mahdi
Re: migrate OM2M bundle to apache felix [message #1697847 is a reply to message #1688345] Tue, 09 June 2015 01:54 Go to previous messageGo to next message
ZiLiang Han is currently offline ZiLiang HanFriend
Messages: 1
Registered: June 2015
Junior Member
Hi Mahdi Ben Alaya,
I am also trying this, running om2m in Felix. The first step is to replace "Require-Bundle" in manifest header with "Import-Package". for example, bundle org.eclipse.osgi is Eclipse system bundle and should not in the Felix's start-list. Now bundles start successfully except the om2m core plugin:
13|Active 1|Java Persistence API 2.1(2.1.0.v201304241213)
14|Active 1|Apache Commons Logging(1.2.0)
15|Active 1|Commons Http Client(3.1.0.v201012070820)
16|Active 1|Apache Commons Codec Plug-in(1.6.0.v201305230611)
17|Active 1|OM2M Core Service(0.8.0.20150608-0120)
18|Active 1|Commons Utilities(0.8.0.20150608-0120)
19|Active 1|Comm Service(0.8.0.20150608-0120)
20|Active 1|IPU Service(0.8.0.20150608-0120)
21|Active 1|coap(0.8.0.20150608-0120)
22|Active 1|http(0.8.0.20150608-0120)
23|Active 1|Resourcesbrowser(0.8.0.20150608-0120)
24|Idle 1|org.eclipse.om2m Core Plugin(0.8.0.20150608-0120)

The core plugin has problem to create EntityManagerFactory. Here is the log:
"Jan 1, 1970 12:01:13 AM org.eclipse.om2m.core.dao.DBAccess init
SEVERE: Error in creation of EntityManagerFactory
javax.persistence.PersistenceException: No Persistence provider for EntityManager named om2mdb
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
at org.eclipse.om2m.core.dao.DBAccess.init(DBAccess.java:102)
at org.eclipse.om2m.core.Activator.initScl(Activator.java:175)
at org.eclipse.om2m.core.Activator.start(Activator.java:91)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:641)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
at java.lang.Thread.run(Thread.java:745)
Jan 1, 1970 12:01:13 AM org.eclipse.om2m.core.dao.DBAccess init
SEVERE: ERROR initializing Database: EntityManagerFactory is null"


I googled a lot and could not find a solution. Any suggestion for this? thanks




Re: migrate OM2M bundle to apache felix [message #1698679 is a reply to message #1665885] Wed, 17 June 2015 08:51 Go to previous message
Francois AissaouiFriend
Messages: 38
Registered: April 2015
Member
Hi

This a common error with JPA when the framework can not reach the persistence.xml file. Indeed, this file is required to be located in the META-INF folder of the core jar file.

Try to « unjar » the core jar file with the following command : « jar -xvf org.eclipse.om2m.core_*.jar » and check the presence of the persistence.xml file in the META-INF folder.

Usually, the file is copied there by the maven install process. Check the pom.xml file of the core project, it must have the following lines :
<build>
  <resources>
    <resource>
      <directory>META-INF</directory>
      <targetPath>META-INF/</targetPath>
      <includes>
        <include>persistence.xml</include>
      </includes>
    </resource>
  </resources>
</build>


This ensures that the persistence.xml is copied in the jar file.
This should fix the error « No Persistence provider for EntityManager named om2mdb » because the persistence provider is declared in the persistence file.

Tell us if this fix your problem!
François

[Updated on: Wed, 17 June 2015 14:22]

Report message to a moderator

Previous Topic: Usage of NSCL
Next Topic:CoAP interworking, actuation methods.
Goto Forum:
  


Current Time: Tue Mar 19 09:00:13 GMT 2024

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

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

Back to the top