ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Issue: JMS to MQ - AOP configuration seems to be invalid

Post new topic  Reply to topic
 Issue: JMS to MQ - AOP configuration seems to be invalid « View previous topic :: View next topic » 
Author Message
georgeandrews
PostPosted: Tue Jul 12, 2011 4:40 am    Post subject: Issue: JMS to MQ - AOP configuration seems to be invalid Reply with quote

Newbie

Joined: 12 Jul 2011
Posts: 6

I have an issue with sending a message using core javax.jms to MQ.
Back to top
View user's profile Send private message
georgeandrews
PostPosted: Tue Jul 12, 2011 4:41 am    Post subject: Reply with quote

Newbie

Joined: 12 Jul 2011
Posts: 6

I've searched these and other forums and have not been able to find exactly why the following error is occurring. Locally, this issue does not occur, but after deploying to an Integration environment the error pops up.

Error message:
Code:
Caused by: AOP configuration seems to be invalid: tried calling method [public abstract javax.jms.Connection javax.jms.ConnectionFactory.createConnection() throws javax.jms.JMSException] on target [com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle@54fc54fc
   managed connection factory = com.ibm.ejs.jms.WMQJMSRAManagedConnectionFactory@74787478
   connection manager = com.ibm.ejs.j2c.ConnectionManager@53ff53ff
   restricted methods enabled = false]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class


Here is the code:

Spring configuration:
Code:
   <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="proxyInterface" value="javax.jms.ConnectionFactory" />
      <property name="jndiName" value="jms/qcf" />
      <property name="lookupOnStartup" value="false" />
      <property name="resourceRef" value="true" />
      <property name="cache" value="true" />
   </bean>
   
   <bean id="destinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
      <property name="resourceRef" value="true" />
   </bean>
   
   <bean id="messageHandler" class="org.common.message.MessageHandler">
      <property name="connectionFactory" ref="connectionFactory" />
      <property name="destinationResolver" ref="destinationResolver" />
   </bean>


Java Class:
Code:

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.jms.support.destination.DestinationResolver;

public class MessageHandler {
   
   private ConnectionFactory connectionFactory;
   private DestinationResolver destinationResolver;
   private String queueName;
   private String message;
   
   public void sendTextMessage() throws JMSException {
      Connection connection = null;
      try {
         connection = connectionFactory.createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         Destination destination = destinationResolver.resolveDestinationName(session, queueName, false);
         MessageProducer producer = session.createProducer(destination);
         TextMessage textMessage = session.createTextMessage(message);
         producer.send(textMessage, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, 0);
      } finally {
         if(connection != null){
            try {
               connection.close();
            } catch (JMSException e) {
               throw new RuntimeException(e);
            }
         }
      }
   }

...setters below


Is this an MQ configuration issue or something else?

Thank you for your time.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jul 12, 2011 9:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

How much do you know about JMS and JNDI indirection?
I do not see where you correctly define the connection factory...

Seems to me that either your Swing config is bad, or your JNDI config is bad...
How is jms/qcf defined to your JNDI?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
georgeandrews
PostPosted: Tue Jul 12, 2011 10:59 am    Post subject: Reply with quote

Newbie

Joined: 12 Jul 2011
Posts: 6

The jms/qcf is defined in the web.xml as follows.

web.xml:
Code:
   <resource-ref>
      <description></description>
      <res-ref-name>jms/message/input</res-ref-name>
      <res-type>javax.jms.Queue</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>
   <resource-ref>
      <description></description>
      <res-ref-name>jms/qcf</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>
Back to top
View user's profile Send private message
georgeandrews
PostPosted: Tue Jul 12, 2011 1:50 pm    Post subject: Reply with quote

Newbie

Joined: 12 Jul 2011
Posts: 6

I've been able to further trace down the error:

Error logs:
Code:
2011-07-12 16:34:51,257 ERROR org.messages.impl.service.MessageBean - sendMessage():  Error sending message to queue: jms/message/input org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is org.springframework.jndi.TypeMismatchNamingException: Object of type [class com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle] available at JNDI location [jms/qcf] is not assignable to [javax.jms.ConnectionFactory]
Back to top
View user's profile Send private message
georgeandrews
PostPosted: Tue Jul 12, 2011 2:53 pm    Post subject: Reply with quote

Newbie

Joined: 12 Jul 2011
Posts: 6

The issue seems related to the following thread: http://old.nabble.com/Axis2-JMSListener-on-Websphere-td15165852.html. The configuration seems OK, but there is a mismatch when the class is loaded.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jul 12, 2011 8:32 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

georgeandrews wrote:
The jms/qcf is defined in the web.xml as follows.

web.xml:
Code:
   <resource-ref>
      <description></description>
      <res-ref-name>jms/message/input</res-ref-name>
      <res-type>javax.jms.Queue</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>
   <resource-ref>
      <description></description>
      <res-ref-name>jms/qcf</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>


So you are defining an interface? Where is the implementation definition??
The restype javax.jms.QueueConnectionFactory is an interface.
You do not define at the same time any of the characteristics of the implementation, like implementing class name, implementing properties like
  • qmgr name
  • channel table file
  • hostname
  • channel name
  • port
  • Transport type
  • Target (Client) Matching
  • SSL cipher suite
  • SSLFIPS
  • SSLPeer
  • etc...


Note that some of these attributes/properties will give an error if a contradicting property is present; consult your friendly infocenter

Is your res-ref "jms/qcf" defined anywhere else in JNDI?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
georgeandrews
PostPosted: Wed Jul 13, 2011 6:57 am    Post subject: Reply with quote

Newbie

Joined: 12 Jul 2011
Posts: 6

Issue was that the class was being overwritten because the application was set to load classes parentlast. In the pom file, the geronimo-jms_1.1_spec dependency did not have a scope set and, by default, this jar was being included in the .war.

pom.xml:
Code:
<dependency>
  <groupId>org.apache.geronimo.specs</groupId>
  <artifactId>geronimo-jms_1.1_spec</artifactId>
  <version>1.1.1</version>
</dependency>


This jar may need be needed at all, but the build is currently failing when the dependency is removed entirely. The issue was fixed by setting scope to "provided".

pom.xml:
Code:
<dependency>
  <groupId>org.apache.geronimo.specs</groupId>
  <artifactId>geronimo-jms_1.1_spec</artifactId>
  <version>1.1.1</version>
  <scope>provided</scope>
</dependency>


This issue has been resolved.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Issue: JMS to MQ - AOP configuration seems to be invalid
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.