JBoss AS 7 listening from JBM 1.4 (JBoss 4.x)

287 views
Skip to first unread message

Fernando Troya

unread,
Mar 25, 2014, 4:38:18 PM3/25/14
to jboss-gene...@googlegroups.com
Hi, 

I've constructed generic-jms-ra.rar following the instructions in here https://github.com/jms-ra/generic-jms-ra, section "JBoss Messaging Integration" in particular as we need to consume messages from a JBoss 4.2.3 instance which runs JBM 1.4.

On the client side, I've implemented an MDB following the helloworld-mdb quickstart as stated here
I've added a the ExampleMDB implementation found in the documentation and the following line to META-INF/MANIFEST.MF:
Dependencies: deployment.generic-jms-rar.rar

The I created my custom module for JBM1.4 with every jar in $JBOSS_HOME/client (find it attached). 
I've declared the dependency from the generic rar to this module as well, using the Manifest file.
Dependencies: ar.com.jbm14

I know the dependency is working because a WARN is being logged

16:57:39,243 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.generic-jms-rar.rar" is using a private module ("ar.com.jbm14:main") which may be changed or removed in future versions without notice.


Still, I get the following error and I have no clue what might be wrong about my setup

16:57:40,552 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.ra."deployment.generic-jms-rar" (missing) dependents: [service jboss.deployment.unit."jboss-as-helloworld-mdb.war".component.ExampleMDB.CREATE] 


Last but not least, the annotated class in ExampleMDB

@ResourceAdapter("deployment.generic-jms-rar.rar")
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "/mytopic"),
@ActivationConfigProperty(propertyName = "jndiParameters", 
propertyValue = "java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory;
java.naming.provider.url=192.168.0.60:1099;
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"),
@ActivationConfigProperty(propertyName = "connectionFactory", propertyValue = "XAConnectionFactory") })
public class ExampleMDB implements MessageListener {


Can you spot any errors in the configuration or can guide me on the next steps to follow?

Thanks

module.xml

Justin Bertram

unread,
Mar 25, 2014, 5:39:07 PM3/25/14
to jboss-gene...@googlegroups.com
I believe the problem is with this annotation on your MDB:

@ResourceAdapter("deployment.generic-jms-rar.rar")

The project documentation you cited uses this instead:

@ResourceAdapter("generic-jms-ra-<VERSION>.rar")

Where <VERSION> corresponds to whatever version you built. 

Fernando Troya

unread,
Mar 25, 2014, 5:59:52 PM3/25/14
to jboss-gene...@googlegroups.com
Hi Justin,

thanks for your early response. It turns out I've renamed generic-jms-ra-<VERSION>.rar to generic-jms-rar.rar; on urpose.
I think that's ok as it matches the actual rar in /deployments.

I can't tell what's happening. I've even set generic-jms-rar.rar as the default in standalone-full.xml: 
            <mdb>
                <resource-adapter-ref resource-adapter-name="generic-jms-rar.rar"/>
                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
            </mdb>
and removed the annotation and logs keep throwing

      service jboss.ra.generic-jms-rar (missing) dependents: [service jboss.deployment.unit."jboss-as-helloworld-mdb.war".component.ExampleMDB.CREATE] 

I've cleaned up standalone/data, standalone/tmp and standalone/deployments/jboss-as* with no success.

I haven't modified         <subsystem xmlns="urn:jboss:domain:messaging:1.4">at all as I don't need to produce messages.

What would you do? 

Justin Bertram

unread,
Mar 25, 2014, 6:32:06 PM3/25/14
to jboss-gene...@googlegroups.com

It turns out I've renamed generic-jms-ra-<VERSION>.rar to generic-jms-rar.rar; on urpose.
I think that's ok as it matches the actual rar in /deployments.

Except for the fact that your annotation was:

