Howto package WAR with a REST Client for Remote EJB (with Maven) in Java EE 6 environment? -


got war maven module rest client, implemented @stateless ejb) in module (say) "mycompany-client".

this rest client invoke ejb implemented in ear module, jar module inside (say) "mycompany-business-service". (ear , jar module under parent pom module)

war , ear running on weblogic 12c (java ee 6). but on distinct servers.

my module "mycompany-client" (war)

rest client

@stateless @path("clusters") public class clusterresource {      @ejb     clusterservice service;      @get     @produces(mediatype.application_json)     public list<cluster> getitems() {         return service.getallclusters();     }     [...] 

my ejb module "mycompany-business-service" (a jar in ear)

ejb (with remote business interface)

  • remote interface (clusterservice)

    @remote public interface clusterservice {      public list<cluster> getallclusters(); } 
  • implementation (clusterservicebean)

        @stateless     @remote(clusterservice.class)     public class clusterservicebean implements clusterservice {      @override     public list<cluster> getallclusters() {         // job         return ...;     }     [...] 

in dependencies of war (pom.xml), have declare dependecy "mycompany-business-service" jar :

    <dependency>         <groupid>com.mycompany</groupid>         <artifactid>mycompany-business-services</artifactid>         <version>1.0.0</version>         <scope>provided</scope>             <== or without     </dependency> 

so ?...

1) choice 1 : using "provided" scope : ?

as "mycompany-business-service" deployed on weblogic server, thought use "provided" scope. if this, deploy (via great "wls-maven-plugin") fails classnotfoundexception concerning service ejb injected !

2) choice 2 : no "provided" scope, jar embedded ?

in case, injection , call ejb works perfectly... but : invoked ejb local/embedded one, not remote 1 !

finally, question :

howto package war rest client remote ejb injected ?


Comments