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"
annotations ejb
add a comment |
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"
annotations ejb
add a comment |
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"
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 2 days ago
user7616817
216
216
add a comment |
add a comment |
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)
add a comment |
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)
add a comment |
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)
add a comment |
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)
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 2 days ago
Mehran Mastcheshmi
26829
26829
add a comment |
add a comment |
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