users@glassfish.java.net

[gf-users] Re: please help me to confirm if it is a bug in connector component in GF4.1

From: William <streetpoet_at_163.com>
Date: Tue, 24 Feb 2015 15:37:15 +0800

Thanks for your quick reply.
Yes, of course, I paste ‘jms-service’ element here, and you can read whole file as attached file.

      <jms-service default-jms-host="default_JMS_host" type="EMBEDDED">
        <jms-host port="${JMS_PROVIDER_PORT}" host="localhost" name="default_JMS_host"></jms-host>
      </jms-service>

The overview of my idea is that I have a local glassfish server, and a remote one.
The remote glassfish should be as a JMS provider which generates jms messages.
I plan to develop/deploy a MDB in local glassfish server, to receive messages from the remote glassfish.
From reading document, I think it should be specified remote ip:port info by setting connectionFactoryLookup attribute.
But I failed to do that.



also I try to add ‘jmsra ‘ and remove @JMSDestinationDefinition, but it seems not work :(
thanks very much!

William
2015/2/24



> On Feb 24, 2015, at 1:08 AM, Nigel Deakin <nigel.deakin_at_oracle.com> wrote:
>
> William,
>
> The ClassCastException is caused by a mixup somehow in the type of the ConnectionFactory: ConnectionFactoryAdapter is used for remote connections, DirectConnectionFactory is used for direct (embedded) connections.
>
> Can you supply the domain.xml for the GlassFish instance into which you're deploying the MDB? I'm interested in the jms-service element.
>
>
> Nigel
>
>
> On 23/02/2015 16:29, William wrote:
>> Dear all,
>>
>> I plan to use a message driven bean to receive messages from a remote embed JMS provider in remote Glassfish Server
>> 4.1(openMQ as default).
>> From instruction of javaEE7.pdf and bunddled sample code from GF4.1, I write a simple MDB as below.
>>
>> @JMSDestinationDefinition(
>> name = "jms/BillReceiveQueue",
>> interfaceName = "javax.jms.Queue",
>> destinationName = "BillReceiveQueue")
>> @MessageDriven(activationConfig = {
>> @ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "jms/TestFactory"),
>> @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "jms/BillReceiveQueue"),
>> @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
>> })
>> *public* *class* TestMDB *implements* MessageListener {
>>
>>
>> @Override
>> *public* *void* onMessage(Message inMessage) {
>>
>>
>> }
>> }
>>
>> I create jms/TestFactory in admin GUI console with java.jms.ConnectionFactory resource type.
>> And create jms/BillReceiveQueue in admin GUI console with javax.jms.Queue resource type.
>>
>> During the deployment, I got the error:
>>
>> 2015-02-24T00:07:50.718+0800|Warning: RAR8501: Exception during endpoint activation for ra [ jmsra ],
>> activationSpecClass [ com.sun.messaging.jms.ra.ActivationSpec ] : java.lang.ClassCastException:
>> com.sun.messaging.jms.ra.ConnectionFactoryAdapter cannot be cast to com.sun.messaging.jms.ra.DirectConnectionFactory
>> 2015-02-24T00:07:50.718+0800|Severe: MDB00017: [TestMDB]: Exception in creating message-driven bean container:
>> [java.lang.Exception]
>> 2015-02-24T00:07:50.719+0800|Severe: java.lang.Exception
>> java.lang.Exception
>> at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:215)
>> at org.glassfish.ejb.mdb.MessageBeanContainer.<init>(MessageBeanContainer.java:252)
>> at org.glassfish.ejb.mdb.MessageBeanContainerFactory.createContainer(MessageBeanContainerFactory.java:63)
>> at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:221)
>>
>>
>> From documents, I didn’t find any instruction that telling me to change any other setting or configuration.
>> So I wonder why it throws a ClassCastException here? Did I miss something?
>> Thank you for your kindness reply.
>>
>> William
>> 2015/2/24
>>