Announcement Announcement Module
Collapse
No announcement yet.
Looking up beanfactory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Looking up beanfactory

    Hi
    I am new to spring so this might be trivial, but I can't figure out how to get this working.
    I have some business logic running on a application server (Jboss) where i uses spring as my bean manager. I have created a XmlBeanFactory, and bound it to jndi in the server. When i shall use the bean factory I first lookup the beanfactory from jndi and the lookup the bean (factory.getBean("mybean")). Is this the right way to do it?

    Furthermore I will have to use some of the same beans in my frontend (servlets). I works fine creating it own beanfactory with the listener org.springframework.web.context.ContextLoaderListe ner. But I can't find a way to get the 2 beanfactorys to see eachother, looking backend/business beans up from the frontend. How could i do this?
    Thougt abot making the backend/business factory parrent to the servlets factory but how?

    Hope I just missing something obvious but what?

    Thanks in advantage
    /Kasper

  • #2
    AplicationContext

    Hi
    I have a application running in my j2ee server using a XmlBeanFactory. I want my frontend applications (servlets to access the same beanfactory) How can I combine a servlets beanfactory with my already existing XmlBeanFactory
    Can i somehow set the servlets parent BeanFactory to my XmlbeanFactory?

    I could really need a hint, about how to achieve this functionality, or if i am doing something conceptual wrong?

    Comment


    • #3
      Did you look in the ejb support section here? Like:

      http://forum.springframework.org/showthread.php?t=9831


      afaik, the ejb "example" in cvs is the only example thats available for how to do something like what you ask. If there are others, I'd like to see them myself, I'm having ejb load and classpath issues with contexts.
      Last edited by robyn; May 14th, 2006, 10:49 AM.

      Comment


      • #4
        The ejbtest integration test sample in the CVS tree shows how you can use the ContextSingletonBeanFactoryLocator in order to share an appcontext as both the parent of the web appcontext, and to be used directly from EJBs...

        http://cvs.sourceforge.net/viewcvs.p...btest/#dirlist

        Comment


        • #5
          Jndi or jmx lookup of ApplicationContext

          Thanks for the answers.
          I am not using any EJB's but I tried to use the FileSystemXmlApplicationContext instead of the XmlBeanFactory, and now i can use this as parent context;
          I then registered this factory to jboss jndi and looked it up again in the webaplication where it is used as parent context for the webapp.

          So for now I am happy and all seams to work fine
          Just a little curious about the jndi lookup of the ApplicationContext. Saw someone waring about this method(classcast problem), but is there any other way to use the same beanfactory in many different applications running in the same application server?
          As I see the JMX work in spring 1.2 will make the jndi lookup unnecessary, am I right?

          /Kasper

          Comment


          • #6
            Generally different apps running the same app server are not supposed to see each other (according to the spec) with only j2ee authentication information potentially being shared, so the only mechanisms you can use to share data across them are things like JNDI or taking advantage of the classloader hierarchy that may exist in the appserver and putting some things in a shared parent classloader.

            Comment

            Working...
            X