4 Replies Latest reply on Feb 23, 2007 11:36 AM by Alex Pounds

    MDB failing to deploy with ClassCastException

    Alex Pounds Newbie

      Hello,

      I've been working on the deployment setup for a J2EE app we've been developing in-house, and have hit an impasse with my EAR file. On deployment, I get a ClassCastException from my message-driven bean:

      17:55:51,859 ERROR [ExceptionInterceptor] Caught RuntimeException
      java.lang.ClassCastException: org.jboss.jms.destination.JBossQueue
      at org.jboss.jms.client.container.AsfAspect.handleCreateConnectionConsumer(AsfAspect.java:111)
      [Full stacktrace at http://pastie.caboo.se/40302]

      I understand that I may get a ClassCastException if I was trying to load JBossQueue from two separate class loaders, but I only have one instance of jboss-messaging-client.jar in my system (in the container's lib/ directory) so I don't think that's the problem.

      I'm not sure what further information to provide to help diagnose this issue, so please do ask questions if needed.

      Thank you.

        • 1. Re: MDB failing to deploy with ClassCastException
          jaikiran pai Master

          The only information that i could get out of that stacktrace was that a sar was being deployed when this exception is thrown. Can you give us more details about how your MDBs are packaged and where have you created the queue?

          • 2. Re: MDB failing to deploy with ClassCastException
            Alex Pounds Newbie

             

            "jaikiran" wrote:
            Can you give us more details about how your MDBs are packaged and where have you created the queue?


            Certainly.

            What we have is (fairly) straighforward - a jobcontrol.ear file that contains the following:
            foo.jar - The core classes of our app.
            jobcontrol-ws.war - A web service interface for our app.
            jobcontrol-mdb.jar - The MDB that acts as an interface between the web service and the core classes. It responds to messages posted by the web service.

            At present jobcontrol-ws.war and jobcontrol-mdb.jar have some classes in common, which are themselves in common with the classes of foo.jar. This is not optimal but shouldn't be affecting our deployment right now, as far as I know.

            The EAR file also contains a bunch of libraries in jars, and the container on the server has a bunch more in its lib/ directory. None of these overlap, as far as I know. foo.jar, jobcontrol-ws.war, and jobcontrol-mdb do not have any libraries in them.

            The queue is created by the app server - the configuration in the EJB creates it, as can be seen at http://pastie.caboo.se/40508.


            • 3. Re: MDB failing to deploy with ClassCastException
              Alex Pounds Newbie

              Also, it seems that our messaging system might be hosed - the ant test cases for messaging do not run successfully (see http://pastie.caboo.se/40552. We're running on Jboss 4.0.4.

              • 4. Re: MDB failing to deploy with ClassCastException
                Alex Pounds Newbie

                For the sake of those who may come across this in the search for their own solutions, I thought I should report back about the cause of this error.

                We had a couple of issues on the go, as it turns out: one thing that wasn't helping was our JBoss machine had run out of disk space. However, the main problem was that we had inadvertently included a jndi.properties file in our EAR deployment. I'm not familiar with the configuration in this file, but it was sufficient to completely hose our messaging in the manner described above. Removing it from our EAR solved the ClassCastException.