Results 1 to 3 of 3

Thread: Can't find beanRefFactory.xml in EJB jar

  1. #1
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default Can't find beanRefFactory.xml in EJB jar

    I am using the following code to load my object from an EJB (not using Spring's EJB classes):

    Code:
      public void setBeanContextName(String ctxName)
      {
        beanContextName = ctxName;
      }
    
      public String getBeanContextName()
      {
          return beanContextName;
      }
    
      public Object getBean(String bean)
      {
        BeanFactoryLocator bfl = SingletonBeanFactoryLocator.getInstance();
        BeanFactoryReference bf = bfl.useBeanFactory(beanContextName);
        return bf.getFactory().getBean(bean);
      }
    It is bean called during ejbCreate()

    I have my beanRefFactory in the root directory of my EJB jar. The contents is as follows:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
     <beans>
       <bean id="my.beans"
             class="org.springframework.context.support.ClassPathXmlApplicationContext">
         <constructor-arg>
           <list>
             <value>springCommon.xml</value>
             <value>META-INF/springContext.xml</value>
           </list>
         </constructor-arg>
       </bean>
     </beans>
    I get the following exception:
    org.springframework.beans.FatalBeanException: Unable to find resource for specified definition. Group resource name [classpath*:beanRefFactory.xml], factory key [my.beans]

    As far as I can tell this exception means beanRefFactory.xml wasn't found in the path. Isn't the root of an EJB jar implicitly put in the classpath when calling code from inside the EJB?

  2. #2
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    In case people need a little more detail:

    I'm running Weblogic 8.1. My EJB jar is directly deployed to the server, its not in an EAR. The EJB is not on the system classpath, just depoyed at runtime. I have 3 config files in the EJB jar:

    beanRefFactory.xml
    springCommon.xml
    META-INF/springContext.xml

    I've tried moving beanRefFactory.xml to a location outside the EJB to a place on the classpath. But then springCommon.xml can't be found.

  3. #3
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    As far as I can tell from research on this forum and the internet Weblogic does not implicitly place a loaded EJB jar into the classpath in its own classloader. An EJB classloader loads the classes explicitly, and reads the files in META-INF explicitly as well.

    I believe the two options I have are:
    - Create an EAR.
    - Add "./" to the system classpath so that a jar can find resources in itself.

Similar Threads

  1. Replies: 4
    Last Post: Dec 7th, 2006, 09:23 AM
  2. Beandoc crashing (on its samples!)
    By aaime in forum Container
    Replies: 17
    Last Post: Oct 7th, 2005, 07:21 AM
  3. JBoss 3.2.6 & Spring Deployment issues
    By difranr in forum Container
    Replies: 2
    Last Post: Sep 18th, 2005, 10:08 PM
  4. Replies: 3
    Last Post: Sep 4th, 2005, 11:11 PM
  5. Replies: 6
    Last Post: Jun 13th, 2005, 04:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •