5 Replies Latest reply on Feb 6, 2007 9:09 AM by zaidatheer

    ClassCastException

    jprio

      I'm trying to use the spring deployer in JBoss 4.0.3. I have no problem deploying the deployer and a .spring archive, but, when I want to use the BeanFactory stored in JNDI in my application (which uses Spring also), with tis code:

      BeanFactory bf = (BeanFactory) myContext.lookup("test_spring");
      

      , I have a ClassCastException.
      I guess there's a problem because I have a spring.jar in my WEB-INF/lib and there is another one in the deployer, but I don't now how to solve this.
      Can anybody help ?

        • 1. Re: ClassCastException
          alesj

          What about if you have a single spring.jar in the jboss/server/[configuration]/lib ?

          • 2. Re: ClassCastException
            jprio

            Hum... The same spring.jar for all applications ? I prefer to keep control of the version in each war.

            • 3. Re: ClassCastException
              alesj

              Hmmm ... i don't see how else would you be able to use the same BeanFactory class instance in deployer and .war.

              Maybe use previous advice, for the apps that use BF from deployer and scoped deployment for others.

              btw: Spring jars are mostly back compatible, with really small diffs.

              • 4. Re: ClassCastException
                jprio

                That's what i thought. I'll see if it's possible to use the sema spring for all webapps.
                Thanks.

                • 5. Re: ClassCastException
                  zaidatheer

                  Well,

                  I had same problem, however it was SIMPLY solved by putting the (or jboss-spring-jdk5.jar) in the default/lib.

                  Never ever put jboss-spring-jdk5.jar in your spring or deployer, this is the problem.

                  Regards,
                  Zaid