 @ResourceAdapter("deployment.generic-jms-rar.rar")

Instead of what it should have been:

@ResourceAdapter("generic-jms-rar.rar")

I'm not sure why you prefixed the string with "deployment." but that is incorrect.


 

Fernando Troya

unread,
Mar 25, 2014, 8:29:38 PM3/25/14
to jboss-gene...@googlegroups.com
Right, in https://github.com/jms-ra/generic-jms-ra it says we should add
Dependencies: deployment.generic-jms-rar.rar

To our WARs manifest, that's why I got confused. I think that should read
Dependencies: deployment.generic-jms-ra-<VERSION>.rar

am I right?

I'll try it that way and get back to you

Fernando Troya

unread,
Mar 25, 2014, 8:39:54 PM3/25/14
to jboss-gene...@googlegroups.com
I'm getting the same error with a fresh install of JBoss EAP 6.2.


Error:

21:34:46,486 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.ra."generic-jms-ra-1.0.4.Final-SNAPSHOT" (missing) dependents: [service jboss.deployment.unit."jboss-as-helloworld-mdb.war".component.ExampleMDB.CREATE] 

MDB
@MessageDriven(name = "ExampleMDB", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "app-eventos"),
@ActivationConfigProperty(propertyName = "jndiParameters", propertyValue = "java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory;java.naming.provider.url=192.168.0.57:1099;java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"),
@ActivationConfigProperty(propertyName = "connectionFactory", propertyValue = "app-jms") })
@ResourceAdapter("generic-jms-ra-1.0.4.Final-SNAPSHOT")
public class ExampleMDB implements MessageListener {

MANIFEST in war:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: ftroya
Build-Jdk: 1.7.0_25
Dependencies: generic-jms-ra-1.0.4.Final-SNAPSHOT.rar

I've made no changes to standalone-full.xml.

Any clues?

Justin Bertram

unread,
Mar 25, 2014, 10:53:16 PM3/25/14
to jboss-gene...@googlegroups.com
You're getting yourself confused.

The MDB's @ResourceAdapter annotation should use the bare name of the JCA RA which you're deployed.  For example:

@ResourceAdapter("generic-jms-ra-1.0.4.Final-SNAPSHOT.rar")

You are using this:

@ResourceAdapter("generic-jms-ra-1.0.4.Final-SNAPSHOT")

Which won't work, as you can see.

Furthermore, the "Dependencies" declaration in MANIFEST.MF must prefix the bare name with "deployment."  For example:

Dependencies: deployment.generic-jms-ra-1.0.4.Final-SNAPSHOT.rar

You're using this:

 Dependencies: generic-jms-ra-1.0.4.Final-SNAPSHOT.rar

Which, again, will not work.

You are stripping off the ".rar" and the "deployment." from these respective bits of configuration for some reason.  The project documentation has the right pattern, whether or not the strings contain "<VERSION>".

Fernando Troya

unread,
May 9, 2014, 3:10:10 PM5/9/14
to jboss-gene...@googlegroups.com
Hi again, I think I'm closer to get this working.

So I have solved all the dependencies problems now. Prepending 'deployment.' solved the issue.

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

 
@ActivationConfigProperty(propertyName = "destination", propertyValue = "/topic/defaultEventTopic"),

 
@ActivationConfigProperty(propertyName = "jndiParameters", propertyValue =    
     
"java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory;
       java.naming.provider.url=192.168.x.y:1099;
       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"
),
 
@ActivationConfigProperty(propertyName = "connectionFactory", propertyValue = "remote-conn-factory") })
@ResourceAdapter("generic-jms-ra.rar")

The problem is I'm getting a NPE from JmsActivation's lookup method (generic-jms-ra code), as it can't find "remote-conn-factory" which is under the global JNDI namespace in the producer's JNDI tree.

My resource adapter subsystem conf:

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
   
<resource-adapters>
       
<resource-adapter id="generic-jms-ra.rar">
               
<archive>
                    generic-jms-ra.rar
               
</archive>
               
<connection-definitions>
                   
<connection-definition class-name="org.jboss.resource.adapter.jms.JmsManagedConnectionFactory" jndi-name="java:/GenericJmsXA" enabled="true" use-java-context="true" pool-name="GenericJmsXA" use-ccm="true">
                           
<config-property name="JndiParameters">
                                java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory; java.naming.provider.url=192.168.x.y:1099; java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                           
</config-property>
                           
<config-property name="ConnectionFactory">
                               remote-conn-factory
                           
</config-property>
                       
</connection-definition>
               
</connection-definitions>
         
</resource-adapter>
       
</resource-adapters>
   
</subsystem>


My question is, why is it failing to look up remote-conn-factory?

Thank you

Justin Bertram

unread,
May 12, 2014, 3:03:03 PM5/12/14
to jboss-gene...@googlegroups.com
The problem is I'm getting a NPE from JmsActivation's lookup method (generic-jms-ra code), as it can't find "remote-conn-factory" which is under the global JNDI namespace in the producer's JNDI tree.

Can you paste the stack-trace for the NPE?

Also, who is the "producer" in your scenario and how does it relate to the server hosting the MDB?

Lastly, can you use the "remote-conn-factory" connection factory from a stand-alone JMS client?  If so, what JNDI properties are you using to do so?

Fernando Troya

unread,
May 12, 2014, 3:09:53 PM5/12/14
to jboss-gene...@googlegroups.com
Hey Justin,

This is the stacktrace for the NPE:

09:07:37,798 WARN  [org.jboss.resource.adapter.jms.inflow.JmsActivation] (default-threads - 1) Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@22aa22aa(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@950a950a destination=/topic/defaultEventTopic destinationType=javax.jms.Topic acknowledgeMode=Auto-acknowledge subscriptionDurability=false clientID=genericClientID reconnectInterval=10 reconnectAttempts=-1 user=null maxMessages=1 minSession=1 maxSession=15 connectionFactory=remote-conn-factory jndiParameters={java.naming.provider.url=192.168.0.57:1099, java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}): java.lang.NullPointerException
at org.jboss.resource.adapter.jms.inflow.JmsActivation.lookup(JmsActivation.java:538) [generic-jms-ra-jar-1.0.4.Final-SNAPSHOT.jar:1.0.4.Final-SNAPSHOT]
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupConnection(JmsActivation.java:416) [generic-jms-ra-jar-1.0.4.Final-SNAPSHOT.jar:1.0.4.Final-SNAPSHOT]
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupConnection(JmsActivation.java:398) [generic-jms-ra-jar-1.0.4.Final-SNAPSHOT.jar:1.0.4.Final-SNAPSHOT]
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupActivation(JmsActivation.java:302) [generic-jms-ra-jar-1.0.4.Final-SNAPSHOT.jar:1.0.4.Final-SNAPSHOT]
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:518) [generic-jms-ra-jar-1.0.4.Final-SNAPSHOT.jar:1.0.4.Final-SNAPSHOT]
at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:218) [ironjacamar-core-impl-1.0.23.Final-redhat-1.jar:1.0.23.Final-redhat-1]
at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:828)
at java.lang.Thread.run(Thread.java:736) [vm.jar:1.6.0]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)

The producer in my scenario is a an application running in JBoss AS 4.3. We have many consumers setup with the same JNDI properties I'm trying to use in my MDB in JBoss7 (see below); non of them is a standalone application but all MDBs deployed in many JBoss AS 4.3 instances.

