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

  • Home
  • SEARCH
  • 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 6621881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:19:46+00:00 2026-05-25T21:19:46+00:00

I’m learning J2EE and EJB and I’ve run into a strange problem. This is

  • 0

I’m learning J2EE and EJB and I’ve run into a strange problem. This is my project setup:

I’m using Glassfish 3.1 and Eclipse 3.7. I have two projects in Eclipse:

  1. An EJB 3.0 compliant project, myEjbProject
  2. A Dynamic Web Project, myWebProject

I’m injecting an EJB session bean mySessionBeanPackage.mySessionBean from myEjbProject into a servlet myServletPackage.myServlet in myWebProject and then (in the servlet) calling a simple method defined in the session bean.

I’ve provided myWebProject with a reference to myEjbProject (using the Properties -> Project References dialog). However, for some reason, the server is unable to find the session bean. The exact error I get is:

SEVERE: Class [ LmySessionBeanPackage/mySessionBean ] not found. Error while loading [ class myServletPackage.myServlet ]

Note that both the EJB project and the web project have been published to the server and I’ve double-checked that the class file generated for the bean is, in fact, present on the server (so I can’t think of a reason why the server isn’t able to find them).

Can anyone tell me what I’m doing wrong?

I’ve also tried

  • adding the classes folder of myEjbProject explicitly to the Java Build Path -> Libraries list of myWebProject. This is in addition to the project reference (although I think adding a project reference should have sufficed in the first place). Anyway, it makes no difference (same error message as before).

  • creating a JAR file from myEjbProject using the Export -> EJB Jar File option (I don’t want to get into writing an Ant script at the moment). I then put this JAR in the Java Build Path -> Libraries section of myWebProject. This approach does not solve the problem either (same error message as before).

  • modifying the session bean to have

    • no interface
    • a local interface
    • a remote interface

    and modifying the injection accordingly. E.g., for a bean with only a local interface, I used:

    @EJB mySessionBeanPackage.mySessionBeanLocal myBean

    This approach did not solve the problem either (same error message as before).

  • doing away with myEjbProject altogether and adding the session bean to myWebProject as myServletPackage.mySessionBean (same package as the servlet). In this case, I can inject the session bean successfully into the servlet using

    @EJB mySessionBeanPackage.mySessionBean myBean

  • doing away with myEjbProject altogether and adding the session bean to myWebProject as mySessionBeanPackage.mySessionBean (a new package). In this case also, I can inject the session bean successfully into the servlet using

    @EJB mySessionBeanPackage.mySessionBean myBean

  • 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-25T21:19:47+00:00Added an answer on May 25, 2026 at 9:19 pm

    I would recommend taking a look at the actual EAR that Eclipse packages and deploys to the server. You can do this by exporting the EAR project (right click on EAR project -> export -> Java EE -> EAR file)

    I think the step you are missing is to add the EJB project to the WEB project’s MANIFEST file. But just in case you are missing a few more steps I would check the following:

    1. EJB and WEB projects are modules of the EAR project. Right click the EAR project -> properties -> Deployment Assembly -> Add -> Project -> select the EJB and the WEB project. If you export your EAR project now you will notice that the EJB and the WEB project is packaged with the EAR.
    2. Add EJB project to MANIFEST of WEB project. Right click the WEB project -> properties -> Deployment Assembly -> Manifest entries -> Add -> select the EJB project. You can open the MANIFEST.MF file and see that it now includes the EJB project.

    Also I like adding the EJB project to the WEB project build path just so that it is included in the WEB’s classpath: Right click WEB project -> properties -> Java Build Path -> Projects -> Add -> Select the EJB.

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

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6

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.