You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by dimas <dm...@kaltire.com> on 2015/09/24 20:31:57 UTC

Connect to external (non ActiveMQ) JMS server

Hi All,

I need to consume and send messages from/to some external JMS server
(running SonicMQ). 

Is there any doc that can show how to configure TomEE to work with external
JMS server that is running not ActiveMQ broker?

Cheers,
Dmitry



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Connect to external (non ActiveMQ) JMS server

Posted by Romain Manni-Bucau <rm...@gmail.com>.
ActivationSpecClass org.apache.activemq.ra.ActiveMQActivationSpec is likely
wrong, you need to switch  org.apache.activemq.ra.ActiveMQActivationSpec to
the sonic activation spec class - sorry dont know this one.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-29 10:13 GMT-07:00 dimas <dm...@kaltire.com>:

> Ok, so my mdb container now looks like this:
>
> <Container id="MyJmsMdbContainer" ctype="MESSAGE">
>         ResourceAdapter = MySonicAdapter
>         ActivationSpecClass org.apache.activemq.ra.ActiveMQActivationSpec
>     </Container>
>
> the mdb header :
>
> @MessageDriven(name = "myMDB", activationConfig =  {
>         @ActivationConfigProperty(propertyName  = "destinationType",
>                 propertyValue = "javax.jms.Topic"),
>
>         @ActivationConfigProperty(propertyName  = "subscriptionDurability",
>                 propertyValue = "Durable"),
>
>         @ActivationConfigProperty(propertyName  = "destination",
>                 propertyValue = "Topic"), // Ext. JNDI Name
> })
> public class SimpleMDB  implements MessageListener {
>
> ...
> }
>
> Still getting this:
>
> Caused by: org.apache.openejb.OpenEJBException: Error deploying 'myMDB'.
> Exception: class org.apache.openejb.OpenEJBException: Unable to create
> activation spec: ResourceAdapter is not of type:
> org.apache.activemq.ra.MessageResourceAdapter: Unable to create activation
> spec: ResourceAdapter is not of type:
> org.apache.activemq.ra.MessageResourceAdapter
>         at
>
> org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1374)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
>         ... 63 more
> Caused by: org.apache.openejb.OpenEJBException: Unable to create activation
> spec: ResourceAdapter is not of type:
> org.apache.activemq.ra.MessageResourceAdapter
>         at
>
> org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:244)
>         at
> org.apache.openejb.core.mdb.MdbContainer.deploy(MdbContainer.java:135)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1361)
>         ... 64 more
> Caused by: javax.resource.ResourceException: ResourceAdapter is not of
> type:
> org.apache.activemq.ra.MessageResourceAdapter
>         at
>
> org.apache.activemq.ra.ActiveMQActivationSpec.setResourceAdapter(ActiveMQActivationSpec.java:243)
>         at
>
> org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:240)
>         ... 66 more
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676372.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Connect to external (non ActiveMQ) JMS server

Posted by dimas <dm...@kaltire.com>.
Ok, so my mdb container now looks like this:

<Container id="MyJmsMdbContainer" ctype="MESSAGE">
        ResourceAdapter = MySonicAdapter
        ActivationSpecClass org.apache.activemq.ra.ActiveMQActivationSpec
    </Container>

the mdb header :

@MessageDriven(name = "myMDB", activationConfig =  {
        @ActivationConfigProperty(propertyName  = "destinationType",
                propertyValue = "javax.jms.Topic"),

        @ActivationConfigProperty(propertyName  = "subscriptionDurability",
                propertyValue = "Durable"),

        @ActivationConfigProperty(propertyName  = "destination",
                propertyValue = "Topic"), // Ext. JNDI Name
})
public class SimpleMDB  implements MessageListener {

...
}

Still getting this:

Caused by: org.apache.openejb.OpenEJBException: Error deploying 'myMDB'. 
Exception: class org.apache.openejb.OpenEJBException: Unable to create
activation spec: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter: Unable to create activation
spec: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter
	at
org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1374)
	at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
	... 63 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create activation
spec: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter
	at
org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:244)
	at org.apache.openejb.core.mdb.MdbContainer.deploy(MdbContainer.java:135)
	at
