Bas Ven [
https://community.jboss.org/people/batter] created the discussion
"Re: Accessing spring beans that are deployed in a war."
To view the discussion, visit:
https://community.jboss.org/message/829855#829855
--------------------------------------------------------------
Ok, getting furhter once again. The problem about the BeanFactory not being registered
was due to the fact that your jboss-spring.xml definition has changed from the examples I
found on the site to what is actually needed.
As posted before, I had this defined as:
> <?xml version="1.0"
encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "
http://www.springframework.org/dtd/spring-beans.dtd
http://www.springframework.org/dtd/spring-beans.dtd">
>
> *<beans>*
>
> <description>BeanFactory=(Commander)</description>
> <bean id="dataSourceManager"
class="database.DataSourceManagerImpl" />
> </beans>
I looked thru some of the newer source and noticed that you defined them differently and I
updated my jboss-spring.xml file to reflect that change:
Now when I look in the jBoss console I indeed see that the factory is registered with
JNDI.
*However* I still get an exception when I actually try to have the spring bean injected in
my EJB and I hope you can help me out there. This is the exception:
java.lang.IllegalArgumentException: Cannot retrieve an
org.springframework.beans.factory.BeanFactory from java:jboss/SpringCommander - a
org.jboss.spring.factory.NamedXmlApplicationContext found instead
org.jboss.spring.support.SpringInjectionSupport.lookup(SpringInjectionSupport.java:175)
org.jboss.spring.support.SpringInjectionSupport.getObjectFromBeanFactory(SpringInjectionSupport.java:136)
org.jboss.spring.support.SpringInjectionSupport.injectToField(SpringInjectionSupport.java:202)
org.jboss.spring.support.SpringInjectionSupport.inject(SpringInjectionSupport.java:80)
org.jboss.spring.callback.SpringLifecycleInterceptor.postConstruct(SpringLifecycleInterceptor.java:43)
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/829855#829855]
Start a new discussion in Snowdrop at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]