Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: ContextSingletonBeanFactoryLocator error during initialisation in EJB

  1. #1
    Join Date
    Jul 2005
    Posts
    29

    Default ContextSingletonBeanFactoryLocator error during initialisation in EJB

    Hello,

    I'm actually trying to use the ContextSingletonBeanFactoryLocator BeanFactory in my EJB's, but I have the following exception:
    Code:
    [1/30/07 15:06:33:833 GMT+01:00] 00000039 SystemOut     O 15:06:33,833 ERROR [ParameterTableServiceSession]  NO ID-setSessionContext for Singletion bean factory usage.
    
    [1/30/07 15:06:33:834 GMT+01:00] 00000039 ExceptionUtil E   CNTR0019E: EJB threw an unexpected (non-declared) exception during invocation of method "remove". Exception data: com.ibm.ejs.container.CreateFailureException: ; nested exception is: 
    
    	java.lang.reflect.InvocationTargetException
    
    	at com.ibm.ejs.container.StatelessBeanO.<init>(StatelessBeanO.java:172)
    
    	at com.ibm.ejs.container.BMStatelessBeanOFactory.create(BMStatelessBeanOFactory.java:40)
    
    	at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:928)
    
    	at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1031)
    
    	at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate(UncachedActivationStrategy.java:84)
    
    	at com.ibm.ejs.container.activator.Activator.activateBean(Activator.java:597)
    
    	at com.ibm.ejs.container.EJSContainer.preInvokeActivate(EJSContainer.java:3435)
    
    	at com.ibm.ejs.container.EJSContainer.preInvoke(EJSContainer.java:2839)
    
    	at com.ibm.ejs.container.EJSContainer.removeBean(EJSContainer.java:2375)
    
    	at com.ibm.ejs.container.EJSWrapper.remove(EJSWrapper.java:196)
    
    	at com.cwsoft.technicalframework.parametertable.service.interfaces._EJSRemoteStatelessParameterTableService_4ba1d0d8_Tie.remove(_EJSRemoteStatelessParameterTableService_4ba1d0d8_Tie.java:175)
    
    	at com.cwsoft.technicalframework.parametertable.service.interfaces._EJSRemoteStatelessParameterTableService_4ba1d0d8_Tie._invoke(_EJSRemoteStatelessParameterTableService_4ba1d0d8_Tie.java:90)
    
    	at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:613)
    
    	at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:466)
    
    	at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
    
    	at com.ibm.CORBA.iiop.ORB.process(ORB.java:1552)
    
    	at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2673)
    
    	at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2551)
    
    	at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
    
    	at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
    
    	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
    
    Caused by: java.lang.reflect.InvocationTargetException
    
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    
    	at java.lang.reflect.Method.invoke(Method.java:615)
    
    	at com.ibm.ejs.container.StatelessBeanO.<init>(StatelessBeanO.java:165)
    
    	... 20 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.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:118)
    
    	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:642)
    
    	at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:393)
    
    	at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:117)
    
    	at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:64)
    
    	at com.cwsoft.technicalframework.parametertable.service.ejb.ParameterTableServiceBean.ejbCreate(ParameterTableServiceBean.java:59)
    
    	... 25 more
    I follow the instructions found in the doc, as:
    Code:
    public void setSessionContext(javax.ejb.SessionContext ctx) 
       {
    	   super.setSessionContext(ctx);
    	   CWLogger.error(this, "setSessionContext for Singletion bean factory usage.");
    	   this.setBeanFactoryLocatorKey("technicalframeworkBeanFactory");
    	   this.setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance());
       }
    beanRefContext.xml file
    Code:
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    	<bean id="technicalframeworkBeanFactory" class="org.springframework.context.support.ClassPathXmlApplicationContext">
    		<constructor-arg value="applicationContext.xml" />
    	</bean>
    </beans>
    But I always have this error.
    I'm running under Spring-2.0.jar.

    Does anyone can help me ?

    Thanks in advance...

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    I would locate the code you have in your setSessionContext method to the constructor of the EJB. the setSessionContext is called after that (and after the ejbCreate) if I'm not mistaken.

    In the ejbCreate method in the AbstractStatelessSessionBean there is stuff done with the BeanFactory if that one isn't present.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2005
    Posts
    29

    Default

    Thanks a lot for your reply.
    But why do I have this error while I read in every doc that this code must be put in the setSessionContext method ? Is this a bug of Spring-2.0 ?

    For info, I'm running under WAS 6.1.0.3.

    Thanks a lot for your help !

  4. #4
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Quote Originally Posted by mdeinum View Post
    I would locate the code you have in your setSessionContext method to the constructor of the EJB.
    No I guess that is correct. It is stated like that in the reference manual as well.

    From the stacktrace I wonder why a call to remove() causes a bean creation. That appears strange to me.

  5. #5
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Checking some documentation it is even clear that the setSessionContext is called before the create method.

    But I have to agree with Andreas it is strange that a remove results in a create. What is even stranger why is the setSessionContext being bypassed while creating the ejb?!
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  6. #6
    Join Date
    Jul 2005
    Posts
    29

    Default

    Indeed, I added some log and the method setSessionContext is really invoked before the method ejbCreate.

    I can't explain also the fact that the method remove has been invoked for the EJB.
    Any help would be great...

    Thanks a lot for your response !

  7. #7
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Can you post your ejb-jar.xml please (at least the section describing the bean in question). Maybe that could provide a clue.

    Regards,
    Andreas

  8. #8
    Join Date
    Jul 2005
    Posts
    29

    Default

    Here it is
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    
    <ejb-jar >
    
       <description><![CDATA[No Description.]]></description>
       <display-name>Generated by XDoclet</display-name>
       <enterprise-beans>
          <!-- Session Beans -->
          <session >
             <description><![CDATA[Generated EJB 2.x SLSB for WordingOfPromptService]]></description>
             <display-name>WordingOfPromptService (SLSB)</display-name>
             <ejb-name>WordingOfPromptService</ejb-name>
             <home>com.cwsoft.technicalframework.prompt.service.interfaces.WordingOfPromptServiceRemoteHome</home>
             <remote>com.cwsoft.technicalframework.prompt.service.interfaces.WordingOfPromptServiceRemote</remote>
             <local-home>com.cwsoft.technicalframework.prompt.service.interfaces.WordingOfPromptServiceLocalHome</local-home>
             <local>com.cwsoft.technicalframework.prompt.service.interfaces.WordingOfPromptServiceLocal</local>
             <ejb-class>com.cwsoft.technicalframework.prompt.service.ejb.WordingOfPromptServiceSession</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Bean</transaction-type>
             <env-entry>
                <env-entry-name>ejb/BeanFactoryPath</env-entry-name>
                <env-entry-type>java.lang.String</env-entry-type>
                <env-entry-value><![CDATA[applicationContext.xml]]></env-entry-value>
             </env-entry>
          </session>
          <session >
             <description><![CDATA[Generated EJB 2.x SLSB for ErrorMessageService]]></description>
             <display-name>ErrorMessageService (SLSB)</display-name>
             <ejb-name>ErrorMessageService</ejb-name>
             <home>com.cwsoft.technicalframework.errormessage.service.interfaces.ErrorMessageServiceRemoteHome</home>
             <remote>com.cwsoft.technicalframework.errormessage.service.interfaces.ErrorMessageServiceRemote</remote>
             <local-home>com.cwsoft.technicalframework.errormessage.service.interfaces.ErrorMessageServiceLocalHome</local-home>
             <local>com.cwsoft.technicalframework.errormessage.service.interfaces.ErrorMessageServiceLocal</local>
             <ejb-class>com.cwsoft.technicalframework.errormessage.service.ejb.ErrorMessageServiceSession</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Bean</transaction-type>
             <env-entry>
                <env-entry-name>ejb/BeanFactoryPath</env-entry-name>
                <env-entry-type>java.lang.String</env-entry-type>
                <env-entry-value><![CDATA[applicationContext.xml]]></env-entry-value>
             </env-entry>
          </session>
    
         <!--
           To add session beans that you have deployment descriptor info for, add
           a file to your XDoclet merge directory called session-beans.xml that contains
           the <session></session> markup for those beans.
         -->
    
          <!-- Entity Beans -->
         <!--
           To add entity beans that you have deployment descriptor info for, add
           a file to your XDoclet merge directory called entity-beans.xml that contains
           the <entity></entity> markup for those beans.
         -->
    
          <!-- Message Driven Beans -->
         <!--
           To add message driven beans that you have deployment descriptor info for, add
           a file to your XDoclet merge directory called message-driven-beans.xml that contains
           the <message-driven></message-driven> markup for those beans.
         -->
    
       </enterprise-beans>
    
       <!-- Relationships -->
    
       <!-- Assembly Descriptor -->
         <!--
           To specify your own assembly descriptor info here, add a file to your
           XDoclet merge directory called assembly-descriptor.xml that contains
           the <assembly-descriptor></assembly-descriptor> markup.
         -->
    
       <assembly-descriptor >
         <!--
           To specify additional security-role elements, add a file in the merge
           directory called ejb-security-roles.xml that contains them.
         -->
    
       <!-- method permissions -->
         <!--
           To specify additional method-permission elements, add a file in the merge
           directory called ejb-method-permissions.ent that contains them.
         -->
    
       <!-- transactions -->
         <!--
           To specify additional container-transaction elements, add a file in the merge
           directory called ejb-container-transactions.ent that contains them.
         -->
    
       <!-- finder transactions -->
    
       <!-- message destinations -->
         <!--
           To specify additional message-destination elements, add a file in the merge
           directory called ejb-message-destinations.ent that contains them.
         -->
    
       <!-- exclude list -->
         <!--
           To specify an exclude-list element, add a file in the merge directory
           called ejb-exclude-list.xml that contains it.
         -->
       </assembly-descriptor>
    
    </ejb-jar>

  9. #9
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    That seems to be ok so far. Please turn on debug logging to see what happens there. Maybe it can be seen there what happens to the application context.

    Regards,
    Andreas

  10. #10
    Join Date
    Dec 2006
    Location
    Bucharest, Romania
    Posts
    14

    Default

    Quote Originally Posted by Andreas Senft View Post
    That seems to be ok so far. Please turn on debug logging to see what happens there. Maybe it can be seen there what happens to the application context.

    Regards,
    Andreas

    I have a similar ejb-jar.xml problem:

    the result is that two application contexts are created.(at least in my case)

    2007-02-13 18:54:28,604 DEBUG jndi.JndiLocatorSupport - Located object with JNDI name [java:comp/env/ejb/BeanFactoryPath]
    2007-02-13 18:54:28,604 DEBUG jndi.JndiLocatorSupport - Located object with JNDI name [java:comp/env/ejb/BeanFactoryPath]
    2007-02-13 18:54:28,604 DEBUG access.ContextJndiBeanFactoryLocator - Bean factory path from JNDI environment variable [java:comp/env/ejb/BeanFactoryPath] is: applicationContext-ejb.xml
    2007-02-13 18:54:28,604 DEBUG access.ContextJndiBeanFactoryLocator - Bean factory path from JNDI environment variable [java:comp/env/ejb/BeanFactoryPath] is: applicationContext-ejb.xml

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •