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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:01:12+00:00 2026-05-21T22:01:12+00:00

Let me start by pointing out that while I’ve been using Java SE for

  • 0

Let me start by pointing out that while I’ve been using Java SE for a while now this is my first foray into Java EE territory. I’m using Netbeans 6.9 and the Netbeans code generator to do most of the heavy lifting (more on this further down). The version of GlassFish is 3 – the bog standard one that ships when you download Netbeans.

I have created a stateless Session Bean to return a simple String as follows:

@Stateless
public class SDBSStatelessSessionBean implements SDBSStatelessSessionBeanRemote {

    @Override
    public String sayHello() {
        return "This seems to be working just fine.";
    }     
}

with the interface definition as:

@Remote
public interface SDBSStatelessSessionBeanRemote {

   String sayHello();
}

The class and the interface were both created by using the ‘Insert Code’ feature that Netbeans provides. I figure this way I avoid making any stupid newbie errors (oh the irony).

My problem is that when I try to call the Enterprise bean from a servlet (the call was added using the ‘Call Enterprise Bean’ option from the Netbeans code generator) I get the following error:

javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB

the exception was caused by:
NoClassDefFoundError

This is how the servlet makes the call:

@EJB
private SDBSStatelessSessionBeanRemote sDBSStatelessSessionBean;

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Test Servlet</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<p>" + sDBSStatelessSessionBean.sayHello()  +"</p>");
        out.println("</body>");
        out.println("</html>");
    } catch (Exception e) {
        out.println("<p>" + e.getMessage() + "</p>");
        out.println("</body>");
        out.println("</html>");
    } finally {
        out.close();
    }
}

I’m afraid that I have not been able to find a solution to this problem after extensive Googling (mostly because the few forum posts that seem to come near this problem contain too much jargon for me to follow the solution).

I’d greatly appreciate any advice/help pointing me in the right direction.

  • 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-21T22:01:13+00:00Added an answer on May 21, 2026 at 10:01 pm

    If this is a local EJB (in the same JVM / EE container as your servlet) you could try declaring your EJB as a @LocalBean (under the @Stateless annotation). You could also remove the @Remote interface (and make your EJB no loger implement it).

    So your EJB would become

    @Stateless
    @LocalBean
    public class SDBSStatelessSessionBean
    {
        public String sayHello() 
        {
            return "This seems to be working just fine.";
        }     
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me start out by saying that I'm not a JavaScript developer so this
Let me start with pointing out, this is not an easy question to answer.
Let me start by saying that I do not advocate this approach, but I
First off, let me start off that I am not a .net developer. The
Let me start off by clarifying that(before you guys dismiss me), this is not
Let me start off with a bit of background. This morning one of our
Let me start by saying I'm a huge fan of the elegance of this
Before I start with the real question, let me just say that I might
Let me start by saying that I'm not a power-JavaScript/jQuery programmer, I do very
let me start with that i am pretty new to c# currently i have

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.