The connection factory definition on the producer looks like this (my-jms-ds.xml):

 <!-- The JMS provider loader -->
  <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
 name="jboss.jms:service=JMSProviderLoader,name=MyJMSProvider">
    <attribute name="ProviderName">MyJMSProvider</attribute>
    <attribute name="ProviderAdapterClass">
      org.jboss.jms.jndi.JNDIProviderAdapter
    </attribute>
    <!-- The combined connection factory -->
    <attribute name="FactoryRef">/ClusteredConnectionFactory</attribute>
    <!-- The queue connection factory -->
    <attribute name="QueueFactoryRef">/ClusteredConnectionFactory</attribute>
    <!-- The topic factory -->
    <attribute name="TopicFactoryRef">/ClusteredConnectionFactory</attribute>
    <!-- HAJNDI to access JMS-->
    <attribute name="Properties">
       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
       java.naming.provider.url=192.168.0.57:1099
    </attribute>
  </mbean>

  <!-- JMS  Resource adapter, use this to get transacted JMS in beans -->
  <tx-connection-factory>
    <jndi-name>remote-conn-factory</jndi-name>
    <use-java-context>false</use-java-context>
    <xa-transaction>false</xa-transaction>
    <rar-name>jms-ra.rar</rar-name>

    <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
    <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
    <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/MyJMSProvider</config-property>
    <config-property name="Strict" type="java.lang.Boolean">false</config-property>
    <max-pool-size>40</max-pool-size>
  </tx-connection-factory>

And this is my connection definition in standalone-full.xml
 <connection-definitions>
                    <connection-definition class-name="org.jboss.resource.adapter.jms.JmsManagedConnectionFactory" jndi-name="java:/GenericJmsXA" enabled="true" use-java-context="false" pool-name="GenericJmsXA" use-ccm="true">
                            <config-property name="JndiParameters">
                                java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory; java.naming.provider.url=192.168.0.57:1099; java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                            </config-property>
                            <config-property name="ConnectionFactory">
                               remote-conn-factory
                            </config-property>
                              <xa-pool>
                        <min-pool-size>0</min-pool-size>
                        <max-pool-size>10</max-pool-size>
                        <prefill>false</prefill>
                        <use-strict-min>false</use-strict-min>
                        <flush-strategy>FailingConnectionOnly</flush-strategy>
                        <pad-xid>false</pad-xid>
                        <wrap-xa-resource>true</wrap-xa-resource>
                    </xa-pool>
                    <security>
                        <application/>
                    </security>
                        </connection-definition>
                </connection-definitions>

I've debug JmsActivation code and it while setupDestination() throws no exception setupConnection() does.
I hope this helps clarify what's going on!

Thanks for your support

Justin Bertram

unread,
May 12, 2014, 5:15:51 PM5/12/14
to jboss-gene...@googlegroups.com
I'm a bit confused by the stack-trace as it doesn't match any code I can find.  The trace indicates that the NPE occurred on line 538 of org.jboss.resource.adapter.jms.inflow.JmsActivation, but as you can see from the link line 538 isn't even in the "lookup" method.  The trace also indicates you are using version 1.0.4.Final-SNAPSHOT so I guess you could have changed this code.  Can you shed any light on this?

Given the configuration snippets you provided from your JBoss AS 4.3 instances I wouldn't expect a remote client to find "remote-conn-factory" via JNDI.  You've got a <tx-connection-factory> with <jndi-name>remote-conn-factory</jndi-name>.  This is a local, JCA-based JMS connection factory.  It can only be used by local clients.  It is not available to remote clients.  The basic (i.e. not JCA-based) connection factories available to remote clients are typically configured in connection-factories-service.xml.  That's what you need to be using from JBoss AS 7.

Fernando Troya

unread,
May 22, 2014, 11:53:31 AM5/22/14
to jboss-gene...@googlegroups.com
Hi Justin; the stack-trace didn't match because I was using a SNAPSHOT locally but used the 1.0.4.Final sources to describe the problem.

Anyways, I've managed to consume messages from JBoss 4.x at last! Your second point was the key to getting this sorted.
I've started using the Connection Factories exposed in connection-factories-service.xml and that was enough to get this working.

Thanks for your support and sorry for the late feedback.

Justin Bertram

unread,
May 22, 2014, 12:12:59 PM5/22/14
to jboss-gene...@googlegroups.com
Glad it's working for you.
Reply all
Reply to author
Forward
0 new messages