org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1361)
	... 64 more
Caused by: javax.resource.ResourceException: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter
	at
org.apache.activemq.ra.ActiveMQActivationSpec.setResourceAdapter(ActiveMQActivationSpec.java:243)
	at
org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:240)
	... 66 more




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676372.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Connect to external (non ActiveMQ) JMS server

Posted by Romain Manni-Bucau <rm...@gmail.com>.
in the mdb container you can set in the properties:

ActivationSpecClass org.apache.activemq.ra.ActiveMQActivationSpec

AMQ is the default so likely the issue you hit


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-29 9:47 GMT-07:00 dimas <dm...@kaltire.com>:

> this is what is see:
>
> INFO: Configuring Service(id=MySonicAdapter, type=Resource,
> provider-id=genericra)
> ..
> INFO: Creating Resource(id=MySonicAdapter)
> Sep 29, 2015 9:50:19 AM org.apache.openejb.assembler.classic.Assembler
> doCreateResource
> INFO: Thread pool size for 'MySonicAdapter' is (30)
>
>
>
> SEVERE: Unable to deploy collapsed ear in war
> StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
> org.apache.openejb.OpenEJBException: Creating application failed:
> D:\play\TestIntegration\target\test-integration-1.0-SNAPSHOT: Error
> deploying 'myMDB'.  Exception: class org.apache.openejb.OpenEJBException:
> Unable to create activation spec: ResourceAdapter is not of type:
> org.apache.activemq.ra.MessageResourceAdapter: Unable to create activation
> spec: ResourceAdapter is not of type:
> org.apache.activemq.ra.MessageResourceAdapter
>
>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676370.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Connect to external (non ActiveMQ) JMS server

Posted by dimas <dm...@kaltire.com>.
this is what is see:

INFO: Configuring Service(id=MySonicAdapter, type=Resource,
provider-id=genericra)
..
INFO: Creating Resource(id=MySonicAdapter)
Sep 29, 2015 9:50:19 AM org.apache.openejb.assembler.classic.Assembler
doCreateResource
INFO: Thread pool size for 'MySonicAdapter' is (30)



SEVERE: Unable to deploy collapsed ear in war
StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
org.apache.openejb.OpenEJBException: Creating application failed:
D:\play\TestIntegration\target\test-integration-1.0-SNAPSHOT: Error
deploying 'myMDB'.  Exception: class org.apache.openejb.OpenEJBException:
Unable to create activation spec: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter: Unable to create activation
spec: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter






--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676370.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Connect to external (non ActiveMQ) JMS server

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can you check the logs about MySonicAdapter and ResourceAdapter (Default
JMS Resource Adapter)? You should see which one is used in the logs normally


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-28 16:33 GMT-07:00 dimas <dm...@kaltire.com>:

> Figured out the how to use ConnectionFactoryProperties (capital first
> letter
> for property name and no spaces), so no jndi is requitred:
>
> ConnectionFactoryProperties =
>
> ConnectionURLs=tcp://dev.test:10400,DefaultUser=user1,DefaultPassword=passw1
>
> Can send messages now, trying to set up MDB in tomee.xml with this block
>
> <Container id="MyJmsMdbContainer" ctype="MESSAGE">
>         ResourceAdapter = MySonicAdapter
>     </Container>
>
> Getting this exception:
>
> Caused by: javax.resource.ResourceException: ResourceAdapter is not of
> type:
> org.apache.activemq.ra.MessageResourceAdapter
>         at
>
> org.apache.activemq.ra.ActiveMQActivationSpec.setResourceAdapter(ActiveMQActivationSpec.java:243)
>         at
>
> org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:240)
>         ... 66 more
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676363.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Connect to external (non ActiveMQ) JMS server

Posted by dimas <dm...@kaltire.com>.
Figured out the how to use ConnectionFactoryProperties (capital first letter
for property name and no spaces), so no jndi is requitred:

ConnectionFactoryProperties =
ConnectionURLs=tcp://dev.test:10400,DefaultUser=user1,DefaultPassword=passw1

