[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.technology.ecf] Re: Communication between OSGi/Equinox - JMS/ActiveMQ
|
- From: se.schneider@xxxxxxx (Sebastian Schneider)
- Date: Thu, 20 Nov 2008 13:54:06 +0000 (UTC)
- Newsgroups: eclipse.technology.ecf
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
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_CONTAINER_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_CONTAINER_NAME);
ID targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),
TARGET_NAME);
cont.connect(targetID, null);
IChannelContainerAdapter channelContainerAdapter =
(IChannelContainerAdapter)cont.getAdapter(IChannelContainerAdapter.class);
if(channelContainerAdapter != null){
ID channelID =
IDFactory.getDefault().createID(channelContainerAdapter.getChannelNamespace(),"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.ActiveMQJMSServerContainerInstantiator.createInstance(ActiveMQJMSServerContainerInstantiator.java:55)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(ContainerFactory.java:259)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(ContainerFactory.java:278)
at com.javaworld.sample.helloworld.Activator.start(Activator.java: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.startActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(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.setupJMS(AbstractJMSChannel.java:185)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChannel.<init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServerChannel.<init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSServerContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.internal.provider.jms.activemq.ActiveMQJMSServerContainerInstantiator.createInstance(ActiveMQJMSServerContainerInstantiator.java:52)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(ContainerFactory.java:259)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(ContainerFactory.java:278)
at com.javaworld.sample.helloworld.Activator.start(Activator.java: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.startActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(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(ActiveMQConnection.java:1336)
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1306)
at org.activemq.ActiveMQSession.addConsumer(ActiveMQSession.java: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.setupJMS(AbstractJMSChannel.java:175)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChannel.<init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServerChannel.<init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSServerContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.internal.provider.jms.activemq.ActiveMQJMSServerContainerInstantiator.createInstance(ActiveMQJMSServerContainerInstantiator.java:52)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(ContainerFactory.java:259)
at
org.eclipse.ecf.core.ContainerFactory.createContainer(ContainerFactory.java:278)
at com.javaworld.sample.helloworld.Activator.start(Activator.java: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.startActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(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.eclipse.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.setupJMS(AbstractJMSChannel.java:185)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChannel.<init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServerChannel.<init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSServerContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.provider.jms.activemq.application.ActiveMQJMSServer.start(ActiveMQJMSServer.java:61)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.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(ActiveMQConnection.java:1336)
at
org.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1306)
at org.activemq.ActiveMQSession.addConsumer(ActiveMQSession.java: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.setupJMS(AbstractJMSChannel.java:175)
at
org.eclipse.ecf.provider.jms.channel.AbstractJMSServerChannel.<init>(AbstractJMSServerChannel.java:33)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQServerChannel.<init>(ActiveMQServerChannel.java:24)
at
org.eclipse.ecf.provider.jms.activemq.container.ActiveMQJMSServerContainer.start(ActiveMQJMSServerContainer.java:38)
at
org.eclipse.ecf.provider.jms.activemq.application.ActiveMQJMSServer.start(ActiveMQJMSServer.java:61)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.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.AbstractJMSClientChannel
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.ActiveMQJMSCli
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