Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

REST implemented by an EJB with remote interface

 
Ranch Hand
Posts: 82
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all.

I'am trying to implement a REST web service using EJB in an EAR project.

The implementation of javax.rs.core.Application is


I did it with an EJB with no interface inside the WAR - ok
I did it with an EJB with local interface inside the WAR - ok
I did it with an EJB with local interface inside an EJB module (RestUno) - ok

but if i add a remote interface, the service is not working!

I've tryed "only remote interface"


and also with a bean with a local and a remote interface:



I'am missing something? It's impossible to use an EJB with remote interface (even if a local one is provided)?
 
Bartender
Posts: 1268
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ciao Daniele,

With REST actually I was able only to a) write an extension of Application and define which interfaces were exposed (just like you) b) use local interfaces in EJB colocated to the same war project where Application is define. I was never able to expose a local EJB in the same ear but not in the same war.
Anyway, as you can imagine, you may easily use any other EJB (with or without remote interfaces) from the local EJB exposed via REST.
 
daniele licitra
Ranch Hand
Posts: 82
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

I've found the error.
I've forget the index in the for in some try that I did.

for(int i = 0; i< rs.length; i++){
o = ctx.lookup(rs[0]);
classes.add(o);
}

must be


Now all kind of EJB works!
 
Claude Moore
Bartender
Posts: 1268
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's interesting... may I ask you which appserver you're using ?
 
daniele licitra
Ranch Hand
Posts: 82
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure! I use Wildfly 8.1.0
 
Claude Moore
Bartender
Posts: 1268
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks... I'm using WebSphere 8.5 instead. Anyway i'll try again, maybe there were something missing even in my case.
 
daniele licitra
Ranch Hand
Posts: 82
Netbeans IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here the link to my project used for learn&test
https://drive.google.com/open?id=0B4JqLzLBcGx9QUtSS3RzVlVoRW8&authuser=0

I hope may be useful
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic