[jboss-user] [Management, JMX/JBoss] - Re: Bug? Multiple interfaces in the implementation causes De

jaikiran do-not-reply at jboss.com
Wed Feb 11 10:06:37 EST 2009


anonymous wrote : @Service(objectName=StaffImportScanner.OBJECT_NAME)
  |   | @Management(StaffImportScannerService.class)
  |   | public class StaffImportScanner implements StaffImportScannerService, TriggerListener {
  |   | ...
  |   | }
  |   | 	
  | 
  | 
  | 
  | TriggerListener is an interface from the quartz framework. StaffImportScannerService is an own defined interface that I want to expose. 

@Service is an extension to EJB3 session beans. So the @Service should have either a remote or local business interface defined. If you don't specify the local or remote business interface (either through xml or through annotation), then the server tries to discover this information. So if you have something like:

  | @Service(objectName=StaffImportScanner.OBJECT_NAME)
  | @Management(StaffImportScannerService.class)
  | public class StaffImportScanner implements StaffImportScannerService

The server will consider the StaffImportScannerService as the @Local business interface (even though you haven't explicitly specified that). This works when the bean class implements just one interface. If the class implements more than one interface, then there is no way to infer which one of the interfaces is expected to be the business interface of the bean. And hence the error. In such cases, the bean developer is expected to explicitly specify either the @Local or @Remote interface (through annotation or xml). Here's how you can do it through annotation:



@Service(objectName=StaffImportScanner.OBJECT_NAME)
  | @Management(StaffImportScannerService.class)
  | @Remote (StaffImportScannerService.class)
  | public class StaffImportScanner implements StaffImportScannerService, TriggerListener {
  | ...
  | }
  | 
  | 

It's upto you to decide whether you want @Remote or @Local.


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4209089#4209089

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4209089



More information about the jboss-user mailing list