Note that there are some explanatory texts on larger screens.

plurals
  1. POEJB Stateless Session Bean - could not create error
    primarykey
    data
    text
    <p>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.</p> <p>I have created a stateless Session Bean to return a simple String as follows:</p> <pre><code>@Stateless public class SDBSStatelessSessionBean implements SDBSStatelessSessionBeanRemote { @Override public String sayHello() { return "This seems to be working just fine."; } } </code></pre> <p>with the interface definition as:</p> <pre><code>@Remote public interface SDBSStatelessSessionBeanRemote { String sayHello(); } </code></pre> <p>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).</p> <p><strong>My problem</strong> 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:</p> <pre><code>javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB </code></pre> <p>the exception was caused by: <strong>NoClassDefFoundError</strong></p> <p>This is how the servlet makes the call:</p> <pre><code>@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("&lt;html&gt;"); out.println("&lt;head&gt;"); out.println("&lt;title&gt;Test Servlet&lt;/title&gt;"); out.println("&lt;/head&gt;"); out.println("&lt;body&gt;"); out.println("&lt;p&gt;" + sDBSStatelessSessionBean.sayHello() +"&lt;/p&gt;"); out.println("&lt;/body&gt;"); out.println("&lt;/html&gt;"); } catch (Exception e) { out.println("&lt;p&gt;" + e.getMessage() + "&lt;/p&gt;"); out.println("&lt;/body&gt;"); out.println("&lt;/html&gt;"); } finally { out.close(); } } </code></pre> <p>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).</p> <p>I'd <em>greatly</em> appreciate any advice/help pointing me in the right direction.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload