Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Communications Framework (ECF) » Communication between OSGi/Equinox - JMS/ActiveMQ
Communication between OSGi/Equinox - JMS/ActiveMQ [message #624318] Thu, 30 October 2008 10:26 Go to next message
Sebastian Schneider is currently offline Sebastian SchneiderFriend
Messages: 18
Registered: July 2009
Junior Member
Hey,

have someone a example to implement the communication between OSGi/Equinox
and JMS/ActiveMQ?

I've already imported the package org.eclipse.ecf.provider.jms and
activemq and found in the plug-in list the libaries for activemq
(activemq3.1M5) but my example doesn't found the libs nor can these import.

----
ActiveMQQueue queue = new ActiveMQQueue("Queue Test");
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory("tcp://localhost:61616");

ActiveMQConnection connection = (ActiveMQConnection)
factory.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(queue);
producer.send(session.createTextMessage("Test"));
connection.close();
----

Have you any idea?

I need a short example for Queue(Sender/Receiver) and
Topic(Publisher/Subscriber) in OSGi Framework.
How I must to set up my OSGi bundle?

Best regards,
Sebastian
Re: Communication between OSGi/Equinox - JMS/ActiveMQ [message #624319 is a reply to message #624318] Thu, 30 October 2008 17:14 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi Sebastian,

Sebastian Schneider wrote:
> Hey,
>
> have someone a example to implement the communication between
> OSGi/Equinox and JMS/ActiveMQ?
>
> I've already imported the package org.eclipse.ecf.provider.jms and
> activemq and found in the plug-in list the libaries for activemq
> (activemq3.1M5) but my example doesn't found the libs nor can these import.


In my own copy of the org.eclipse.ecf.provider.jms.activemq bundle I
have the various jars referenced on the bundle classpath inside the lib
directory. Are these not present for you inside your project? I
checked on the CVS repository and they also seem to be there.


>
> ----
> ActiveMQQueue queue = new ActiveMQQueue("Queue Test");
> ActiveMQConnectionFactory factory = new
> ActiveMQConnectionFactory("tcp://localhost:61616");
>
> ActiveMQConnection connection = (ActiveMQConnection)
> factory.createConnection();
> Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> MessageProducer producer = session.createProducer(queue);
> producer.send(session.createTextMessage("Test"));
> connection.close();
> ----
>
> Have you any idea?
>
> I need a short example for Queue(Sender/Receiver) and
> Topic(Publisher/Subscriber) in OSGi Framework.
> How I must to set up my OSGi bundle?


I'm not sure what is the problem you identify above (i.e. why the
activemq jars are not included).

As for the analog of what you have above within ECF...the parts dealing
strictly with JMS (i.e. not specific to ActiveMQ) are in:

org.eclipse.ecf.provider.jms.channel.AbstractJMSClientChanne l

which is in the org.eclipse.ecf.provider.jms bundle

and the JMS-specific bits are in the sub-class

org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSC lientContainer.ActiveMQClientChannel

(which is an inner class inside ActiveMQJMSClientContainer) inside the
org.eclipse.ecf.provider.jms.activemq bundle.


The intention here is to separate the active-mq-specific stuff from the
JMS-generic stuff for session/topic setup, so that it is relatively easy
to create other providers based upon other JMS implementers. So, for
example, we have a Webshere JMS impl that is also based upon
org.eclipse.ecf.provider.jms. We would, of course, welcome other JMS
impls and if they want to use/reuse the org.eclipse.ecf.provider.jms to
create them that that is great.

Thanks,

Scott
Re: Communication between OSGi/Equinox - JMS/ActiveMQ [message #624326 is a reply to message #624319] Thu, 06 November 2008 13:15 Go to previous messageGo to next message
Sebastian Schneider is currently offline Sebastian SchneiderFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Scott,

thank you for your reply and this tip.

I implements the following code [1] and it seems to work but I get the
error message [2] and I don't know how I send a message to the ActiveMQ
and receive it again.

---- [1]
try {
IContainer cont =
ContainerFactory.getDefault().createContainer("ecf.jms.activemq.tcp.client ");
ID targetID =
IDFactory.getDefault().createID(cont.getConnectNamespace(),
"tcp://localhost:61616/mytest");
cont.connect(targetID, null);
} catch (ContainerCreateException e) {
e.printStackTrace();
} catch (IDCreateException e) {
e.printStackTrace();
} catch (ContainerConnectException e) {
e.printStackTrace();
}
---- [2]
log4j:WARN No appenders could be found for logger
(org.activemq.transport.tcp.TcpTransportChannel).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN No appenders could be found for logger
(org.activemq.ActiveMQConnection).
log4j:WARN Please initialize the log4j system properly.

org.eclipse.ecf.core.ContainerConnectException: JMS Connect or Setup
Exception
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSClientChanne l.connect(AbstractJMSClientChannel.java:69)
at
org.eclipse.ecf.provider.generic.ClientSOContainer.connect(C lientSOContainer.java:146)
at com.javaworld.sample.helloworld.Activator.start(Activator.ja va:51)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:195)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:297)
org.eclipse.ecf.core.ContainerConnectException[0]: javax.jms.JMSException:
syncSendTimedOut: connection no longer OK
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConne ction.java:1336)
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConne ction.java:1306)
at org.activemq.ActiveMQSession.addConsumer(ActiveMQSession.jav a:1208)
at
org.activemq.ActiveMQMessageConsumer.<init>(ActiveMQMessageConsumer.java:143)
at org.activemq.ActiveMQSession.createConsumer(ActiveMQSession. java:622)
at org.eclipse.ecf.provider.jms.channel.JmsTopic.<init>(JmsTopic.java:31)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSChannel.setu pJMS(AbstractJMSChannel.java:175)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSClientChanne l.connect(AbstractJMSClientChannel.java:63)
at
org.eclipse.ecf.provider.generic.ClientSOContainer.connect(C lientSOContainer.java:146)
at com.javaworld.sample.helloworld.Activator.start(Activator.ja va:51)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:195)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:297)
----

I need really a simple example. I have too little know-how.

Scott Lewis wrote:

> In my own copy of the org.eclipse.ecf.provider.jms.activemq bundle I
> have the various jars referenced on the bundle classpath inside the lib
> directory. Are these not present for you inside your project? I
> checked on the CVS repository and they also seem to be there.

> I'm not sure what is the problem you identify above (i.e. why the
> activemq jars are not included).

> As for the analog of what you have above within ECF...the parts dealing
> strictly with JMS (i.e. not specific to ActiveMQ) are in:

> org.eclipse.ecf.provider.jms.channel.AbstractJMSClientChanne l

> which is in the org.eclipse.ecf.provider.jms bundle

> and the JMS-specific bits are in the sub-class

>
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSC lientContainer.ActiveMQClientChannel

> (which is an inner class inside ActiveMQJMSClientContainer) inside the
> org.eclipse.ecf.provider.jms.activemq bundle.

I forgot to import the other packages of ecf (CVS).

> The intention here is to separate the active-mq-specific stuff from the
> JMS-generic stuff for session/topic setup, so that it is relatively easy
> to create other providers based upon other JMS implementers. So, for
> example, we have a Webshere JMS impl that is also based upon
> org.eclipse.ecf.provider.jms. We would, of course, welcome other JMS
> impls and if they want to use/reuse the org.eclipse.ecf.provider.jms to
> create them that that is great.

I didn't found this example of WebSphere. Where is it?

Thanks.

