Search code examples
springjbossmigrationejb

I am getting "javax.naming.NameNotFoundException" on upgrading from spring 2.5 to 4 in my beans xml


I'm trying to Upgrade my spring web application from spring 2.5 to spring 4. I am also Upgrading my application from weblogic to jboss eap 7.2.

My Application uses EJB stateless bean mapping like below @Stateless(name = "xxxxxFacade", mappedName = "xxxxxxLogging")

My Bean Xml is like below

Bean XML:

<bean id="xxxxxFacade"
        class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
        <property name="jndiName"
            value="msgLogging#com.xxx.xxxx.xxxxLoggingFacade" />
        <property name="businessInterface"
            value="com.xxx.xxxx.xxxxLoggingFacade" />
    </bean>

On Starting Jboss EAP 7.2 im getting the below Exception

Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxxxFacade' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: msgLogging#com.xxx.xxxx.xxxxLoggingFacade -- service jboss.naming.context.java."msgLogging#com.xxx.xxxx.xxxxLoggingFacade"

Not able find the rootcause whether this is due to jboss or spring upgrade ,please help.


Solution

  • Due to Jboss upgrade , ejb is getting deployed in a different way , we need to specify the value of jndi like below

    ejb:applcation/module/uniqueName!FullPathofJavaClass.

    EX:

    <property name="jndiName"           value="ejb:ApplcationName/ModuleName/UniqueName!com.xx.xx.xx.xxxFacade" />
    

    Issue resolved after this.