0 Replies Latest reply on Nov 27, 2019 8:41 AM by inkimannen

    Wildfly 10 or higher, JavaEE7, EJBs and RESTful-services




      I have an application, maven multimodule, that has the following modules.

      1. module-parent
      2. module-ear
      3. module-ejb (handles the db-connection, in my 'ServiceBean'-class )
      4. module-web (restful-services)


      I am able now to deploy the ear-file to Wildfly 10, access the Restful-services in the web-module and make use of the db-connection implemented in the 'ServiceBean'-class.

      All is fine there. The configuration in the web.xml  is a bit 'hairy' I guess.

      I found a restful-client / restful-service at howtodoinjava (as a proof-of-concept to upload large files , up to 6GB) , those project is available in this repo.

      I hope that my README.md-file is uptodate, if you would like to try this out and ask for improvements if needed.You can deploy the service in Tomcat, upload a file with the TestClient.java.

      As you can see in the pom.xml the project has dependencies on org.glassfish.jersey ( making this statement, it is my hypothesis that these dependencies are giving me problem later on)


      What I would like to do, is to replace the current 'module-web' with a new web-module ( the web-project in the RESTfulServerClient-repo )

      I can call the '/hello'-endpoint.

      Doing the following addition to the JerseyService-class (adding the EJB-bean to be injected) the 'bean' variable on line 16 is always empty.


      public class JerseyService {
        private final static Logger logger = Logger.getLogger(Service.class);
        private ServiceBean bean;
        public Service() {
        public Response tst() {
        logger.info("@GET /hello");;
        logger.info("ServiceBean is "+bean);
        return Response.status(200).entity("service ok").build();




      my web.xml has the following content






      So the injections does not to work now, it works in my original module-web(4) where I am using a set of different setup.

      I can see the ejb:s in the wildfly admi-interface, so the ear has been deployed but the restful services seem not to be able to fetch them.


      The reason why I am not using the above setup is that I am unsure on how to write a restful-service&restful-client using the below dependencies ( any suggestions ?)


      <web-app xmlns="http://java.sun.com/xml/ns/javaee"


               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"





          <!-- Auto scan REST service -->






          <!-- Auto scan REST service -->






          <!-- this should be the same URL pattern as the servlet-mapping property -->





















      I hope that you are able to give me some advice here.

      and/or pinpoint me to a good book/course on JavaEE 7 or higher ( and how to deploy in Wildfly, maven ) .


      best, i