Best regards,
Sebastian
Re: Communication between OSGi/Equinox - JMS/ActiveMQ [message #624339 is a reply to message #624319] Thu, 20 November 2008 13:54 Go to previous messageGo to next message
Sebastian Schneider is currently offline Sebastian SchneiderFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Scott,

I read in your last post in the newsgroup that we need a broker, a ecf
generic jms server and than can connect the ecf generic client to this
server and activemq. Is it right?

I checked new out yesterday the "plugins/providers" from ecf1.osuosl.org
and found a different in org.eclipse.ecf.provider.jms.activemq/plugin.xml:
It missed the extenstion point of "containerFactory" with the name
"ecf.jms.activemq.tcp.server".

However, in my example code I will create and start the server [1] and
create later the client and try to send a message [2], but the problem is
to create the channel. I get only an error [3] in JMSTopic at the creating
of consumer and provider [4]. At [5] you will see the full stack.

Is it the right way to create the server and client in my example?

I tried also your ActiveMQJMSServer application with the "ActiveMQ JMS
Server.launch" configuration, but I get also an error with this [6] log
message.
My ActiveMQ "Broker" log following message:ERROR TransportConnector -
Could not accept connection : Wire format negotiation timeout: peer did
not send his wire format.

Have you an idea or tip where my problem is?

Thanks and best regards
Sebastian

~~~~ header
public static final String CLIENT_CONTAINER_NAME =
"ecf.jms.activemq.tcp.client";
public static final String SERVER_CONTAINER_NAME =
"ecf.jms.activemq.tcp.server";
public static final String TARGET_NAME = "tcp://localhost:61616/mytest";
//mytest should be the name of the topic?!
~~~~

[1]
IContainer cont_srv =
ContainerFactory.getDefault().createContainer(SERVER_CONTAIN ER_NAME, new
Object[] {TARGET_NAME});
cont_srv.addListener(new IContainerListener() {
public void handleEvent(IContainerEvent event) {
if (event instanceof IContainerConnectedEvent)
serverConnectEvents.add(event);
if (event instanceof IContainerDisconnectedEvent)
serverDisconnectEvents.add(event);
}
});

[2]
IContainer cont =
ContainerFactory.getDefault().createContainer(CLIENT_CONTAIN ER_NAME);
ID targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),
TARGET_NAME);
cont.connect(targetID, null);

IChannelContainerAdapter channelContainerAdapter =
(IChannelContainerAdapter)cont.getAdapter(IChannelContainerA dapter.class);
if(channelContainerAdapter != null){
ID channelID =
IDFactory.getDefault().createID(channelContainerAdapter.getC hannelNamespace(), "mytest");
IChannelListener channelListener = null;
IChannel channel = channelContainerAdapter.createChannel(channelID,
channelListener ,null);
channel.sendMessage("HELLO".getBytes());
}

[3] AbstractJMSChannel::setupJMS Line:175
syncSendTimedOut: connection no longer OK

[4]
public JmsTopic(Session session, String topic) throws JMSException {
destination = session.createTopic(topic); // destination is not null
consumer = session.createConsumer(destination); // I get here an error
producer = session.createProducer(destination);
}

