Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7522509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:32:37+00:00 2026-05-30T02:32:37+00:00

I am trying to inject an EJB with the @EJB annotation: when I inject

  • 0

I am trying to inject an EJB with the @EJB annotation:

  • when I inject an EJB into another EJB in the same ear it works fine.
  • when I inject an EJB into another EJB from another ear in the same
    server I get an exception:

EJB threw an unexpected (non-declared) exception during invocation of
method “sayHello”. Exception data: javax.ejb.EJBException: Injection
failure; nested exception is:
com.ibm.ejs.container.EJBNotFoundException: EJB with interface
com.mycompany.myapp.ejb.test2 not present in application myapp1

I’m using WebSphere 7 and EJB 3.0. When I’m doing a jndi lookup myself, it works fine. How do I let the container know from where to inject my remote beans?

myapp1.ear contains the following : myapp1.jar (where the EJB is)

myapp1 EJB :

package com.mycompany.myapp1.ejb.test1;

@Remote
public interface HelloEjb1 { 
    public String sayHello();
}

EJB Impl :

package com.mycompany.myapp.ejb.test1;

@Stateless
public class HelloEjbImpl1 implements HelloEjb1 {

    @EJB
 HelloEjb2 helloEjb2;

    @Override
    public String sayHello() {
        return HelloEjb2.sayHello();
    }
}

myapp2.ear contains the following : myapp2.jar (where the EJB is)

myapp2 EJB :

package com.mycompany.myapp2.ejb.test2;

@Remote
public interface HelloEjb2 { 
    public String sayHello();
}

EJB Impl :

package com.mycompany.myapp2.ejb.test2;

@Stateless
public class HelloEjbImpl2 implements HelloEjb2 {

    @Override
    public String sayHello() {
        return "Hello";
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:32:39+00:00Added an answer on May 30, 2026 at 2:32 am

    Specify the binding when deploying the application (1, 2), or include a META-INF/ibm-ejb-jar-bnd.xml in your client (myapp1) EJB module. It would look something like this:

    <ejb-jar-bnd
        xmlns="http://websphere.ibm.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd"
        version "1.0">
      <session name="HelloEjbImpl1">
        <ejb-ref name="com.mycompany.myapp.ejb.test1/helloEjb2"
            binding-name="myapp2/myapp2.jar/HelloEjbImpl2#com.mycompany.myapp1.ejb.test1.HelloEjb1"
      </session>  
    </ejb-jar-bnd>
    

    The ejb-ref name="..." can be simplified if you use @EJB(name="myrefname"). The binding-name can be simplified if your myapp2.jar includes a similar binding file with an <interface class="..." binding-name="..."/> element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an app that is trying to use @EJB annotation to inject remote
i'm trying to inject stuff into a custom ViewPage (ModelViewPage, from MvcContrib) public class
Currently I am trying to inject a stateless EJB into a CDI managed controller
I'm trying to inject Spring beans into an EJB using @Interceptors(SpringBeanAutowiringInterceptor.class) but I cannot
I'm trying to inject entire JSF managed bean into another managed bean by means
I am trying to Inject a seam component into another, auto creating it. But
Hi i am trying to inject custom css into a page my manifest file
I'm trying to inject some Scala code into my existing Java app. (So, being
I am trying to inject an IList into a constructor and want to know
I was trying to inject code into the Finder process using mach_inject . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.