Cannot inject EJB with@EJB annotation
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
add a comment |
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
add a comment |
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
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
annotations ejb
asked Nov 21 '18 at 17:57
user7616817user7616817
286
286
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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)
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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)
add a comment |
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)
add a comment |
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)
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)
answered Nov 21 '18 at 20:15
Mehran MastcheshmiMehran Mastcheshmi
4081310
4081310
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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