3 Replies Latest reply on May 30, 2009 7:37 AM by Aaron Chambers

    Seam JMS problems

    Pedro Sena Newbie

      Hi guys,


      I'm having problems using Seam managed JMS connections and Jboss Messaging(similar problem with JbossMQ)


      Here is my stacktrace:



      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.jms.topicConnection
           at org.jboss.seam.Component.newInstance(Component.java:2066)
           at org.jboss.seam.Component.getInstance(Component.java:1948)
           at org.jboss.seam.Component.getInstance(Component.java:1910)
           at org.jboss.seam.Component.getInstance(Component.java:1904)
           at org.jboss.seam.Component.getInstance(Component.java:1884)
           at org.jboss.seam.Component.getInstance(Component.java:1879)
           at org.jboss.seam.jms.TopicConnection.instance(TopicConnection.java:75)
           at org.jboss.seam.jms.TopicSession.create(TopicSession.java:38)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:138)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2171)
           at org.jboss.seam.Component.callCreateMethod(Component.java:2094)
           at org.jboss.seam.Component.newInstance(Component.java:2054)
           ... 70 more
      Caused by: java.lang.ClassCastException: org.jboss.jms.client.JBossConnectionFactory cannot be cast to javax.jms.TopicConnectionFactory
           at org.jboss.seam.jms.TopicConnection.getTopicConnectionFactory(TopicConnection.java:64)
           at org.jboss.seam.jms.TopicConnection.init(TopicConnection.java:51)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:138)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2171)
           at org.jboss.seam.Component.callCreateMethod(Component.java:2094)
           at org.jboss.seam.Component.newInstance(Component.java:2054)



      The main part is here:
      java.lang.ClassCastException: org.jboss.jms.client.JBossConnectionFactory cannot be cast to javax.jms.TopicConnectionFactory


      And my components.xml file:



      <jms:queue-connection queue-connection-factory-jndi-name="/ConnectionFactory" />
           <jms:topic-connection topic-connection-factory-jndi-name="/ConnectionFactory" />     
                
           <jms:managed-topic-publisher name="dataPublisher" 
                                   auto-create="true" 
                                   topic-jndi-name="topic/testTopic"/>



      Any tips are appreciated.


      Regards,


      Pedro Sena

        • 1. Re: Seam JMS problems
          Coen Damen Novice

          I'm having the same problem..


          Its weird because I thought JBoss Messaging is fully JMS compliant. So why this classcast exception???


          Coen

          • 2. Re: Seam JMS problems
            Riccardo Serafin Newbie

            Hi,


            I was having the same problem, with an EAR packaged seam project. In the end, I discovered that I was including in my EAR the JMS lib (I'm using maven) and that the included version was different from the one JBoss is using. As I was also using a scoped classloader, I was getting the class cast exception.


            For me the solution has been to remove the JMS lib from the ear...


            Hope this can be of some help,
            Riccardo

            • 3. Re: Seam JMS problems
              Aaron Chambers Newbie

              Riccardo Serafin wrote on Mar 17, 2009 13:52:


              For me the solution has been to remove the JMS lib from the ear...



              Hi Riccardo,


              I am also using Maven2 to build an EAR for my project.  And I am getting the same issues.  Could you please let me know exactly what you did to fix this?  If you aren't including the JMS libraries in your EAR via maven, what are you doing?


              Cheers,
              Aaron