Spring annotation based autowiring throws javax.naming.NameNotFoundException after CLI reload.

Solution Unverified - Updated -

Issue

  • EAR application is deployed well and EAP starts without problem but after executing reload in CLI it breaks. It seems that Spring cannot find beans in JNDI.
  • After start the the below logs are generated, it tries to load bean and manages.
13:10:09,952 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] (ServerService Thread Pool -- 98/) Registered injected element on class [mypackage.web.action
s.user.BlockedEmailChangeAction]: AutowiredFieldElement for private mypackage.components.userprofile.interfaces.UserProfileManager mypackage.web.struts.action.MyAction.p
rofileManager
13:10:11,177 DEBUG [org.springframework.jndi.JndiTemplate] (ServerService Thread Pool -- 98/) Looking up JNDI object with name [java:global/application/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface]
13:10:11,177 DEBUG [org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean] (ServerService Thread Pool -- 98/) Located object with JNDI name [java:global/application/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface]
13:10:11,470 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] (ServerService Thread Pool -- 98/) Processing injected element of bean 'blockedEmailChangeAction': AutowiredFieldElement for private mypackage.components.userprofile.interfaces.UserProfileManager mypackage.web.struts.action.MyAction.profileManager
  • But after CLI reload it fails, it couldn't find bean in JNDI even if it logs that bean is registered in JNDI, below are the logs
UserProfileManagerBean in deployment unit subdeployment "bean3.jar" of deployment "application.ear" are as follows:
        java:global/application/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$RemoteInterface
        java:app/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$RemoteInterface
        java:module/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$RemoteInterface
        java:jboss/exported/application/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$RemoteInterface
        java:global/application/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface
        java:app/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface
        java:module/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface


13:11:46,467 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] (ServerService Thread Pool -- 81/) Registered injected element on class [mypackage.web.actions.user.BlockedEmailChangeAction]: AutowiredFieldElement for private mypackage.components.userprofile.interfaces.UserProfileManager mypackage.web.struts.action.MyAction.profileManager
13:11:46,608 DEBUG [org.springframework.jndi.JndiTemplate] (ServerService Thread Pool -- 81/) Looking up JNDI object with name [java:global/application/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface]
13:11:46,608 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ServerService Thread Pool -- 81/) Ignoring bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileManagerBean': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Error looking up application/bean3/UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface, service service jboss.naming.context.java.global.application.bean3."UserProfileManagerBean!mypackage.components.userprofile.interfaces.UserProfileManager$LocalInterface" is not started

Environment

  • Red Hat JBoss Enterprise Application Platform
    • 6.4.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.