Results 1 to 3 of 3

Thread: loadBeanFactory called from ejbCreate

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    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?

    cheers,

    Alef

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

  3. #3

    Default

    Thanks.
    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?

Similar Threads

  1. handleInvalidSubmit called, why?
    By sulam in forum Web
    Replies: 9
    Last Post: Feb 2nd, 2007, 03:11 AM
  2. Replies: 3
    Last Post: Aug 17th, 2006, 02:47 AM
  3. Replies: 6
    Last Post: Nov 30th, 2005, 04:21 AM
  4. onSubmit not called
    By christophe in forum Web
    Replies: 4
    Last Post: Jul 29th, 2005, 05:10 PM
  5. indirectly called method not intercepted
    By springtester in forum AOP
    Replies: 1
    Last Post: Sep 1st, 2004, 06:01 AM

Posting Permissions

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