Cannot inject EJB with@EJB annotation











up vote
0
down vote

favorite












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


























    up vote
    0
    down vote

    favorite












    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
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      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 2 days ago









      user7616817

      216




      216
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          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',
            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








            up vote
            0
            down vote













            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

























              up vote
              0
              down vote













              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























                up vote
                0
                down vote










                up vote
                0
                down vote









                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 2 days ago









                Mehran Mastcheshmi

                26829




                26829






























                     

                    draft saved


                    draft discarded



















































                     


                    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

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    How to ignore python UserWarning in pytest?

                    Alexandru Averescu