[5]
org.eclipse.ecf.core.ContainerCreateException: Exception creating weblogic
server container
at
org.eclipse.ecf.internal.provider.jms.activemq.ActiveMQJMSSe rverContainerInstantiator.createInstance(ActiveMQJMSServerCo ntainerInstantiator.java:55)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(Contai nerFactory.java:259)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(Contai nerFactory.java:278)
at com.javaworld.sample.helloworld.Activator.start(Activator.ja va:72)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:195)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:297)
org.eclipse.ecf.core.ContainerCreateException[0]:
org.eclipse.ecf.core.util.ECFException: JMS Connect or Setup Exception
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSChannel.setu pJMS(AbstractJMSChannel.java:185)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChanne l. <init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServ erChannel. <init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSS erverContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.internal.provider.jms.activemq.ActiveMQJMSSe rverContainerInstantiator.createInstance(ActiveMQJMSServerCo ntainerInstantiator.java:52)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(Contai nerFactory.java:259)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(Contai nerFactory.java:278)
at com.javaworld.sample.helloworld.Activator.start(Activator.ja va:72)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:195)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:297)
org.eclipse.ecf.core.util.ECFException[0]: javax.jms.JMSException:
syncSendTimedOut: connection no longer OK
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConne ction.java:1336)
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConne ction.java:1306)
at org.activemq.ActiveMQSession.addConsumer(ActiveMQSession.jav a:1208)
at
org.activemq.ActiveMQMessageConsumer.<init>(ActiveMQMessageConsumer.java:143)
at org.activemq.ActiveMQSession.createConsumer(ActiveMQSession. java:622)
at org.eclipse.ecf.provider.jms.channel.JmsTopic.<init>(JmsTopic.java:31)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSChannel.setu pJMS(AbstractJMSChannel.java:175)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChanne l. <init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServ erChannel. <init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSS erverContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.internal.provider.jms.activemq.ActiveMQJMSSe rverContainerInstantiator.createInstance(ActiveMQJMSServerCo ntainerInstantiator.java:52)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(Contai nerFactory.java:259)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(Contai nerFactory.java:278)
at com.javaworld.sample.helloworld.Activator.start(Activator.ja va:72)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:195)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:297)

[6]
!SESSION 2008-11-18 12:35:17.439
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_03
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments: -application
org.eclipse.ecf.provider.jms.ActiveMQServer
tcp://localhost:61616/exampleTopic
Command-line arguments: -application
org.eclipse.ecf.provider.jms.ActiveMQServer -data
C:\Texo_Tools\workspace_osgi/../runtime-ActiveMQJMSServer -dev
file:C:/Texo_Tools/workspace_osgi/.metadata/.plugins/org.ecl ipse.pde.core/ActiveMQ
JMS Server/dev.properties -os win32 -ws win32 -arch x86
tcp://localhost:61616/exampleTopic

!ENTRY org.eclipse.osgi 4 0 2008-11-18 12:35:28.712
!MESSAGE Application error
!STACK 1
org.eclipse.ecf.core.util.ECFException: JMS Connect or Setup Exception
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSChannel.setu pJMS(AbstractJMSChannel.java:185)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChanne l. <init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServ erChannel. <init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSS erverContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.provider.jms.activemq.application.ActiveMQJM SServer.start(ActiveMQJMSServer.java:61)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
org.eclipse.ecf.core.util.ECFException[0]: javax.jms.JMSException:
syncSendTimedOut: connection no longer OK
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConne ction.java:1336)
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConne ction.java:1306)
at org.activemq.ActiveMQSession.addConsumer(ActiveMQSession.jav a:1208)
at
org.activemq.ActiveMQMessageConsumer.<init>(ActiveMQMessageConsumer.java:143)
at org.activemq.ActiveMQSession.createConsumer(ActiveMQSession. java:622)
at org.eclipse.ecf.provider.jms.channel.JmsTopic.<init>(JmsTopic.java:31)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSChannel.setu pJMS(AbstractJMSChannel.java:175)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChanne l. <init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServ erChannel. <init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSS erverContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.provider.jms.activemq.application.ActiveMQJM SServer.start(ActiveMQJMSServer.java:61)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)

!ENTRY org.eclipse.osgi 2 0 2008-11-18 12:35:28.728
!MESSAGE One or more bundles are not resolved because the following root
constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-18 12:35:28.728
!MESSAGE Bundle
update@plugins/org.eclipse.ecf.ssl_1.0.1.v20081006-2232.jar was not
resolved.
!SUBENTRY 2 org.eclipse.ecf.ssl 2 0 2008-11-18 12:35:28.728
!MESSAGE Missing imported package org.eclipse.osgi.service.security_1.0.0.

!ENTRY org.eclipse.osgi 2 0 2008-11-18 12:35:28.728
!MESSAGE The following is a complete list of bundles which are not
resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-18 12:35:28.728
!MESSAGE Bundle
update@plugins/org.eclipse.ecf.ssl_1.0.1.v20081006-2232.jar [184] was not
resolved.
!SUBENTRY 2 org.eclipse.ecf.ssl 2 0 2008-11-18 12:35:28.728
!MESSAGE Missing imported package org.eclipse.osgi.service.security_1.0.0.