Can send messages now, trying to set up MDB in tomee.xml with this block 

<Container id="MyJmsMdbContainer" ctype="MESSAGE">
        ResourceAdapter = MySonicAdapter
    </Container>

Getting this exception:

Caused by: javax.resource.ResourceException: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter
	at
org.apache.activemq.ra.ActiveMQActivationSpec.setResourceAdapter(ActiveMQActivationSpec.java:243)
	at
org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:240)
	... 66 more



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676363.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Connect to external (non ActiveMQ) JMS server

Posted by Romain Manni-Bucau <rm...@gmail.com>.
try: ConnectionFactoryJndiName = openejb:Resource/sonicConnectionFactory


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-28 10:26 GMT-07:00 dimas <dm...@kaltire.com>:

> It almost works. I had to specify ProviderIntegrationMode = jndi in the
> Resource block like this because broker url in the connection properties is
> ignored (and it always tries to connect to localhost)
>
> <Resource id="MySonicAdapter" type="GenericJMSRA"
> provider="com.kaltire:genericra">
>         UserName = brCentral
>         Password = brCentral
>         ProviderIntegrationMode = jndi
>         JndiProperties = "java.naming.provider.url=tcp://dev.test:1401"
>     </Resource>
>
> Getting this exception:
>
> Sep 28, 2015 10:26:41 AM
> org.apache.geronimo.connector.outbound.MCFConnectionInterceptor
> getConnection
> SEVERE: Error occurred creating ManagedConnection for handle:
> nullManagedConnectionInfo:
> org.apache.geronimo.connector.outbound.ManagedConnectionInfo@63a8d3d. mc:
> null]
> javax.resource.ResourceException: Name [sonicConnectionFactory] is not
> bound
> in this Context. Unable to find [sonicConnectionFactory].
>         at
>
> com.sun.genericra.util.ExceptionUtils.newResourceException(ExceptionUtils.java:73)
>         at
>
> com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:128)
>         at
>
> org.apache.geronimo.connector.outbound.MCFConnectionInterceptor.getConnection(MCFConnectionInterceptor.java:48)
>         at
>
> org.apache.geronimo.connector.outbound.LocalXAResourceInsertionInterceptor.getConnection(LocalXAResourceInsertionInterceptor.java:41)
>         at
>
> org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor.internalGetConnection(SinglePoolConnectionInterceptor.java:70)
>         at
>
> org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:80)
>         at
>
> org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:49)
>         at
>
> org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:101)
>         at
>
> org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnection(ConnectionHandleInterceptor.java:43)
>         at
>
> org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)
>         at
>
> org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor.getConnection(ConnectionTrackingInterceptor.java:66)
>         at
>
> org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:81)
>         at
>
> com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:75)
>         at
> com.kaltire.application.BookService.sendMessage(BookService.java:66)
>
> Caused by: javax.resource.spi.InvalidPropertyException: Name
> [sonicConnectionFactory] is not bound in this Context. Unable to find
> [sonicConnectionFactory].
>         at
>
> com.sun.genericra.util.ExceptionUtils.newInvalidPropertyException(ExceptionUtils.java:42)
>         at
>
> com.sun.genericra.util.ObjectBuilderFactory$JndiObjectBuilder.createObject(ObjectBuilderFactory.java:99)
>         at
> com.sun.genericra.util.ObjectBuilder.build(ObjectBuilder.java:99)
>         at
>
> com.sun.genericra.outbound.AbstractManagedConnectionFactory.initializeConnectionFactory(AbstractManagedConnectionFactory.java:182)
>         at
>
> com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:118)
>         ... 74 more
> Caused by: javax.naming.NameNotFoundException: Name
> [sonicConnectionFactory]
> is not bound in this Context. Unable to find [sonicConnectionFactory].
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:819)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
>         at
> org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
>         at javax.naming.InitialContext.lookup(InitialContext.java:417)
>         at
>
> com.sun.genericra.util.ObjectBuilderFactory$JndiObjectBuilder.createObject(ObjectBuilderFactory.java:97)
>         ... 77 more
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676351.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Connect to external (non ActiveMQ) JMS server

