Jump to content
OpenSplice DDS Forum


  • Content count

  • Joined

  • Last visited

About jonathanknez

  • Rank

Profile Information

  • Company
  1. jonathanknez

    DDS Within Java OSGi

    I am trying to use DDS in a java application running in an OSGi environment. I keep running into class loading and link errors. We have everything working correctly in a standalone non-OSGi java application. I know OpenSplice supports OSGi so hopefully this is a quick problem to solve. Background on our system Builds using maven Our application runs in Apache ServiceMix, which uses Apache Felix as the OSGi runtime. Using Vortex OpenSplice HDE Release 6.7.1705230SS, date 2017-06-05 Running on CentOS 7 Java JDK 1.8 Here is what we did Used maven to manually deploy the dcpssaj5.jar and dcpssaj.jar into the local maven repository so that we could include them in our project’s pom.xml file Updated our pom.xml file to depend on those jars. This allowed us to build our code without issues Loaded the bcpssaj5 bundle. Successfully loaded in Felix. Loaded our freshly build application bundle Initially got class loader errors as “org.opensplice.dds.core.OsplServiceEnvironment” was not found. Updated our code to manually create an OsplServiceEnvironment object. This hack got rid of the class loader errors but now we get link errors on org.opensplice.dds.dcps.ReportStack. Our code is pretty simple public DdsIpcController (int inDomainId) { // force loading of needed class OsplServiceEnvironment temp = new OsplServiceEnvironment(); System.setProperty(ServiceEnvironment.IMPLEMENTATION_CLASS_NAME_PROPERTY, "org.opensplice.dds.core.OsplServiceEnvironment"); // Instantiate a DDS ServiceEnvironment env = ServiceEnvironment.createInstance(this.getClass().getClassLoader()); // Get the DomainParticipantFactory dpf = DomainParticipantFactory.getInstance(env); // Create a DomainParticipant with default domainID domainParticipant = dpf.createParticipant(inDomainId); // Create Reliability and Durability QoS reliability = PolicyFactory.getPolicyFactory(env).Reliability().withReliable(); durability = PolicyFactory.getPolicyFactory(env).Durability().withTransient(); } So clearly we are not using dds correctly in an OSGi environment. I would appreciate any insights anyone has into this problem. Perhaps there is a tutorial or example that shows how to get it working.