Announcement Announcement Module
No announcement yet.
loadBeanFactory called from ejbCreate Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • loadBeanFactory called from ejbCreate

    The comments for the ejbCreate method of the AbstractStatelessSessionBean class mentions that loading the bean factory in the setSessionContext method can not be done because resource manager access is not permitted there. Table 3 in section 7.8.2 of the EJB 2.0 spec would lead me to believe that the same holds for the ejbCreate method. The reason I mention this is that we are thinking of creating our own implementation of the property configurer that uses a database instead of a property file. It appears that loadBeanFactory also causes the beans to be created and would ultimately result is invoking our database backed property configurer, violating, assuming my interpretation, the spec since this is all taking place in the ejbCreate method. Is my perception correct?

  • #2
    To be honest, I've always been in doubt here. The spec is vague about this IMO. The part you're referring to on the one hand mentions that I can retrieve a transaction from the SessionContext if I like to (getUserTransaction). But can I start one? According to the mention of UserTransaction methods in the part where business methods are discussed, I cannot! But why should I be able to retrieve the user transaction then anyway.

    The spec says that if I'm accessing a resource manager when I'm not allowed to, behavior is undefined. The spec also says that if I access a method from the SessionContext when I'm not allowed to, the container should throw an IllegalArgumentException. But what if I retrieve the user transaction (SessionContext.getTransaction, which is allowed) and start a transaction? There no mention of what the container should do then!

    I've run into this a couple of time and always decided to just access the resource manager if I needed to and make sure I tested it thoroughyl. But I can understand that if you need to be absolutely sure your components are portalbe and stuff you cannot really do such a thing.

    Maybe somebody else can shed a light here?



    p.s. why are you using those EJBs anyway :wink:


    • #3
      As to why we are using EJBs... a couple of reasons.... first of all, political, a fear of moving away from a standard technology. I am positioning Spring as a way for us to develop and test our business logic without developers having to know about EJBs as well as the added advantage of allowing us to deploy without EJBs at all in the future. Secondly, we are looking to allow our APIs to be used externally by a system integrator in a standard, transaction contolled manner.

      Any more info on my original question regarding the appropriateness of the comments for the ejbCreate method of the AbstractStatelessSessionBean class?