• Post Reply Bookmark Topic Watch Topic
  • New Topic

REST implemented by an EJB with remote interface

 
daniele licitra
Ranch Hand
Posts: 81
Java Linux Netbeans IDE
  • 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)?
 
Claude Moore
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • 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: 81
Java Linux Netbeans IDE
  • 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
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • 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: 81
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure! I use Wildfly 8.1.0
 
Claude Moore
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • 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: 81
Java Linux Netbeans IDE
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!