3

is this possible somehow? Following scenario:

  • statelesse local EJB with name A
  • singleton startup EJB with name B
  • B contains a reference to A

I tried but my application server (WAS) fails on application startup with the error that A was not found. The console log also makes clear that A was not started at the moment the B is loaded but some other stateless EJBs are started before B. Making A also a singleton EJB and letting B depond on A via annotation @DependsOn({"A"}) produced an error, too, stating that dependent bean A was not found. Using A in a web module works fine.

Any ideas what' I do wrong? Thx for any help! Steffen Harbich

Steffen Harbich
  • 2,639
  • 2
  • 37
  • 71
  • In GlassFish I have the same error. It disappears if you remove the local interface from A. Why do you need the local interface? It seems that shouldn't be necessary with EJB 3.1 – perissf Jan 06 '12 at 17:06
  • 1
    This should work. Is A in the same module/application as B or separate? If separate, is the module of A configured to start before the module of B (initialize-in-order in application.xml, or using module starting weights in the admin console)? – Brett Kail Jan 06 '12 at 19:35
  • Ok, i'll try to remove local interface. – Steffen Harbich Jan 09 '12 at 07:38
  • A is in another ejb module than B but within same application. Any ideas, how to set starting weights in Websphere? – Steffen Harbich Jan 09 '12 at 07:39
  • N1! The startup order did it. If you post this as answer then I can mark it as answer. Thanks a lot! – Steffen Harbich Jan 09 '12 at 08:30
  • Is there any chance to specify module startup weight / order via ejb-jar.xml or annotation, @bkail? – Steffen Harbich Jan 09 '12 at 09:02
  • The only options are initialize-in-order in application.xml or via the admin console. Arguably the product could automatically assign weights based on DependsOn, but it does not do that as far as I know. – Brett Kail Jan 09 '12 at 16:37

1 Answers1

1

If A is in a different module/application as B, then you need to ensure that the module of A is configured to start before the module of B. You can either use initialize-in-order in application.xml, or use module starting weights in the admin console.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90