Hi All,
I'm trying to get an SLSB running in JBoss with a bean factory retrieved via the ContextSingletonBeanFactoryLocator. The Spring classes aren't able to locate the beanRefFactory.xml file. My EAR layout is as follows:
The manifest file of app-ejb.jar has app-lib.jar in it's Class-Path. AppBean is as follows:Code:app.ear |-app-lib.jar (contains refBeanFactory.xml) |-spring.jar |-app-ejb.jar (contains AppBean) |-app.war |-... remaining util jars
beanRefFactory.xml is:Code:public class AppBean extends AbstractStatelessSessionBean implements MailboxManager { private MailboxManager mailboxManager; protected void onEjbCreate() throws CreateException { mailboxManager = (MailboxManager) getBeanFactory().getBean("mailboxManager"); } public void deliverMessage(MessageEnvelope envelope) throws MailboxException, MailboxAuthorizationException { mailboxManager.deliverMessage(envelope); } public void setSessionContext(SessionContext sessionContext) { super.setSessionContext(sessionContext); setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance()); setBeanFactoryLocatorKey(ServicesConstants.PRIMARY_CONTEXT_ID); } }
When I hit the web and trigger a message to the SLSB through the SimpleRemoteStatelessSessionProxyFactory, the ContextSingletonBeanFactoryLocator fires up with the default bean factory search path:Code:<beans> <bean id="com.app" lazy-init="true" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <value>com/app/server/mailbox/applicationContext.xml</value> </constructor-arg> </bean> </beans>
but a few lines down, I get this error:Code:2005-01-27 17:36:31,516 DEBUG [org.springframework.beans.factory.access.SingletonBeanFactoryLocator] ContextSingletonBeanFactoryLocator.getInstance(): instances.hashCode=0, instances={} 2005-01-27 17:36:31,516 DEBUG [org.springframework.beans.factory.access.SingletonBeanFactoryLocator] Factory group with resource name [classpath*:beanRefContext.xml] requested. Creating new instance.
I've tried to load the resource (using getClassLoader().getResource() ) outside of Spring and found that the classloader for a class such as MailboxException (which is in app-lib.jar) will find beanRefContext.xml whereas AppBean's classloader (AppBean is in app-ejb.jar) will not. Has anyone encountered this problem before?Code:2005-01-27 17:36:31,526 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException in method: public abstract void com.app.ejb.MailboxManagerRemote.deliverMessage(com.app.MessageEnvelope) throws com.app.server.mailbox.MailboxException,com.app.server.mailbox.MailboxAuthorizationException,java.rmi.RemoteException, causedBy: org.springframework.beans.FatalBeanException: Unable to return specified BeanFactory instance: factory key [com.app], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'com.app' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans []; root of BeanFactory hierarchy


Reply With Quote