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 8965215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:45:55+00:00 2026-06-15T16:45:55+00:00

I have a multi-ear project. Some EJB’s reside in project1.ear, and I need to

  • 0

I have a multi-ear project. Some EJB’s reside in project1.ear, and I need to use it in project2.ear.

I’m trying the following:

@Remote
public interface MyService {

    public static final String JNDI_NAME = "service/MyService"; 

    // methods

}


@Stateless(name = MyService.JNDI_NAME, mappedName = MyService.JNDI_NAME)
public class MyServiceImpl implements MyService {
   // implementations...
}

Then, in some project2.ear class, I inject the EJB like this:

@Stateless(name = "other/Service")
public class OtherServiceImpl implements OtherService{

    @EJB(mappedName = MyService.JNDI_NAME)
    private MyService service;
}

But I got a lot of “FailedToConstructException” and EJB related exception, with the following cause:

Caused by: javax.naming.NameNotFoundException: service/MyService -- service jboss.naming.context.java.service.MyService
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
    at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
    at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_05]
    at org.jboss.as.ejb3.deployment.processors.EjbLookupInjectionSource$1.getReference(EjbLookupInjectionSource.java:82) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
    ... 104 more

What am I doing wrong?

Thanks in advance.

  • 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-06-15T16:45:56+00:00Added an answer on June 15, 2026 at 4:45 pm

    Try to browse JNDI tree to see whether your service/MyService exists. If you’re using JBoss 6, you can find instructions here. Not sure if they added it into higher versions.

    Next, check packages – interface MyService needs to be in the same package in both ears, otherwise lookup will fail.

    Finally, there’s no need to have both name and mappedName attributes in @Stateless annotation, mappedName is enough. You can also try to inject MyService with @EJB annotation without any attribute, if project1.ear is only one that implements that interface, application server will inject it:

    @EJB
    private MyService service;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have: Textbox(Multi-line) Panel Different controls inside panel (buttons,textbox) Scenario: I need to add
I'm working on a multi-project, and right now I have a structure that resembles
We have multi-website(5) multi-store-view(13) shop. What we need is that only 3 store view
there I met a weird problem. I have a multi-modules enterprise project that is
I have multi (2 and more) display(screen) system and I need to define on
greetings all, i have multi sub-domain on my domainname.com , i need to redirect
I have multi module project where one project contains excel spreadsheet and it is
I need to have multi-line comments within a group of macros so that one
i know some locale's (e.g. Far East locales) have multi-byte character sets, where it
I have multi-lingual TeX document mostly in Russian but I also include some terms

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.