• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Why @LocalBean is needed to deploy a EJB ?

 
Bartender
Posts: 2442
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In NetBean, I have a web application called RoleBasedEJB.
I have a class like this :






Client side:


When the @LocalBean is commented out in the resource root class, Glassfish gives me this error when the client tried to access the resource using credentials john/secret.



Why @LocalBean is important in this case?
 
Creator of Enthuware JWS+ V6
Posts: 3412
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An EJB with a remote view is not required to be supported as a JAX-RS resource. I am not sure what kind of annotation you have on your StudentService (@Remote maybe?).

Adding the @LocalBean makes the EJB have a local view and that has to be supported by JAX-RS.

Regards,
Frits
 
Himai Minh
Bartender
Posts: 2442
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
Before, the StudentService interface did not have any annotation. Now, I put @Remote in this:


The implementation resource root class, StudentServiceImpl has @LocalBean, @Stateless and @DeclaredRoles.

It works the same after I put @Remote in the StudentService interface.

Does it mean all JAX-RS resource root class must be annotated with @LocalBean if it is deployed as @Stateless or @Singleton?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3412
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, or put @Local in the StudentService interface.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic