<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    JBoss 5.1.0 and Multiple EARs
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/kyle.bober">Kyle Bober</a> in <i>Spring Integration</i> - <a href="http://community.jboss.org/message/544949#544949">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I have two EARs that contain unique WAR and EJB JAR files.</p><p>Each EAR contains a beanRefContext.xml file that I have wired up to multiple applicationContext files to use Autowiring in my EJB implementation classes.</p><p>My EARs are configured to be isolated in the JBoss EAR deployer.</p><p>Each of my EJBs is configured to use the @Interceptors(SpringBeanAutowiringInterceptor.class)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>EAR 1</p><p>--- WAR1</p><p>--- EJB1 JAR</p><p>EAR 2</p><p>--- WAR2</p><p>--- EJB2 JAR</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My issues is when I deploy both of these EARs in the same JBoss instance and attempt to have EJB1 call EJB2 via a remote EJB call I receive the following exception:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>{code}Caused by: java.lang.RuntimeException: org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [null], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.springframework.beans.factory.BeanFactory] is defined: expected single bean but found 2{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>This exception is thrown from EJB1 when it attemps to make a remote ejb call to EJB2. To verify that this is an issue with Spring Integration I removed the @Interceptors(SpringBeanAutowiringInterceptor.class) from EJB2 and returned some dummy data and it worked fine. It seems this issue revolves around the SpringBeanAutowiringInterceptor.class.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Any help here resolving this issue would be much appreciated!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here are the beanRefContext.xml files which are include in the root of the EAR files.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>EAR1</p><p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br/>&lt;beans <br/><span>&#160;&#160;&#160; xmlns="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span>"</span><br/><span>&#160;&#160;&#160; xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" </span><br/><span>&#160;&#160;&#160; xmlns:jee="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/jee" target="_blank">http://www.springframework.org/schema/jee</a><span>"</span><br/><span>&#160;&#160;&#160; xmlns:aop="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a><span>"</span><br/><span>&#160;&#160;&#160; xmlns:tx="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span>"&#160;&#160;&#160; </span><br/>&#160;&#160;&#160; xsi:schemaLocation="<br/><span>&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</a><span> </span><br/><span>&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/jee" target="_blank">http://www.springframework.org/schema/jee</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/jee/spring-jee-2.5.xsd" target="_blank">http://www.springframework.org/schema/jee/spring-jee-2.5.xsd</a><span> </span><br/><span>&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schema/tx/spring-tx-2.5.xsd</a><span> </span><br/><span>&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop/spring-aop-2.5.xsd" target="_blank">http://www.springframework.org/schema/aop/spring-aop-2.5.xsd</a><span>"&gt;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;bean id="ear1-context" class="org.springframework.context.support.ClassPathXmlApplicationContext"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;constructor-arg&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;list&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;ejb1-applicationContext.xml&lt;/value&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;dao1-applicationContext.xml&lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/list&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/constructor-arg&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160; &lt;/bean&gt;<br/>&lt;/beans&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>EAR2</p><p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br/> &lt;beans <br/><span>&#160;&#160;&#160;&#160; xmlns="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span>"</span><br/><span>&#160;&#160;&#160;&#160; xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" </span><br/><span>&#160;&#160;&#160;&#160; xmlns:jee="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/jee" target="_blank">http://www.springframework.org/schema/jee</a><span>"</span><br/><span>&#160;&#160;&#160;&#160; xmlns:aop="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a><span>"</span><br/><span>&#160;&#160;&#160;&#160; xmlns:tx="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span>"&#160;&#160;&#160; </span><br/>&#160;&#160;&#160;&#160; xsi:schemaLocation="<br/><span>&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</a><span> </span><br/><span>&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/jee" target="_blank">http://www.springframework.org/schema/jee</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/jee/spring-jee-2.5.xsd" target="_blank">http://www.springframework.org/schema/jee/spring-jee-2.5.xsd</a><span> </span><br/><span>&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schema/tx/spring-tx-2.5.xsd</a><span> </span><br/><span>&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop/spring-aop-2.5.xsd" target="_blank">http://www.springframework.org/schema/aop/spring-aop-2.5.xsd</a><span>"&gt;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;bean id="ear2-context"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;constructor-arg&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;list&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;ejb2-applicationContext.xml&lt;/value&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;dao2-applicationContext.xml&lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/list&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/constructor-arg&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160; &lt;/bean&gt;<br/> &lt;/beans&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>-Kyle</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/544949#544949">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Spring Integration at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2082">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>