Posted by dimas <dm...@kaltire.com>.
It almost works. I had to specify ProviderIntegrationMode = jndi in the
Resource block like this because broker url in the connection properties is
ignored (and it always tries to connect to localhost)

<Resource id="MySonicAdapter" type="GenericJMSRA"
provider="com.kaltire:genericra">
        UserName = brCentral
        Password = brCentral
        ProviderIntegrationMode = jndi
        JndiProperties = "java.naming.provider.url=tcp://dev.test:1401"
    </Resource>

Getting this exception:

Sep 28, 2015 10:26:41 AM
org.apache.geronimo.connector.outbound.MCFConnectionInterceptor
getConnection
SEVERE: Error occurred creating ManagedConnection for handle:
nullManagedConnectionInfo:
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@63a8d3d. mc:
null]
javax.resource.ResourceException: Name [sonicConnectionFactory] is not bound
in this Context. Unable to find [sonicConnectionFactory].
	at
com.sun.genericra.util.ExceptionUtils.newResourceException(ExceptionUtils.java:73)
	at
com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:128)
	at
org.apache.geronimo.connector.outbound.MCFConnectionInterceptor.getConnection(MCFConnectionInterceptor.java:48)
	at
org.apache.geronimo.connector.outbound.LocalXAResourceInsertionInterceptor.getConnection(LocalXAResourceInsertionInterceptor.java:41)
	at
org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor.internalGetConnection(SinglePoolConnectionInterceptor.java:70)
	at
org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:80)
	at
org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:49)
	at
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:101)
	at
org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnection(ConnectionHandleInterceptor.java:43)
	at
org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)
	at
org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor.getConnection(ConnectionTrackingInterceptor.java:66)
	at
org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:81)
	at
com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:75)
	at com.kaltire.application.BookService.sendMessage(BookService.java:66)

Caused by: javax.resource.spi.InvalidPropertyException: Name
[sonicConnectionFactory] is not bound in this Context. Unable to find
[sonicConnectionFactory].
	at
com.sun.genericra.util.ExceptionUtils.newInvalidPropertyException(ExceptionUtils.java:42)
	at
com.sun.genericra.util.ObjectBuilderFactory$JndiObjectBuilder.createObject(ObjectBuilderFactory.java:99)
	at com.sun.genericra.util.ObjectBuilder.build(ObjectBuilder.java:99)
	at
com.sun.genericra.outbound.AbstractManagedConnectionFactory.initializeConnectionFactory(AbstractManagedConnectionFactory.java:182)
	at
com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:118)
	... 74 more
Caused by: javax.naming.NameNotFoundException: Name [sonicConnectionFactory]
is not bound in this Context. Unable to find [sonicConnectionFactory].
	at org.apache.naming.NamingContext.lookup(NamingContext.java:819)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
	at javax.naming.InitialContext.lookup(InitialContext.java:417)
	at
com.sun.genericra.util.ObjectBuilderFactory$JndiObjectBuilder.createObject(ObjectBuilderFactory.java:97)
	... 77 more








--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676351.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Connect to external (non ActiveMQ) JMS server

Posted by Romain Manni-Bucau <rm...@gmail.com>.
    <Resource id="MySonicJmsConnectionFactory"
type="javax.jms.ConnectionFactory">

this type implies using AMQ (
org.apache.activemq.ra.ActiveMQManagedConnectionFactory)

just define your connection factory using a provider as well:
provider="com.kaltire:ConnectionFactory"


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-25 16:07 GMT-07:00 dimas <dm...@kaltire.com>:

