Announcement Announcement Module
Collapse
No announcement yet.
BeanFactory overriding bean from another application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanFactory overriding bean from another application

    Ok, we have a web app deployed in JBoss, other than that there is another ear deployed. We are using some client libs from this ear file. The ear is using spring to do its work.

    The client libs are pretty clean no spring configs or beanRefFactory.xml. Although it will search for spring configs on load up (static inits) and expect to find certain beans. Our web app is also using spring for our work. So we are placing some of the necessary beans in our web apps applicationContext such that when we access the ear's client libs they will work.

    Now the problem is for some reason, the BeanFactory is overriding our web app's bean config with the ear's bean config. We already disabled the unified class loader in JBoss. However the BeanFactory is still overriding our bean from the ear's class loader, we found the following in our log files....

    2005-06-30 14:52:24,546 INFO [org.springframework.beans.factory.support.DefaultL istableBeanFactory] Overriding bean definition for bean 'com.foobar.arch.ApplicationConfiguration': replacing [Root bean with class [org.springframework.context.support.ClassPathXmlAp plicationContext] defined in URL [jar:file:/C:/DevelopmentTools/JBoss/jboss-4.0.2/server/default/tmp/deploy/ tmp2205springapp-exp.war /WEB-INF/lib/common.jar!/beanRefFactory.xml]] with [Root bean with class [org.springframework.context.support.ClassPathXmlAp plicationContext] defined in URL [jar:file:/C:/DevelopmentTools/JBoss/jboss-4.0.2/server/default/tmp/deploy/ tmp2203App.ear-contents /CommonEJBs.jar!/beanRefFactory.xml]]


    Note the overriding of our web app's bean from the ear's bean!! How is this possible, this is totally breaking our web apps functionality.... really appreciate some comments and help.

  • #2
    update

    We discovered that the client lib that we are using is initializing the SingletonBeanFactoryLocator with classpath*:applicationContext.xml. For some reason this will cause spring to crossover to other ear's class loader deployed in the same server in JBoss and load the applicationContext.xml that it finds there. Again, we already have the unified class loader in JBoss disabled.

    This is bad, since our application starts spewing out ClassCastException even though the classes loaded from the other app's class loader is the correct classes (but an instanceof check will fail since its from another app's class loader). Now we hacked the client lib such that it uses classpath:applicationContext.xml instead and this seems to solve the problem for now... Anyone care to point out if this is the correct solution?

    Now, can anyone point us to more information on the actual syntax and documentation of the class path url used to get an instance of the SingletonBeanFactoryLocator? We checked the API javadocs, not much info there.

    Comment

    Working...
    X