0 Replies Latest reply on Feb 9, 2007 8:47 AM by Luciano Montebove

    ActiveMQ JCA connector and Spring 2 application conflict in

    Luciano Montebove Newbie

      If I try to deploy the ActiveMQ JCA resource adapter (activemq-rar-4.1.0-incubator.rar) side by side with a Spring 2 war in JBoss 4.0.5 , I get the following error on server startup:

      ERROR
      [org.springframework.web.context.ContextLoader] Context initialization
      failed
      org.springframework.beans.factory.BeanDefinitionStoreException:
      Unexpected exception parsing XML document from ServletContext resource
      [/WEB-INF/applicationContext.xml]; nested exception is
      java.lang.IllegalArgumentException: Class
      [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] does not
      implement the NamespaceHandler interface
      Caused by:
      java.lang.IllegalArgumentException: Class
      [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] does not
      implement the NamespaceHandler interface
      at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.initHandle\
      rMappings(DefaultNamespaceHandlerResolver.java:119)
      at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.(Def\
      aultNamespaceHandlerResolver.java:96)
      at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.(Def\
      aultNamespaceHandlerResolver.java:82)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createDefaultNames\
      paceHandlerResolver(XmlBeanDefinitionReader.java:526)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createReaderContex\
      t(XmlBeanDefinitionReader.java:515)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefini\
      tions(XmlBeanDefinitionReader.java:495)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefiniti\
      ons(XmlBeanDefinitionReader.java:390)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinition\
      s(XmlBeanDefinitionReader.java:340)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinition\
      s(XmlBeanDefinitionReader.java:317)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanD\
      efinitions(AbstractBeanDefinitionReader.java:125)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanD\
      efinitions(AbstractBeanDefinitionReader.java:141)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinit\
      ions(XmlWebApplicationContext.java:123)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinit\
      ions(XmlWebApplicationContext.java:91)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refres\
      hBeanFactory(AbstractRefreshableApplicationContext.java:94)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractA\
      pplicationContext.java:292)
      at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext\
      .refresh(AbstractRefreshableWebApplicationContext.java:156)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(Contex\
      tLoader.java:246)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextL\
      oader.java:184)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(Context\
      LoaderListener.java:49)


      The problem is reproducible with any Spring 2 app (like the jpetstore sample of Spring 2.0.2 distribution), not only mine, to try yourself these are the steps:
      1)Install a fresh Jboss (I tested 4.0.3 and 4.0.5) and verify it starts without problems
      2)Stop JBoss
      3)Put the activemq-rar-4.1.0-incubator.rar and jpetstore.war in the deploy JBoss dir
      4)Start JBoss and you will see my stack trace

      The only workaround I found is to remove the Spring 2 jar from the ActiveMQ rar, but as I think is a classloader problem, there isn't a correct way of insulating JCA connector from apps?
      I tryed also to put the activemq .rar inside an .ear file as described here
      http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3992480 but nothing changed. Luciano