> Hi Romain,
>
> This is what i packaged in jar as service-jar.xml
> (META-INF/com/company/service-jar.xml) :
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <ServiceJar>
>     <ServiceProvider
>             id="genericra"
>             service="Resource"
>             types="GenericJMSRA"
>             class-name="com.sun.genericra.GenericJMSRA">
>         ConnectionFactoryClassName =
> progress.message.jclient.ConnectionFactory
>         QueueConnectionFactoryClassName =
> progress.message.jclient.QueueConnectionFactory
>         TopicConnectionFactoryClassName =
> progress.message.jclient.TopicConnectionFactory
>         TopicClassName = progress.message.jclient.Topic
>         QueueClassName = progress.message.jclient.Queue
>     </ServiceProvider>
>
>     <ServiceProvider
>             id="ConnectionFactory"
>             service="Resource"
>             types="javax.jms.ConnectionFactory,
> javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory,
> QueueConnectionFactory, TopicConnectionFactory"
>
> class-name="com.sun.genericra.outbound.ManagedJMSConnectionFactory">
>         ConnectionFactoryJndiName = sonicConnectionFactory
>         ConnectionValidationEnabled true
>     </ServiceProvider>
>
>     <ServiceProvider
>             id="Queue"
>             service="Resource"
>             types="javax.jms.Queue, Queue"
>             class-name="com.sun.genericra.outbound.QueueProxy">
>         QueueClassName = progress.message.jclient.Queue
>     </ServiceProvider>
>
>     <ServiceProvider
>             id="Topic"
>             service="Resource"
>             types="javax.jms.Topic, Topic"
>             class-name="com.sun.genericra.outbound.TopicProxy">
>         DestinationJndiName = kt.kaltire.ari.trigger
>         TopicClassName = progress.message.jclient.Topic
>     </ServiceProvider>
> </ServiceJar>
>
> Here is what releven sections of tomee.xml look like:
>
> <Resource id="MySonicAdapter" type="GenericJMSRA"
> provider="com.kaltire:genericra">
>         ServerUrl = tcp://sonic.host.com:10400
>         UserName = someuser
>         Password = somepassw
>     </Resource>
>
>     <Resource id="MySonicJmsConnectionFactory"
> type="javax.jms.ConnectionFactory">
>         ResourceAdapter = MySonicAdapter
>     </Resource>
>
> and here is the error I'm getting at the start up:
>
> INFO: Creating Resource(id=MySonicJmsConnectionFactory)
> Sep 25, 2015 4:03:29 PM org.apache.openejb.util.OpenEJBErrorHandler
> handleUnknownError
> SEVERE: FATAL ERROR: Unknown error in Assembler.  Please send the following
> stack trace and this message to users@tomee.apache.org :
>  org.apache.xbean.recipe.ConstructionException: Error setting property:
> public void
>
> org.apache.activemq.ra.ActiveMQManagedConnectionFactory.setResourceAdapter(javax.resource.spi.ResourceAdapter)
> throws javax.resource.ResourceException
>         at
> org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:521)
>         at
> org.apache.xbean.recipe.ObjectRecipe.setProperties(ObjectRecipe.java:371)
>         at
> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:286)
>         at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>         at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:2562)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2442)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:527)
>         at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:439)
>         at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
>         at org.apache.openejb.OpenEJB.init(OpenEJB.java:298)
>         at
> org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:256)
>         at
> org.apache.tomee.catalina.ServerListener.install(ServerListener.java:168)
>         at
>
> org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:55)
>         at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
>         at
>
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>         at
>
> org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
>         at
> org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
>         at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
>         at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
> Caused by: javax.resource.ResourceException: ResourceAdapter is not of
> type:
> org.apache.activemq.ra.MessageResourceAdapter
>         at
>
> org.apache.activemq.ra.ActiveMQManagedConnectionFactory.setResourceAdapter(ActiveMQManagedConnectionFactory.java:54)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at
>
> org.apache.xbean.recipe.ObjectRecipe$MethodMember.setValue(ObjectRecipe.java:641)
>         at
> org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:512)
>         ... 25 more
>
>
> I'm probably missed something because looks like it's trying to initiate
> the
> ActiveMQ connection factory.
>
> Dmitry
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676336.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Connect to external (non ActiveMQ) JMS server

Posted by dimas <dm...@kaltire.com>.
Hi Romain,

This is what i packaged in jar as service-jar.xml
(META-INF/com/company/service-jar.xml) :

<?xml version="1.0" encoding="UTF-8"?>

<ServiceJar>
    <ServiceProvider
            id="genericra"
            service="Resource"
            types="GenericJMSRA"
            class-name="com.sun.genericra.GenericJMSRA">
        ConnectionFactoryClassName =
