0

I have installed Rifidi edge server (open source RFID middleware provide services as osgi bundles) on windows7 and I am trying to develop a java application to connect and communicate with Rifidi edge server. I tried in two ways, firstly from an application external to Rifidi Edge Server and secondly from a OSGi bundle internal to rifidi edge server following link http://wiki.rifidi.net/index.php?title=EdgeServerJMS , I face following problems in both ways.

1) From application external to Rfifid Edge Server

Code of rifidi.xml is

 <bean id="connectionFactory"  class="org.apache.activemq.spring.ActiveMQConnectionFactory">
        <property name ="brokerURL" value="tcp://localhost:1099"/>
        <property name="useAsyncSend" value="true"/>
     </bean>

  <bean id="topic" class="org.apache.activemq.command.ActiveMQTopic">
        <constructor-arg value="org.rifidi.edge.external.tags"/>
    </bean>

and code of java file is

   Connection connection;

   ApplicationContext ctx = new ClassPathXmlApplicationContext("rifiditest/rifidi.xml");

   ConnectionFactory cf=(ConnectionFactory) ctx.getBean("connectionFactory");  
        
   connection = cf.createConnection();
          
   Destination dest1=(Topic) ctx.getBean("topic");

   Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);

In this case code is working fine but giving Exception java.io.EOFException at Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);

2) From OSGi bundle internal to Rifidi Edge Server In this case i am using 2 ways to get data using JMS. Firstly by using JMS ConnectionFactory and JMS Topic object and secondly by MessageListener interface

2)(i) By using JMS ConnectionFactory and JMS Topic object

Code of spring xml is

      <bean id="connectionFactory"  class="org.apache.activemq.spring.ActiveMQConnectionFactory">         
         <property name ="brokerURL" value="vm://externalBroker"/>
        <property name="useAsyncSend" value="true"/>
     </bean> 
     <bean id="externalMB" class="org.apache.activemq.command.ActiveMQTopic">
                <constructor-arg value="org.rifidi.edge.external.tags"/>
      </bean> 

   <bean name="hello" class="com.javaworld.rifiditest.Helloworld"
    init-method="start" destroy-method="stop" >
     <property name="connectionFactory" ref="connectionFactory"/>
     <property name="externalMB" ref="externalMB"/>
   </bean>

Code of com.javaworld.rifiditest.Helloworld.java is

    Connection connection;
  
    connection = connectionFactory.createConnection();
   
     Session session = connection.createSession(false,  Session.AUTO_ACKNOWLEDGE);
   
     connection.start();

     Destination dest=externalMB;

     MessageConsumer consumer=session.createConsumer(dest);

 TextMessage m=(TextMessage) consumer.receive();

     System.out.println("---"+m.getText());

     connection.close();

It is executing fine but execution hangs at TextMessage m=(TextMessage) consumer.receive(); and not giving any error.

2)(ii) By using MessageListener interface

When using org.rifidi.edge.internal not getting any data and it is giving warning warning, WARN org.apache.activemq.broker.jmx.ManagementContext:357 - Failed to start jmx connector: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]

When using org.rifidi.edge.external.tags no error and not getting any data.

Kind help me to solve this PROBLEM

Community
  • 1
  • 1
  • "It is not working" is not a very useful error description. What actually happened, what did you *expect* to happen, was there any error message, etc... – Neil Bartlett Dec 14 '13 at 09:49
  • Dear Neil,Thanks a lot for your kind reply.I am not getting any error message.I expect to get POJO provided by Rifidi Edge Server using in spring xml. But on doing this my Osgi Bundle is not reading xml. I am exactly following these links http://wiki.rifidi.net/index.php?title=Edge_Server_Architecture http://wiki.rifidi.net/index.php?title=EdgeServerJMS to access services of rifidi edge server – Faisal Habib Dec 14 '13 at 12:05
  • @NeilBartlett Please ask if you still not getting my question.I have created & exported my own service in OSGI bundle & accessing it from another OSGI bundle using tag in spring xml, Bundle is reading xml & I am getting object from exported service easily.But when I am trying to access services exported by Rifidi edge server,my bundle is not reading xml.For your reference these links http://wiki.rifidi.net/index.php?title=Edge_Server_Architecture & http://wiki.rifidi.net/index.php?title=EdgeServerJMS shows what I am exactly trying to do.Kindly help me out with this problem. – Faisal Habib Dec 14 '13 at 12:51
  • Hello @NeilBartlett , I am getting following error when I am using osgi:reference tag **ERROR org.springframework.osgi.extender.internal.dependencies .startup.DependencyWaiterApplicationContextExecutor:395 - Unable to create appli cation context for [com.javaworld.rifiditest], unsatisfied dependencies: none java.lang.NoSuchMethodError: org.springframework.osgi.service.importer.support.A bstractOsgiServiceImportFactoryBean.isMandatory()Z** – Faisal Habib Dec 18 '13 at 10:41

2 Answers2

0

Don't know anything about Rifidi edge server, but from OSGi/JMS perspective, the solution depends a little on what you want:

  • If you want to run your own application within the OSGi framework the Rifidi server runs in, you need to create a bundle and subscribe to the JMS topic name (according to the link you indicated) org.rifidi.edge.internal (the name on your question mark).
  • If you want to run your own application outside the Rifidi server OSGi framework (as a separate VM), the JMS topic name is org.rifidi.edge.external.tags. In that case you need to set-up JMS in your own application as well of course. From your post I cannot determine whether you succeeded in that at your step 1.
-1

Rifidi 3.1 now supports rest and mqtt integration with example app

Download latest version here

http://sourceforge.net/projects/rifidi/files/?source=navbar

Wiki

Wiki.rifidi.net

Gábor Bakos
  • 8,982
  • 52
  • 35
  • 52
Brian
  • 1