You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Overview

Error formatting macro: snippet: java.lang.NullPointerException

The Code

For this example we have a simple Stateful bean called TelephoneBean as defined below. As a simple way of demonstrating the state we have to methods: speak and listen. You call speak and pass in some text, then you call listen to get your answer.

bean
Error formatting macro: snippet: java.lang.NullPointerException
business interface
Error formatting macro: snippet: java.lang.NullPointerException

EJB3 Notes

The bean class uses the annotation @Remote but does not specify a list of interfaces as is normally required. Per EJB3 rules, if the bean implements exactly one business interface it may use @Remote with no other values and that business interface is then implied to be a remote business interface. The same rule applies to identical usage of @Local.

The critical thing to know is that if you add another interface the rules change and require that you specify both interfaces in the @Remote annotation as in @Remote(

Unknown macro: {Telephone.class, SecondInterface.class}

).

Error formatting macro: snippet: java.lang.NullPointerException
Error formatting macro: snippet: java.lang.NullPointerException
Error formatting macro: snippet: java.lang.NullPointerException
  • No labels