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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:33:33+00:00 2026-06-09T07:33:33+00:00

I have an EAR file (JEE6) containing one ejb-jar (sample-ejb) file and one war

  • 0

I have an EAR file (JEE6) containing one ejb-jar (sample-ejb) file and one war file (sample-web).
Here is the structure:

sample-ear
         |----sample-ejb.jar
         |         |---TestEjb.java (@Singleton)
         |
         |----sample-web
                   |---StartupEjb.java (@Singleton,@Startup)
                   |---TestListener.java (@WebListener)

when I want to inject TestEjb to StartupEjb or TestListener:

@EJB
private TestEjb testEjb;

I get following error:

Glassfish:

Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=com.sample.StartupEjb/testEjb,Remote 3.x interface =com.sample.TestEjb,ejb-link=null,lookup=,mappedName=,jndi-name=com.sample.TestEjb,refType=Session into class com.sample.StartupEjb: Lookup failed for 'java:comp/env/com.sample.StartupEjb/testEjb' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}

weblogic:

Caused By: weblogic.application.naming.ReferenceResolutionException: [J2EE:160200]Error resolving ejb-ref "com.sample.StartupEjb/testEjb" from module "sample-web-1.0-SNAPSHOT.war" of application "com.sample_sample-ear_ear_1.0-SNAPSHOT". The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because no EJBs in the application were found to implement the "com.sample.TestEjb" interface. Link or map this ejb-ref to its target EJB and ensure the interfaces declared in the ejb-ref are correct.

Both Glassfish and Weblogic can not find TestEjb!

By the way, when I create a remote interface for TestEjb and use that for injection it works well!
But I don’t want to define remote interfaces and I want to use EJB with no interface. I don’t think that I must define a remote interface for this simple usecase!

You can download the source code from here: https://dl.dropbox.com/sh/63hn3n9y3p5ypvi/SsG9iZIvx9/sample.zip?dl=1

It’s a simple Maven project created using NetBeans.

  • 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-09T07:33:34+00:00Added an answer on June 9, 2026 at 7:33 am

    You normaly MUST define a local interface, e. g.

    @Singleton
    @Local(PublicInterface.class)
    public class MyBean implements PublicInterface {
      ...
    }
    

    If you explicitly avoid this interface you must mark your bean as @LocalBean:

    @Singleton
    @LocalBean
    public class MyBean {
      ...
    }
    

    PS: Code is untested but should help.

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

Sidebar

Related Questions

I have an EAR file containing multiple ejb-jar and war. In an ejb-jar, I
Let's say I have two ear file and one .jar file with an EJB
I have an EAR file with a nested EJB project, a .war dynamic web
I have an ear file, containing a war file. The war contains a number
I have deployed an ejb in a war file(not an ear file). I have
I have an EAR file with a bunch of JARs in it, and one
I have multiple (8) WAR files and 1 EAR file that I want to
I have next package structure webService.ear -- dependency.jar -- some.class Can I remove some.class
I have an .ear file which contains multiple war files. I am moving the
I have application packed as an .ear file with ejb module inside. There is

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.