Results 1 to 3 of 3

Thread: LocalStatelessSessionProxyFactoryBean diffs

  1. #1
    Join Date
    Nov 2004
    Posts
    22

    Smile LocalStatelessSessionProxyFactoryBean diffs

    Hey folks,

    I'm trying to use a LocalStatelessSessionProxyFactoryBean to advise methods in an ejb.

    Basically I want to be able to retry the ejb method should it fail for a specific reason.

    This is what i'm doing ( i think this is a fairly reasonable way of doing it, but please correct me if wrong..) :

    Code:
            LocalStatelessSessionProxyFactoryBean bean = new LocalStatelessSessionProxyFactoryBean();
            bean.setJndiName("JobLocal");
            bean.setBusinessInterface(JobLocal.class);
            bean.setLookupHomeOnStartup(false);
            try
            {
                bean.afterPropertiesSet();
            }
            catch(Exception e)
            {
                logger.error("e=" + e.getMessage());
            }
            Object proxy = bean.getObject();
    
            TransactionFailureInterceptor i = new TransactionFailureInterceptor();
            ProxyFactory factory = new ProxyFactory(JobLocal.class);
            factory.setTarget(proxy);
            factory.addAdvice(0, i);
            Object p1 = factory.getProxy();
    but then it barfs when I try to cast back to the JobLocal.

    I'm possibly doing something dull here... and if someone could point it out I'd be really really grateful. thanks in advance!

    Marty
    Marty

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

    Default

    You are using the wrong constructor of ProxyFactory (see the API documentation).
    Try this:
    Code:
    ProxyFactory factory = new ProxyFactory(new Class[] {JobLocal.class});
    Regards,
    Andreas

  3. #3
    Join Date
    Nov 2004
    Posts
    22

    Default

    argh! cheers my man!
    working spot on now! thanks!
    Marty

Posting Permissions

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