Announcement Announcement Module
Collapse
No announcement yet.
Help using AbstractStatelessSessionBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help using AbstractStatelessSessionBean

    Can someone explain how to use the AbstractStatelessSessionBean class. In particular what does the setBeanFactoryLocatorKey do and what is it for? I keep getting the below exception when I try to access it.

    CODE

    public class SearchServiceEJB extends AbstractStatelessSessionBean implements com.invest.common.business.ISearch
    {
    private ISearch searchService;

    /* (non-Javadoc)
    * @see org.springframework.ejb.support.AbstractStatelessS essionBean#onEjbCreate()
    */
    protected void onEjbCreate() throws CreateException {
    //Get a reference to the bean factory and to the POJO service implementation
    searchService = (ISearch) getBeanFactory().getBean(
    Constants.SEARCH_SERVICE);

    }

    public List searchAssets(Map searchCriteria){

    return searchService.searchAssets(searchCriteria);
    }

    /**
    * Override default BeanFactoryLocator implementation
    *
    * @see javax.ejb.SessionBean#setSessionContext(javax.ejb. SessionContext)
    */
    public void setSessionContext(SessionContext sessionContext) {
    super.setSessionContext(sessionContext);
    setBeanFactoryLocator(ContextSingletonBeanFactoryL ocator.getInstance("serverContext.xml"));
    setBeanFactoryLocatorKey("serverContext");
    }

    }



    EXCEPTION

    07:44:32,470 ERROR [LogInterceptor] EJBException in method: public abstract void javax.ejb.EJBObject.remove() throws java.rmi.RemoteException,javax.ejb.RemoveException , causedBy:
    org.springframework.beans.FatalBeanException: Unable to return specified BeanFactory instance: factory key [serverContext], from group with resource name [classpath*:serverContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBean
    DefinitionException: No bean named 'serverContext' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [searchService]; root of BeanFactory hierarchy
    org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'serverContext' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [searchService]; root of BeanFactory hierarchy
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:332)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedBeanDefinition(AbstractBeanFa ctory.java:672)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:207)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:159)
    at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:496)
    at org.springframework.beans.factory.access.Singleton BeanFactoryLocator.useBeanFactory(SingletonBeanFac toryLocator.java:387)
    at org.springframework.ejb.support.AbstractEnterprise Bean.loadBeanFactory(AbstractEnterpriseBean.java:1 15)
    at org.springframework.ejb.support.AbstractStatelessS essionBean.ejbCreate(AbstractStatelessSessionBean. java:63)
    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:324)
    at org.jboss.ejb.StatelessSessionEnterpriseContext.<i nit>(StatelessSessionEnterpriseContext.java:63)
    at org.jboss.ejb.plugins.StatelessSessionInstancePool .create(StatelessSessionInstancePool.java:35)
    at org.jboss.ejb.plugins.AbstractInstancePool.get(Abs tractInstancePool.java:146)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:80)
    at org.jboss.webservice.server.ServiceEndpointInterce ptor.invoke(ServiceEndpointInterceptor.java:51)
    at org.jboss.ejb.plugins.CallValidationInterceptor.in voke(CallValidationInterceptor.java:48)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:105)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:313)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:146)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:123)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:192)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.SessionContainer.internalInvoke(Sess ionContainer.java:624)
    at org.jboss.ejb.Container.invoke(Container.java:870)
    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:324)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:144)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:249)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:642)
    at org.jboss.invocation.jrmp.server.JRMPInvoker$MBean ServerAction.invoke(JRMPInvoker.java:805)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:406)
    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:324)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:534)

  • #2
    Same problem

    Hello,

    I encounter the same problem with the same error message. Did you already find out what was wrong?

    Thanks
    Rene

    Comment

    Working...
    X