3 Replies Latest reply on Apr 10, 2007 12:17 PM by Dominique Jean-Prost

    Spring module and war deployed separatly

    Dominique Jean-Prost Newbie

      Hello,

      My question may be considered as off-topic, but let me expose my problem. I would like folks here to share their point of view on my issue.

      I have a spring module which holds my business implementation. This business implementation is shared between 2 webapps. So what I want to do is to deploy my spring module using spring deployer (what a great feature by the way), and use these beans in my webapps. Both of them are deployed in the deploy dir of jboss.
      As I also need the beans classes in my webapp, I also need them in the WEB-INF/lib. The classloading problem is approaching, isn't it ?

      ApplicationContext appContext = WebApplicationContextUtils
       .getWebApplicationContext(servletContext);
       Object o = appContext.getBean("service.global.idFonctionnel");
       ServiceIdFonctionnel serviceIdFonctionnel = (ServiceIdFonctionnel)o;

      This code leads me to a ClassCastException. I precise that the bean do implements the ServiceIdFonctionnel interface.

      My questions :
      Is spring deployer aimed at this kind of deployment scenario ?
      If so, how should I do to avoid this ClassCastException ? Do I have to play with classloading options of my jboss-web.xml ?
      If not, this means to me that I can't share spring modules between 2 webapp ?

      Thank you for your testimonials and answers.

      Best regards,

      Dom