progress.message.jclient.ConnectionFactory
        QueueConnectionFactoryClassName =
progress.message.jclient.QueueConnectionFactory
        TopicConnectionFactoryClassName =
progress.message.jclient.TopicConnectionFactory
        TopicClassName = progress.message.jclient.Topic
        QueueClassName = progress.message.jclient.Queue
    </ServiceProvider>

    <ServiceProvider
            id="ConnectionFactory"
            service="Resource"
            types="javax.jms.ConnectionFactory,
javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory,
QueueConnectionFactory, TopicConnectionFactory"
           
class-name="com.sun.genericra.outbound.ManagedJMSConnectionFactory">
        ConnectionFactoryJndiName = sonicConnectionFactory
        ConnectionValidationEnabled true
    </ServiceProvider>

    <ServiceProvider
            id="Queue"
            service="Resource"
            types="javax.jms.Queue, Queue"
            class-name="com.sun.genericra.outbound.QueueProxy">
        QueueClassName = progress.message.jclient.Queue
    </ServiceProvider>

    <ServiceProvider
            id="Topic"
            service="Resource"
            types="javax.jms.Topic, Topic"
            class-name="com.sun.genericra.outbound.TopicProxy">
        DestinationJndiName = kt.kaltire.ari.trigger
        TopicClassName = progress.message.jclient.Topic
    </ServiceProvider>
</ServiceJar>

Here is what releven sections of tomee.xml look like:

<Resource id="MySonicAdapter" type="GenericJMSRA"
provider="com.kaltire:genericra">
        ServerUrl = tcp://sonic.host.com:10400
        UserName = someuser
        Password = somepassw
    </Resource>

    <Resource id="MySonicJmsConnectionFactory"
type="javax.jms.ConnectionFactory">
        ResourceAdapter = MySonicAdapter
    </Resource>

and here is the error I'm getting at the start up:

INFO: Creating Resource(id=MySonicJmsConnectionFactory)
Sep 25, 2015 4:03:29 PM org.apache.openejb.util.OpenEJBErrorHandler
handleUnknownError
SEVERE: FATAL ERROR: Unknown error in Assembler.  Please send the following
stack trace and this message to users@tomee.apache.org :
 org.apache.xbean.recipe.ConstructionException: Error setting property:
public void
org.apache.activemq.ra.ActiveMQManagedConnectionFactory.setResourceAdapter(javax.resource.spi.ResourceAdapter)
throws javax.resource.ResourceException
	at org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:521)
	at
org.apache.xbean.recipe.ObjectRecipe.setProperties(ObjectRecipe.java:371)
	at
org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:286)
	at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
	at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
	at
org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:2562)
	at
org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2442)
	at
org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:527)
	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:439)
	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
	at org.apache.openejb.OpenEJB.init(OpenEJB.java:298)
	at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:256)
	at
org.apache.tomee.catalina.ServerListener.install(ServerListener.java:168)
	at
org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:55)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
Caused by: javax.resource.ResourceException: ResourceAdapter is not of type:
org.apache.activemq.ra.MessageResourceAdapter
	at
org.apache.activemq.ra.ActiveMQManagedConnectionFactory.setResourceAdapter(ActiveMQManagedConnectionFactory.java:54)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at
org.apache.xbean.recipe.ObjectRecipe$MethodMember.setValue(ObjectRecipe.java:641)
	at org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:512)
	... 25 more


I'm probably missed something because looks like it's trying to initiate the
ActiveMQ connection factory.

Dmitry




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331p4676336.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Connect to external (non ActiveMQ) JMS server

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Dmitry,

I dont know SonicMQ much but
http://tomee.apache.org/changing-jms-implementations.html should help


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-24 11:31 GMT-07:00 dimas <dm...@kaltire.com>:

> Hi All,
>
> I need to consume and send messages from/to some external JMS server
> (running SonicMQ).
>
> Is there any doc that can show how to configure TomEE to work with external
> JMS server that is running not ActiveMQ broker?
>
> Cheers,
> Dmitry
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Connect-to-external-non-ActiveMQ-JMS-server-tp4676331.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>