Cannot inject EJB with@EJB annotation












0















Trying to inject an EJB into another one using @EJB annotation :
1) The first EJB "TestEJB" has two interfaces (AdditionRemote and AdditionLocal)
and a class implementation (Addition)



2) The second EJB "TestEJB2" has two interfaces (DivisionRemote and DivisionLocal) and a class implementation (Division)



here is the code of the "TestEJB" where i want to inject a reference of TestEJB2 :



    @EJB
private Division d;

public Addition() {
// TODO Auto-generated constructor stub
}

@Override
public int add(int a, int b) {
return a+b;
}

@Override
public void call() {
// TODO Auto-generated method stub
d.div(4, 2);
}


However when i use the @EJB annotation in the code i cannot deploy TestEJB anymore.
i get this error msg :



[org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: () - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."TestEJB.jar".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class logic.Addition with ClassLoader ModuleClassLoader for Module "deployment.TestEJB.jar" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: Labsurd/Division;
Caused by: java.lang.ClassNotFoundException: absurd.Division from [Module "deployment.TestEJB.jar" from Service Module Loader]"}}


18:45:39,399 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0016: Replaced deployment "TestEJB.jar" with deployment "TestEJB.jar"
18:45:39,400 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."TestEJB.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"










share|improve this question



























    0















    Trying to inject an EJB into another one using @EJB annotation :
    1) The first EJB "TestEJB" has two interfaces (AdditionRemote and AdditionLocal)
    and a class implementation (Addition)



    2) The second EJB "TestEJB2" has two interfaces (DivisionRemote and DivisionLocal) and a class implementation (Division)



    here is the code of the "TestEJB" where i want to inject a reference of TestEJB2 :



        @EJB
    private Division d;

    public Addition() {
    // TODO Auto-generated constructor stub
    }

    @Override
    public int add(int a, int b) {
    return a+b;
    }

    @Override
    public void call() {
    // TODO Auto-generated method stub
    d.div(4, 2);
    }


    However when i use the @EJB annotation in the code i cannot deploy TestEJB anymore.
    i get this error msg :



    [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: () - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."TestEJB.jar".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class logic.Addition with ClassLoader ModuleClassLoader for Module "deployment.TestEJB.jar" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: Labsurd/Division;
    Caused by: java.lang.ClassNotFoundException: absurd.Division from [Module "deployment.TestEJB.jar" from Service Module Loader]"}}


    18:45:39,399 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0016: Replaced deployment "TestEJB.jar" with deployment "TestEJB.jar"
    18:45:39,400 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
    WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."TestEJB.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"










    share|improve this question

























      0












      0








      0








      Trying to inject an EJB into another one using @EJB annotation :
      1) The first EJB "TestEJB" has two interfaces (AdditionRemote and AdditionLocal)
      and a class implementation (Addition)



      2) The second EJB "TestEJB2" has two interfaces (DivisionRemote and DivisionLocal) and a class implementation (Division)



      here is the code of the "TestEJB" where i want to inject a reference of TestEJB2 :



          @EJB
      private Division d;

      public Addition() {
      // TODO Auto-generated constructor stub
      }

      @Override
      public int add(int a, int b) {
      return a+b;
      }

      @Override
      public void call() {
      // TODO Auto-generated method stub
      d.div(4, 2);
      }


      However when i use the @EJB annotation in the code i cannot deploy TestEJB anymore.
      i get this error msg :



      [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: () - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."TestEJB.jar".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"
      Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class logic.Addition with ClassLoader ModuleClassLoader for Module "deployment.TestEJB.jar" from Service Module Loader
      Caused by: java.lang.NoClassDefFoundError: Labsurd/Division;
      Caused by: java.lang.ClassNotFoundException: absurd.Division from [Module "deployment.TestEJB.jar" from Service Module Loader]"}}


      18:45:39,399 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0016: Replaced deployment "TestEJB.jar" with deployment "TestEJB.jar"
      18:45:39,400 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
      WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."TestEJB.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"










      share|improve this question














      Trying to inject an EJB into another one using @EJB annotation :
      1) The first EJB "TestEJB" has two interfaces (AdditionRemote and AdditionLocal)
      and a class implementation (Addition)



      2) The second EJB "TestEJB2" has two interfaces (DivisionRemote and DivisionLocal) and a class implementation (Division)



      here is the code of the "TestEJB" where i want to inject a reference of TestEJB2 :



          @EJB
      private Division d;

      public Addition() {
      // TODO Auto-generated constructor stub
      }

      @Override
      public int add(int a, int b) {
      return a+b;
      }

      @Override
      public void call() {
      // TODO Auto-generated method stub
      d.div(4, 2);
      }


      However when i use the @EJB annotation in the code i cannot deploy TestEJB anymore.
      i get this error msg :



      [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: () - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."TestEJB.jar".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"
      Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class logic.Addition with ClassLoader ModuleClassLoader for Module "deployment.TestEJB.jar" from Service Module Loader
      Caused by: java.lang.NoClassDefFoundError: Labsurd/Division;
      Caused by: java.lang.ClassNotFoundException: absurd.Division from [Module "deployment.TestEJB.jar" from Service Module Loader]"}}


      18:45:39,399 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0016: Replaced deployment "TestEJB.jar" with deployment "TestEJB.jar"
      18:45:39,400 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
      WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."TestEJB.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "TestEJB.jar"







      annotations ejb






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 17:57









      user7616817user7616817

      286




      286
























          1 Answer
          1






          active

          oldest

          votes


















          0














          you must inject one of the interfaces or add @localbean (for no-interface view) to Division



          @EJB
          private DivisionLocal d;

          or

          @EJB
          private DivisionRemote d;


          because the proxy is created for interfaces(when you implement interface the no-interface view will not be created for session bean unless you annotate it with @LocalBean)






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418018%2fcannot-inject-ejb-withejb-annotation%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            you must inject one of the interfaces or add @localbean (for no-interface view) to Division



            @EJB
            private DivisionLocal d;

            or

            @EJB
            private DivisionRemote d;


            because the proxy is created for interfaces(when you implement interface the no-interface view will not be created for session bean unless you annotate it with @LocalBean)






            share|improve this answer




























              0














              you must inject one of the interfaces or add @localbean (for no-interface view) to Division



              @EJB
              private DivisionLocal d;

              or

              @EJB
              private DivisionRemote d;


              because the proxy is created for interfaces(when you implement interface the no-interface view will not be created for session bean unless you annotate it with @LocalBean)






              share|improve this answer


























                0












                0








                0







                you must inject one of the interfaces or add @localbean (for no-interface view) to Division



                @EJB
                private DivisionLocal d;

                or

                @EJB
                private DivisionRemote d;


                because the proxy is created for interfaces(when you implement interface the no-interface view will not be created for session bean unless you annotate it with @LocalBean)






                share|improve this answer













                you must inject one of the interfaces or add @localbean (for no-interface view) to Division



                @EJB
                private DivisionLocal d;

                or

                @EJB
                private DivisionRemote d;


                because the proxy is created for interfaces(when you implement interface the no-interface view will not be created for session bean unless you annotate it with @LocalBean)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 '18 at 20:15









                Mehran MastcheshmiMehran Mastcheshmi

                4081310




                4081310
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418018%2fcannot-inject-ejb-withejb-annotation%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Paul Cézanne

                    UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                    Angular material date-picker (MatDatepicker) auto completes the date on focus out