Announcement Announcement Module
Collapse
No announcement yet.
BeanFactory not initialized or already closed - call 'refresh' before accessing beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanFactory not initialized or already closed - call 'refresh' before accessing beans

    Hi all,

    We have an issue in our project that is blocking our application in the test environment preventing us from releasing out application. we are using weblogic with cxf to make web service calls. The exception i am getting is:

    Caused by: com.monsanto.tps.ws.common.ServiceRuntimeException : javax.xml.ws.soap.SOAPFaultException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at com.monsanto.tps.ws.client.LazyInitProxy.invoke(La zyInitProxy.java:44)
    ... 40 more
    Caused by: javax.xml.ws.soap.SOAPFaultException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWs ClientProxy.java:145)
    at $Proxy181.getActivityInstance(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.monsanto.tps.ws.client.LazyInitProxy.invoke(La zyInitProxy.java:41)
    ... 40 more
    Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.context.support.AbstractRefres hableApplicationContext.getBeanFactory(AbstractRef reshableApplicationContext.java:153)
    at org.springframework.context.support.AbstractApplic ationContext.getBeanNamesForType(AbstractApplicati onContext.java:933)
    at com.monsanto.tps.springframework.context.support.A pplicationContextUtils.getBeanNamesForTypeAccrossC lassLoaders(ApplicationContextUtils.java:21)
    at com.monsanto.tps.ws.security.usernametoken.interce ptor.UsernameOutInterceptor.getUserNameProvider(Us ernameOutInterceptor.java:49)
    at com.monsanto.tps.ws.security.usernametoken.interce ptor.UsernameOutInterceptor.handleMessage(Username OutInterceptor.java:37)
    at org.apache.cxf.phase.PhaseInterceptorChain.doInter cept(PhaseInterceptorChain.java:236)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientIm pl.java:469)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientIm pl.java:299)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientIm pl.java:251)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(Cli entProxy.java:73)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWs ClientProxy.java:124)
    ... 46 more



    We have an out interceptor on the cxf bus that looks up the application context to find a user profile bean in the application context. This works in most situations when calling another service from our server. The one difference between this call and other calls is that this call is made from a thread.

    Any help on this would be greatly appreciated.

    Thanks,
    Mir

  • #2
    Seems like a thread is trying to use a BeanFactory that was closed in other thread.

    How the UsernameOutInterceptor gets a reference to the ApplicationContext?

    I suggest you to see BeanFactoryReference and BeanFactoryLocator interfaces.

    hope that help

    cheers

    Comment

    Working...
    X