> Scott Lewis wrote:
>
> Hi Sebastian,
>
> Sebastian Schneider wrote:
> > Hey,
> >
> > have someone a example to implement the communication between
> > OSGi/Equinox and JMS/ActiveMQ?
> >
> > I've already imported the package org.eclipse.ecf.provider.jms and
> > activemq and found in the plug-in list the libaries for activemq
> > (activemq3.1M5) but my example doesn't found the libs nor
> can these import.
>
>
> In my own copy of the org.eclipse.ecf.provider.jms.activemq bundle I
> have the various jars referenced on the bundle classpath
> inside the lib
> directory. Are these not present for you inside your project? I
> checked on the CVS repository and they also seem to be there.
>
>
> >
> > ----
> > ActiveMQQueue queue = new ActiveMQQueue("Queue Test");
> > ActiveMQConnectionFactory factory = new
> > ActiveMQConnectionFactory("tcp://localhost:61616");
> >
> > ActiveMQConnection connection = (ActiveMQConnection)
> > factory.createConnection();
> > Session session = connection.createSession(false,
> > Session.AUTO_ACKNOWLEDGE);
> > MessageProducer producer = session.createProducer(queue);
> > producer.send(session.createTextMessage("Test"));
> > connection.close();
> > ----
> >
> > Have you any idea?
> >
> > I need a short example for Queue(Sender/Receiver) and
> > Topic(Publisher/Subscriber) in OSGi Framework.
> > How I must to set up my OSGi bundle?
>
>
> I'm not sure what is the problem you identify above (i.e. why the
> activemq jars are not included).
>
> As for the analog of what you have above within ECF...the
> parts dealing
> strictly with JMS (i.e. not specific to ActiveMQ) are in:
>
> org.eclipse.ecf.provider.jms.channel.AbstractJMSClientChanne l
>
> which is in the org.eclipse.ecf.provider.jms bundle
>
> and the JMS-specific bits are in the sub-class
>
> org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSC li
> entContainer.ActiveMQClientChannel
>
> (which is an inner class inside ActiveMQJMSClientContainer)
> inside the
> org.eclipse.ecf.provider.jms.activemq bundle.
>
>
> The intention here is to separate the active-mq-specific
> stuff from the
> JMS-generic stuff for session/topic setup, so that it is
> relatively easy
> to create other providers based upon other JMS implementers. So, for
> example, we have a Webshere JMS impl that is also based upon
> org.eclipse.ecf.provider.jms. We would, of course, welcome other JMS
> impls and if they want to use/reuse the
> org.eclipse.ecf.provider.jms to
> create them that that is great.
>
> Thanks,
>
> Scott
Re: Communication between OSGi/Equinox - JMS/ActiveMQ [message #624340 is a reply to message #624339] Thu, 20 November 2008 13:55 Go to previous messageGo to next message
Sebastian Schneider is currently offline Sebastian SchneiderFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Scott,

Thanks for the tip with the server version. I have used the version 5.1
and changed it to 3.1.

So, your ActiveMQJMSServer works and connect to my ActiveMQ broker.
~
Adding new client: tcp://localhost:61616/mytest on transport:
TcpTransportChannel: Socket[addr=/127.0.0.1,port=2051,localport=61616]
~

> Scott Lewis wrote:
>
> No...actually it's the right way, but it's not enough. That
> is, prior
> to creating the channel on the client, it's necessary to create a
> corresponding channel (of the same name/id) on the server.
> The reason
> for this is that having a server container instance connected to the
> activemq broker is not enough...because ECF multiplexes multiple
> channels on top of the single connection.
>
> So, on the ecf generic server...upon startup you should have
> something
> like this:
>
> (get the server IContainer instance...via IContainerManager
> service or
> through some other means)
>
> IChannelContainerAdapter channelContainerAdapter =
> (IChannelContainerAdapter)cont.getAdapter(IChannelContainerA da
> pter.class);
>
> if(channelContainerAdapter != null){
> ID channelID =
> IDFactory.getDefault().createID(channelContainerAdapter.getC ha
> nnelNamespace(),"mytest");
> IChannelListener listener = <create listener to display
> received messages on the server>
> IChannel serverChannel =
> channelContainerAdapter.createChanne(channelID,listener,null );
> ...store server channel away for later usage for
> sending from server...

The container connect to the broker, but the channelContainerAdapter is
null.

I don't know what I must do with the IContainerManager to get a container?!

Is it right? I'm confused.
IContainer c = ContainerFactory.getDefault().createContainer();
IContainer container = containerManager.getContainer(c.getID());

I need a very simple and complete example for my implementation.

My context:

I try to implement a bundle with some monitoring application.
They listen as subscriber on a channel/topic and send also message
backward to another channel/topic.

At the moment I have only a Activator.java.

Thanks
Sebastian

> but actually, I see that this error message(ultimately coming
> from activemq failure)
> syncSendTimedOut: connection no longer OK
>
> might mean that the ECF generic server is failing to actually
> connect to the activemq broker...perhaps because of version
> incompatibilities.
>
>
> > I tried also your ActiveMQJMSServer application with the
> "ActiveMQ JMS Server.launch" configuration, but I get also an
> error with this [6] log message.
> > My ActiveMQ "Broker" log following message:ERROR
> TransportConnector - Could not accept connection : Wire
> format negotiation timeout: peer did not send his wire format.
> >
> > Have you an idea or tip where my problem is?
> >
>
> I suspect that there are two problems. The first (and hardest) is
> getting the ecf jms generic server (which is actually an activemq
> *client* when it connects to the activemq broker) to create a proper
> connection to the broker. I suspect that this:
>
> My ActiveMQ "Broker" log following message:ERROR
> TransportConnector - Could not accept connection : Wire
> format negotiation timeout: peer did not send his wire format.
>
>
> Which you got in response to the *ecf server/jms client* attempt to
> connect to the broker. My guess is that this is some version
> incompatibility across activemq versions (i.e. on the ecf generic
> server/jms client...which uses the activemq3.1m5) and the activemq
> broker that you are using (I don't know what version you are
> using). So
> we'll have to figure this out by getting some sort of version
> compatiblity (through same/similar activemq versions on broker and on
> ecf servers and clients). If you can let me know what version of the
> broker you are using, I will look into forward porting ECF generic
> server and clients to something compatible with that (i.e. 4.0 or etc)
>
> Then we have the missing code on the server (creating the
> channel as I
> described above). This will be relatively easy to fix once
> we get the
> connection problem worked out with activemq.
>
> So please let me know which version of activemq you are using for the
> broker, and I'll see about getting/updating the ecf activemq generic
> server and client with something compatible.
>
> Thanks much for patience. We'll work this out, but due to
> the length of
> time we have not updated activemq I think we'll need to deal
> with this
> buy forward porting things.
>
> Scott
Re: Communication between OSGi/Equinox - JMS/ActiveMQ [message #624341 is a reply to message #624340] Thu, 20 November 2008 16:28 Go to previous message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi Sebastian,

Sebastian Schneider wrote:
> Hi Scott,
>
> Thanks for the tip with the server version. I have used the version 5.1
> and changed it to 3.1.
>
> So, your ActiveMQJMSServer works and connect to my ActiveMQ broker.


That's good to hear. I wouldn't mind moving over to use a more recent
ActiveMQ implementation...if this is something important to you please
open an enhancement request (with the version desired) so we can know
which version to focus on and can track (as well as communicate directly
with you and other interested parties about progress).

> ~
<stuff deleted>
>
> The container connect to the broker, but the channelContainerAdapter is
> null.
>
> I don't know what I must do with the IContainerManager to get a container?!

Probably the easiest is to do:

IContainerManager manager = (IContainerManager)
ContainerFactory.getDefault();

IContainer [] containers = manager.getAllContainers();
(should return one container...i.e. the server container instance)
IChannelContainerAdapter adapter = (IChannelContainerAdapter)
containers[0].getAdapter(IChannelContainerAdapter.class);

But actually, I would recommend that you get the IContainerManager via
the OSGi service rather than via the static
ContainerFactory.getDefault() method (i.e. the IContainerManager is an
OSGi service, so you can get access to it via the ServiceTracker (see
here for an article about that, as it will be useful in other contexts:

http://www.eclipsezone.com/eclipse/forums/t90796.html

>
> I need a very simple and complete example for my implementation.
>
> My context:
>
> I try to implement a bundle with some monitoring application.
> They listen as subscriber on a channel/topic and send also message
> backward to another channel/topic.
>
> At the moment I have only a Activator.java.

I would/will be happy to produce a hello world example application, but
I need to travel soon and so will need a little time to do so.

Would you file an enhancement request to do this at
http://bugs.eclipse.org and it will allow me to not have the request get
lost given my traveling and such. In the mean time, the example code
for datashare can/could be helpful as well:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tes ts/bundles/org.eclipse.ecf.tests.datashare/src/org/eclipse/e cf/tests/datashare/?root=RT_Project

Thanks,

Scott


>
> Thanks
> Sebastian
>
>> but actually, I see that this error message(ultimately coming from
>> activemq failure)
>> syncSendTimedOut: connection no longer OK
>>
>> might mean that the ECF generic server is failing to actually connect
>> to the activemq broker...perhaps because of version incompatibilities.
>>
>>
>> > I tried also your ActiveMQJMSServer application with the "ActiveMQ
>> JMS Server.launch" configuration, but I get also an error with this
>> [6] log message.
>> > My ActiveMQ "Broker" log following message:ERROR TransportConnector
>> - Could not accept connection : Wire format negotiation timeout: peer
>> did not send his wire format.
>> >
>> > Have you an idea or tip where my problem is?
>> >
>> I suspect that there are two problems. The first (and hardest) is
>> getting the ecf jms generic server (which is actually an activemq
>> *client* when it connects to the activemq broker) to create a proper
>> connection to the broker. I suspect that this:
>>
>> My ActiveMQ "Broker" log following message:ERROR TransportConnector -
>> Could not accept connection : Wire format negotiation timeout: peer
>> did not send his wire format.
>>
>>
>> Which you got in response to the *ecf server/jms client* attempt to
>> connect to the broker. My guess is that this is some version
>> incompatibility across activemq versions (i.e. on the ecf generic
>> server/jms client...which uses the activemq3.1m5) and the activemq
>> broker that you are using (I don't know what version you are using).
>> So we'll have to figure this out by getting some sort of version
>> compatiblity (through same/similar activemq versions on broker and on
>> ecf servers and clients). If you can let me know what version of the
>> broker you are using, I will look into forward porting ECF generic
>> server and clients to something compatible with that (i.e. 4.0 or etc)
>>
>> Then we have the missing code on the server (creating the channel as I
>> described above). This will be relatively easy to fix once we get the
>> connection problem worked out with activemq.
>>
>> So please let me know which version of activemq you are using for the
>> broker, and I'll see about getting/updating the ecf activemq generic
>> server and client with something compatible.
>>
>> Thanks much for patience. We'll work this out, but due to the length
>> of time we have not updated activemq I think we'll need to deal with
>> this buy forward porting things.
>>
>> Scott
>
Previous Topic:Where is ScribbleShare Tutorial and other ECF examples?
Next Topic:DocShare not working
Goto Forum:
  


Current Time: Fri Apr 19 13:11:04 GMT 2024

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

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

Back to the top