Example of EJB3 (Session Bean) using Eclipse Europa and JBoss

April 25th, 2008  | Tags: , , , , ,

After the frustration of EJB 2, EJB 3 is growing in the community every day.

Different from EJB 2, EJB3 is simpler and much productive. However you have to pay attention before work with EJB3.

First of all, you have to make sure that your Production environment has Java 5 version, as well as your Application Server is JEE 5-compliance. Many servers do not have this configuration yet. (I myself work in a project that uses J2EE 1.4).

Also, EJB 3 does not need to be used in ALL applications. You have to think if in your project EJB is really necessary. In general, EJB are used when you need of distributed components.

JBoss is one of the most popular open-source Application Server and its version 4.2 supports JEE 5. Glassfish from Sun is also another good choice for free application server.

In this topic I am going to show you a simple example of how to create a Session Bean using Eclipse Europa and JBoss Application Server. If you do not have the JBoss AS installed, you can check this topic to install it.

After install Java 5 or 6, JBoss AS and Eclipse Europa, it is time to create the application itself. Let’s open the Eclipse and prepare our developer skill :)

Configuration JBoss within Eclipse Europa

Inside the Eclipse Europa, open the Servers view (Window -> Show View -> Servers). Right mouse click on Servers view and choose option New -> Server.

Choose the JBoss 4.2 and its path. After that the JBoss server should appear on the Servers view.

Creating the Enterprise Application Project

On Eclipse IDE (Using the Java EE perspective), right mouse click on Package Explorer and go to New -> Enterprise Application Project.

Choose the Project Name (e.g: TestApplication), Target Runtime (JBoss 4.2) and click on Next button.

On the next screen keep the EAR checked and click on Next. On the third screen, click on New Module button to select the modules you want to install. Let’s work on with two modules (EJB and Web). Choose these modules and click OK. Also, on third screen mark the option Generate Deployment Descriptor.

After that, the Enterprise Application Project will be created, as well as the EJB and Web modules. All of them can be reached in the Package Explorer.

Creating our first EJB component (Stateless Session Bean)

In Eclipse Europa, there is not an option to create a EJB component itself. You have to do it manually. However in the new EJB version, you can use Annotations rather than a Deployment Descriptor (XML) to map your components. As the annotation is much easier than XML, you will not loose productive in the component development.

Remember: In EJB 3 you need only two files: an Interface (local or remote) and its implementation. By default, the interface receives the name of the component and the implementation receives the name of the component plus Bean.

The first think to do is to create our Interface. In your example, we are going to use a simple Session Bean which has one method (public void getMessage). So creates this interface inside the EJB project. Right mouse click on TestApplicationEJB -> New -> Interface.

Also, put the method public String getMessage(); into this interface.

package lesson.stateless;
public interface HelloWorld {
	public String getMessage();
}

The next step is to create the class that implements this interface. The pattern is the class has the same name than the interface plus Bean.

To create a click, right mouse click on TestApplicationEJB -> New -> Class. Insert the class name and choose the Interface.

Note: As the interface calls HelloWorld, than our class calls: HelloWorldBean.

Now it is time to implement the HelloWorldBean.java class. It is a simple class which contains only one method. Look at its implementation below:

package lesson.stateless;
 
import javax.ejb.Remote;
import javax.ejb.Stateless;
 
@Stateless
@Remote(HelloWorld.class)
public class HelloWorldBean implements HelloWorld {
    public String getMessage() {
        return "Hello EJB World";
    }
}

Pay attention on line 6 and 7. The @Stateless annotation tells to the AS which the component is a Stateless Session Bean. Also, the @Remote annotation tells to the AS which interface is the remote for this implementation.

Done! Our EJB module is done to be deployed. If you are coming from EJB 2, you can see how the EJB 3 is much easier and productive :)

Using the Web Module as EJB Client.

It is common you have in the same EAR a EJB Module and a Web Module. In this case, the Web module works as a EJB Client, in other words, the We Module is going to be the FRONT-END as long as the EJB Module is going to be the BACK-END.

In our example we will use a simple Web Module. A single JSP file that call a servlet. The servlet makes connection with the EJB Module and print out in the console the message from EJB.

First of all, let’s create the JSP file. Expand the TestApplicationWeb and right click on WebContent -> New -> JSP. Create a jsp with the name index. Inside the JSP, put a call to the servlet. Let’s call our servlet as TestServlet. The JSP content could be anything like this:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>;
<h1>Web Module used as EJB Client</h1>
<a href="TestServlet">Click here to call the EJB component</a>

Now it is time to create the Servlet component. Right mouse click on TestApplicationWeb -> New -> Servlet. Put the name TestServlet and choose a package (if you want).

Before implement this method, we need to create a binding between the Web Module and the EJB Module. To do that right mouse click on TestApplicationWeb -> Properties.

Go to J2EE Module Dependencies and mark the option TestApplicationEJB.jar. Thus your Web module will see the EJB interfaces, but remember, you cannot call it directly.

Now we are able to implement the servlet. We are going to use only the method doGet (fell free to get rid of the doPost method). Inside the doGet method, we are going to call the EJB component and show its return message.

package lesson.servlets;
 
import java.io.IOException;
 
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import lesson.stateless.HelloWorld;
 
public class TestServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    static final long serialVersionUID = 1L;
 
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            InitialContext ctx = new InitialContext();
            HelloWorld hello = (HelloWorld) ctx.lookup("TestApplication/HelloWorldBean/remote");
            System.out.println(hello.getMessage());
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }
}

Check out the lines 18 to 20.

  • In the line 18, we start an InitialContext object. As we are working inside the same EAR than the EJB, we cannot pass none parameter for its constructor. In the next example (Creating a Java stand-alone client), you will see that a Properties file is required.
  • In the line 19 we call the remote object HelloWorld. Pay attention on its JNDI name. The JBoss pattern is: First the EAR name / The EJB Implementation Component / remove or local. The ctx.lookup method looks for the remote object inside the EJB module and returns its instance.
  • In the line 20 we prints out the return of the getMessage() method.

Note: The annotation @EJB does not work properly in JBoss server. If anyone had success using this annotation, please let me know :) .

Now you can run this application. Right mouse click on TestApplicationWeb -> Run As -> Run on Server. The first time you try to run the application, a screen regarding server configuration will come up. Select the JBoss 4.2 server (you previosly configurated) and mark the option Always use this sever when running this project. Click OK and the server will starts.

Inside the Eclipse you will see the web page. Click on the link and look at the Eclipse Console. A message from EJB should appears for you.

Creating a Java Stand-Alone Client

You should use EJB when you need of distributed components. Besides use distributed components in the server (through clustering, SOA, and so on), you can create a communication between a Stand-Alone application.

A Stand-Alone application calls the EJB in a similar way then Web Modules, however it has some particularities.

  1. You have to import some JBoss libraries to the stand-alone application
  2. You have to create a Properties file and use it in the InitialContext object
  3. The Stand-Alone application must “know” the remote components interfaces.

Create a Java Project, File -> New -> Project -> Java Project.

Import the following two files to this project

jbossall-client.jar
jboss-ejb3-client.jar

You can find these files inside $JBOSS_HOME/client directory. To add them to the Project classpath, right click on Java Project -> Propeties. Go to Java Build Path -> Libraries -> Add External JARs.

Also, inside the Properties screen, click on Projects tab and then Add button. Select the EJB module. This way your client application will see the remote ejb object.

Create a properties file (called jndi.properties) in the root of the Client project. The content of the file is below:

java.naming.factory.initial     = org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs     = org.jboss.naming:org.jnp.interfaces
java.naming.provider.url        = localhost:1099

Now create a simple Java class containing the void main (String args[]) method.

Implement this method, using the Properties file previously created as argument to InitialContext object.

package lesson.client;
 
import java.io.FileInputStream;
import java.util.Properties;
 
import javax.naming.InitialContext;
 
import lesson.stateless.HelloWorld;
 
public class TestClient {
 
    public static void main(String[] args) throws Exception {
        Properties props = new Properties();
        props.load(new FileInputStream("jndi.properties"));
        InitialContext ctx = new InitialContext(props);
        HelloWorld hello = (HelloWorld) ctx.lookup("TestApplication/HelloWorldBean/remote");
        System.out.println(hello.getMessage());
    }
}

Before run the client application, make sure the Application Server is running. If so, runs your Main class and see the output in the Eclipse Console view.

This topic ends here. I hope this topic can help the people who wants to work with EJB in Eclipse Europa. The next topic is the same example, but using Netbeans 6.1 and Glassfish. I hope you enjoy it.

  1. Parviz
    April 28th, 2008 at 12:56
    #1

    Hello,

    i did exactly as you told (with jboss 4.2.2GA and then 5.0.0.Beta4).
    but i get this error message:

    I am thankful if you have an idea.
    Parviz

    Exception in thread “main” javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = -2711693270411201590, local class serialVersionUID = 1126421850898582900]
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:723)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at client.SimpleSessionClient.main(SimpleSessionClient.java:24)
    Caused by: java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = -2711693270411201590, local class serialVersionUID = 1126421850898582900
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
    at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:653)
    … 3 more

  2. jrjuniorsp
    April 28th, 2008 at 14:15
    #2

    It seems a lookup problem (Communication between the Client and the EJB remote object).

    Are you using a stand-alone client or a WebModule inside the same EAR file?

    I did not get this error before, so try a search in google and hopefully you will find your answer.

  3. Parviz
    April 28th, 2008 at 15:27
    #3

    Hello again

    I found it, i did a mistake and i compile the code with other library (not current liraries of jboss) and therefore i got this error message. your tutorial is excellent!

    Parviz

  4. Ravi
    April 29th, 2008 at 19:10
    #4

    Hi,
    Thanks for the excellent tutorial for the basic project creation. It helped me in creating my first EJB 3.0 project.
    Thanks again.

    Ravi

  5. ToMaZ
    April 30th, 2008 at 07:00
    #5

    I have to honesty say that this is the best simple example (for the beginners) which I have found.
    Keep on doing the good work – simple, very clear, very nicely put together example.

    ToMaZ from Slovenia

  6. Madhukar
    May 8th, 2008 at 08:27
    #6

    I this is simply the best example for EJB 3.0
    Good Work.. it really helped a lot… thanks again…

  7. May 13th, 2008 at 07:25
    #7

    Hai, Am getting following Error.
    This is while building:
    ***********************
    —————————————————————————————————-
    BUILD FAILED
    E:\eclipse\plugins\org.eclipse.jst.server.generic.jboss_1.5.105.v200709061325\buildfiles\jboss323.xml:33: Unable to remove existing file D:\jboss-5.0.0.Beta4\server\default\deploy\TestApplication.ear

    Total time: 250 milliseconds
    —————————————————————————————————-
    This is while running:
    **********************
    12:53:08,135 ERROR [STDERR] javax.naming.NameNotFoundException: TestApplication not bound
    12:53:08,135 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
    12:53:08,135 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
    —————————————————————————————————-
    Could you please assist me. Thanks, Kind regards.

  8. jrjuniorsp
    May 13th, 2008 at 11:49
    #8

    It seems the deploy was not done successfully.
    Try to undeploy the application (TestApplication.ear) yourself and run it again from Eclipse.
    To undeploy an application on JBoss, the easiest way is delete the .ear file, in you case, delete the TestApplication.ear into D:\jboss-5.0.0.Beta4\server\default\deploy\ directory.
    After that, run JBoss again (outside from Eclipse) and see if any exception is thrown on console, if not, try to deploy and run the AS from Eclipse.

    Good luck

  9. May 15th, 2008 at 11:44
    #9

    Hai Jrjuniorsp Thanks. Now Build issue is resolved. Deloy it is a problem.
    —————————————————————————

    7:09:54,750 ERROR [STDERR] javax.naming.NameNotFoundException: TestApplication not bound
    17:09:54,750 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
    17:09:54,750 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
    17:09:54,750 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
    17:09:54,750 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
    ——————————————————————————————-
    I deploy it by doing Export>>EJB>>EJB Jar file and Export>>Web>>WAR file and placed it under
    JBoss deploy folder. Please correct me if am wrong. Thanks cheers.

  10. jrjuniorsp
    May 15th, 2008 at 12:27
    #10

    Gamesam,

    Try to export only the .EAR file.
    Right click on “TestApplication” and go to export.. Export it as EAR file. When you do that, both EJB and WEB modules are going to be exported as well.

    Build only the .EAR file.

    TIP: If you are using Eclipse Europa, you can run your application directly from the Eclipse. Right click on Web project and go to Run as -> Run on Server.

  11. Santiago Panchi
    May 15th, 2008 at 21:52
    #11

    Thank’s a lot. The tutorial is very good

  12. Jams
    May 16th, 2008 at 16:42
    #12

    This tutorial is really good. But I’m facing a problem while running the stand-alone application. I’m getting the below error. I have properly set the classpath also (with the couple of jars mentioned). Appreciate ur help in this.

    Exception in thread “main” javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory ]
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.(Unknown Source)
    at lesson.client.TestClient.main(TestClient.java:15)
    Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
    … 5 more

  13. jrjuniorsp
    May 16th, 2008 at 17:51
    #13

    Hi Jams,

    It’s weird because I hadn’t this problem before. It seems your application requires the JPN lib.
    Looking for this problem in google I found this topic: http://forum.java.sun.com/thread.jspa?threadID=561402&messageID=2762420
    I think it can help you.

  14. Jams
    May 17th, 2008 at 03:49
    #14

    Hi,
    Thanks for you reply and solution approach.

    I tried including jnp-client.jar in the classpath, but still I’m getting the error.

    org.jnp.interfaces.NamingContextFactory seems to be there in jbossall-client.jar itself, but I’m wondering why this happens.

    Any Idea???

  15. jrjuniorsp
    May 17th, 2008 at 16:53
    #15

    Hi Jams.
    Which JBoss AS version are you using? Not sure why it is happening, but try to get the latest JBoss AS version. (I’m using version 4.2.2 GA).

  16. Jams
    May 18th, 2008 at 16:11
    #16

    Hi,
    I’m using jboss-4.2.0.GA and Eclipse Europa 3.3.1 (WTP).

    Thanks for your help, I will try with 4.2.2.

  17. May 26th, 2008 at 09:18
    #17

    hi friends, please let me know if somebody have an idea to create a client jar file in ejb3. like in ejb2 we can specify in the ejb-jar.xml file and the weblogic server creates the corrosponding client jar file. but im not getting the idea how we can create the client jar file in ejb3 without using the deployment descritptors.
    thanks

  18. May 28th, 2008 at 16:31
    #18

    Hi, Thanks for a nice tutorial!

  19. Rolf
    June 1st, 2008 at 21:39
    #19

    Hey,

    I have the same problem as Jams, and my classpath includes all the Jboss libraries.
    That is the TestApplicationEJB and the TestApplicationWeb.
    Does anyone has any more ideas?

  20. joerg
    June 3rd, 2008 at 09:03
    #20

    Hello,

    thanks for this very useful tutorial.

    unfortunately i have a problem, when deploying the project to jboss:

    org.jboss.deployment.DeploymentException: No META-INF/application.xml found

    did i forget to create automatically a file on one point? i’m also using jboss 4.2.2 and eclipse wtp

    thx in advance for help

  21. jrjuniorsp
    June 3rd, 2008 at 11:29
    #21

    Make sure your application.xml file lives in WEB-INF/classes/META-INF/application.xml.

    A tip: In eclipse IDE, create a META-INF directory inside the “src” directory. Thus, eclipse automatically will deploy this directory, as well as the application.xml file, to WEB-INF/classes

  22. Charlie
    June 3rd, 2008 at 21:19
    #22

    In response to Rolf and Jams getting the NamingContextFactory class not found exception, I had the same problem until I found that my jndi.properties file (copy/paste from the tutorial!) had a few blank spaces at the end of each line. When I removed the whitespace, the sample code worked!

  23. joerg
    June 4th, 2008 at 12:57
    #23

    i have no application.xml and no idea how to create it… however i found no point in the tutorial where such a file is created.

  24. jrjuniorsp
    June 4th, 2008 at 13:02
    #24

    You’re right.. You’re following the tutorial, you do not need the application.xml file. It is used when you are going to use JPA as well.
    I have no idea why JBoss is complaining about this file. But anyway, try to create it (look for an example in google) and try to re-deploy your application.

  25. anil
    June 9th, 2008 at 10:05
    #25

    Its an excellent document for larner
    Thanks a lot to creator

  26. rupinder randhawa
    June 13th, 2008 at 13:00
    #26

    hi,
    i had been trying to run my ejb program in myeclipse for one weak. but i couldn’t get success. i was getting jndi problems. but when i followed ur guide lines, i got success. thanks very much for this beautiful information

  27. Sambi
    June 16th, 2008 at 13:30
    #27

    Hi,

    I have created my first EJB with this simple and precise example. Really good one to start EJB for beginners.

  28. Sambi
    June 16th, 2008 at 13:38
    #28

    Hi,

    When i try to execute the EJB standalone client appllication, it couldn’t find Class “NamingContextFactory” class specified in Properties file. Then I defined “java.naming.factory.url.pkgs” first and “java.naming.factory.initial” next. It started working.
    I couldn’t figure out why it couldn’t work intially.

  29. Marcelo
    June 19th, 2008 at 19:40
    #29

    Jr,

    Uma Excelente Matéria, diria até, Espetacular !!!
    Um Tutorial simples e eficiente e enxuto – só tem o que precisa.
    Parabéns !!!

  30. Ritesh Tendulkar
    June 20th, 2008 at 08:32
    #30

    Great tutorial for beginners. Thanks for this.

    I have one suggestion.

    When you create your EJB project, select option to create an EJB client project. Then create all your client interfaces in this client project. The ejb module and the web module then should be dependent on this client module.

    This way if you ever have to separate EJB module and the web module into different deployment units, you will not have to include your bean classes in the web module.

  31. Mariano
    June 27th, 2008 at 23:37
    #31

    Hi,
    i’m facing a problem during the lookup, i get the following error “TestApplication not bound”

    This is the stack trace

    2008-06-27 20:27:28,734 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/E:/jboss-4.2.2.GA/server/default/deploy/TestApplication.ear
    2008-06-27 20:27:28,734 DEBUG [org.jboss.deployment.scanner.URLDeploymentScanner] Watch URL for: file:/E:/jboss-4.2.2.GA/server/default/deploy/TestApplication.ear -> file:/E:/jboss-4.2.2.GA/server/default/deploy/TestApplication.ear
    2008-06-27 20:27:39,625 ERROR [STDERR] javax.naming.NameNotFoundException: TestApplication not bound
    2008-06-27 20:27:39,625 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    2008-06-27 20:27:39,625 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    2008-06-27 20:27:39,625 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    2008-06-27 20:27:39,625 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
    2008-06-27 20:27:39,625 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
    2008-06-27 20:27:39,625 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    2008-06-27 20:27:39,625 ERROR [STDERR] at javax.naming.InitialContext.lookup(Unknown Source)

    Any idea? i am a newbie on this, thanks for the tutorial

  32. Mariano
    June 28th, 2008 at 00:31
    #32

    Solved, it was a copy and paste error

    excellent tutorial

  33. Hima
    July 3rd, 2008 at 08:34
    #33

    Hi,

    did my first EJB example.very helpfull.good to start with

    thanks
    Hima

  34. Catalina
    July 3rd, 2008 at 15:51
    #34

    Hi,

    Thanks for this excellent titorial!!! Finally I was able to run an EJB project.
    Now I’m looking for an example on writting Session Bean Web Services. I think it´s not as easy as writtng @WebService on my HelloBean. Do you have a tutorial on this? Any idea on where to find this out?

    Thanks a lot!!

    Catalina

  35. Joe
    July 12th, 2008 at 21:32
    #35

    Hi,

    Thanks a lot for a very helpful and easy to follow tutorial. I will recommend it to anyone who wants to start out with EJBs.

    Cheers,
    Joe

  36. Siddiq
    July 17th, 2008 at 16:32
    #36

    Hi

    Thanks for the gr8 EJB3 example.
    Great job.

  37. Qing Zhang
    July 21st, 2008 at 20:50
    #37

    Excellent tutorial! I follow it without any problem. Thanks, it is great!

  38. Dhananjay
    July 23rd, 2008 at 16:31
    #38

    Hay I successfully run the web application. But I got error in stand-alone application. I follow each steps exactly which you show. The errors are here.
    I am using jboss 5.0 and eclipse 3.3.2

    Exception in thread “main” javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory ]
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.(InitialContext.java:197)
    at lesson.client.TestClient.main(TestClient.java:15)
    Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
    … 4 more

  39. jrjuniorsp
    July 23rd, 2008 at 17:03
    #39

    Hi Dhananjay,

    Thanks for your feedback. I’m glad the article was useful for you. Well, about your problem, it seems your stand-alone application missed any JAR file.
    I didn’t tested the JBoss 5.x, hence I have no idea which JARs file you must add to your classpath.

    If you have any luck in your testing, please let me know and keep the tip posted :)

  40. Bimal
    August 5th, 2008 at 08:57
    #40

    Hi jairrillo,
    Thanks for this article..which is very helpful indeed.
    I successfully deployed as done according to this article..
    I have a problem in accessing EJB 3.0 from portlet
    Do you have any solution..

    Please send me some solution

  41. Vidya
    August 6th, 2008 at 00:40
    #41

    Hi,

    The tutorial is a good starter. I executed the example you had shown above. The standalone appln is working perfectly but the Web module is giving the following exception.

    java.lang.ClassCastException: $Proxy76 cannot be cast to com.test.ejb.session.TestEJB
    at com.test.servlets.InsertDataServlet.doForward(InsertDataServlet.java:59)
    at com.test.servlets.InsertDataServlet.doGet(InsertDataServlet.java:39)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Unknown Source)

    I am using JBoss 4.2.3 and EJB 3.0 with Eclipse 3.4
    I tried redeploying the application. When the same code is working in standalone appln why is it not working in the webmodule. Also, I couldn’t find any help in this regard in google.
    Any idea about this?!
    Thanks,
    Vidya

  42. Vidya
    August 6th, 2008 at 06:19
    #42

    Hi,

    My web module is working when I provide the same jndi.properties details while instantiating the Initial Context in my Servlet. Do anybody have explanation for this because I did not see any properties initialization in the above example ?

    Thanks,
    Vidya

  43. Rich
    August 7th, 2008 at 17:54
    #43

    Great article, thanks for putting this together. I think I just found an explanation for why you (or I) were not able to inject the EJB into the servlet using the @EJB annotation. Sounds like something that isn’t yet implemented in JBoss 4.2.2:http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Getting_Started_Guide/beta422/html/EJB3_Support.html

  44. Josh
    August 20th, 2008 at 14:15
    #44

    Great tutorial, thank you very much for taking the time on this. I do have one question I hope you can help me with. I tried running the web client (right click on TestApplicationWeb, select Run As -> Run on Server) and everything seems to start up fine, however when it tries to display the jsp page I get the message “The requested resource (/TestApplicationWeb/) is not available.” Any thoughts?

  45. jrjuniorsp
    August 20th, 2008 at 14:31
    #45

    Hi Josh,
    Thanks for your feedback.
    About your error, there should be anything wrong with your webclient. the error happens because the project is not correct. Try to remove it and re-create it again. Hopefully everything will work for you.

  46. Josh
    August 20th, 2008 at 14:37
    #46

    Wow! Thanks for the super quick reply. I managed to solve this by recreating it. So I obviously had something screwy. :-) Anyway, thanks again for the great tutorial and for responding so quickly.
    Thanks again,
    Josh

  47. Marjan
    August 21st, 2008 at 07:34
    #47

    Try that within ganymede. It does not work. It is simply ridiculous that two successive versions of eclipse can be so distinctive that I cannot follow your path. Tutorial itself is well-written though. My compliments.
    But it only made me stronger in my opinion: java is immature. When it becomes EVOLUTIONARY instead of being REVOLUTIONARY, maybe I will consider using it. After it starts to be more stable, faster, and less resource-demanding. Till then it is merly a sandbox to me.
    Regards,
    M

  48. Marjan
    August 21st, 2008 at 10:40
    #48

    I prolly should mention that I use 64bit eclypse. After substantial modifications (adding servlet did not produce servlet class file among other things) I was able to succesfully run this example. Thank you for this post, has been most helpful!
    Regards,
    M

  49. Ajimon
    September 3rd, 2008 at 10:31
    #49

    Hi Junior,

    Excellent tutorial

    Ajimon

  50. Ajimon
    September 3rd, 2008 at 10:49
    #50

    Can i use Remote and local annotation pointing a one interface instead of two for Remote and local invocation ? .

    for eg.

    @Stateless
    @Remote(HelloWorld.class)
    @Local(HelloWorld.class)
    public class HelloWorldBean implements HelloWorld

    Thanks

  51. jrjuniorsp
    September 3rd, 2008 at 11:49
    #51

    Hi Ajimon,
    Yes, you can

    Regards, Jair Rillo Junior

  52. Eric K
    September 9th, 2008 at 21:32
    #52

    Hello,

    Great tutorial! I’ve followed your directions and I’m receiving the following error when I run the TestApplicationWeb:

    The requested resource (/TestApplicationWeb/) is not available.

    Any help would be greatly appreciated!

    Eric

  53. jrjuniorsp
    September 9th, 2008 at 22:15
    #53

    Hey Eric,

    Your Web module has a problem. You should get an error message when the server is loading (check it out). If the error isn’t clear, try to delete and re-create the WebModule. Hopefully you will get the Application running well.

  54. Eric K
    September 10th, 2008 at 14:19
    #54

    Thanks Jrjuniorsp, I’ll give it a go and let you know. Thanks for the quick response.

    Eric

  55. Eric K
    September 10th, 2008 at 17:09
    #55

    My application.xml was missing a tag. I added the TestApplicationWeb tag to my application.xml which cleared that issue up but I’m now getting the following error which seems to be jndi related:

    TestApplication not bound

    Thoughts?

    Eric

  56. Jair Rillo Junior
    September 10th, 2008 at 17:45
    #56

    It seems the EAR app wasn’t loaded properly. Again, try to re-create all steps and see what will happen. There should be anything missing in your code/configuration

  57. Eric K
    September 10th, 2008 at 18:05
    #57

    Will do, thanks!

  58. Eric K
    September 10th, 2008 at 20:08
    #58

    I redid all the steps and now I’m getting the following error:

    Could not initialise deployment: file: blah blah TestApplication.ear

    My ear file (TestApplication.ear) contains the following items:

    0 Wed Sep 10 15:42:52 EDT 2008 META-INF/
    95 Wed Sep 10 15:42:50 EDT 2008 META-INF/MANIFEST.MF
    581 Wed Sep 10 15:11:00 EDT 2008 META-INF/application.xml
    1576 Wed Sep 10 15:42:50 EDT 2008 TestApplicationEJB.jar
    4232 Wed Sep 10 15:42:50 EDT 2008 TestApplicationWeb.war

    Any help would be greatly appreciated!

    Eric

  59. Eric K
    September 10th, 2008 at 21:20
    #59

    Sorry, still getting the TestApplication not bound message?

  60. Jair Rillo Junior
    September 10th, 2008 at 21:28
    #60

    Hi Eric,

    I’m sorry, but I have no idea what’s going on with your project.

  61. Eric K
    September 10th, 2008 at 21:35
    #61

    It’s def to do with the jndi..

    HelloWorld hello = (HelloWorld) ctx.lookup(“TestApplication/HelloWorldBean/remote”);

  62. Eric K
    September 10th, 2008 at 21:35
    #62

    Okay, I’ll get it and let you know.

    Thanks, Eric

  63. Gene
    September 15th, 2008 at 16:15
    #63

    Hi
    I used this tutorial as a guide for my own example and got the same problem as reported in (41):

    java.lang.ClassCastException: $Proxy92 cannot be cast to com.sun.tutorial.javaee.ejb.Converter
    at com.symagi.managers.UserManager.loginUser(UserManager.java:419)
    at com.symagi.managers.UserManager.performTask(UserManager.java:126)
    at com.symagi.servlets.ControllerServlet.performTask(ControllerServlet.java:187)
    at com.symagi.servlets.ControllerServlet.doPost(ControllerServlet.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)

    I’m using Eclipse 3.4 Ganimede and JBoss 4.2.3
    I checked the JNDI name and everything else – seems to be OK.

    Also – maybe someone knows – I can’t get JBoss running in IDE – only standalone (in IDE it complains about java.annotation.Resource and other annotation-related things (not existing in my apps, when started standalone – runs fine).

  64. che
    December 5th, 2008 at 20:11
    #64

    Thanks a lot, you are a great person, it helps me a lot.

  65. Jonatha
    February 10th, 2009 at 14:07
    #65

    Acredito que possa deixa um comentário em português por voce ser brasileiro.

    Eu parei nesse passo:
    Now it is time to create the Servlet component. Right mouse click on TestApplicationWeb -> New -> Servlet. Put the name TestServlet and choose a package (if you want).

    Não consigo contruir uma Servlet não habilita pra enxergar os projetos ai não me permit a construção da classe.

    Alguma sugestão?

  66. Nasir
    February 11th, 2009 at 14:21
    #66

    HelloWorld hello = (HelloWorld) ctx.lookup(”TestApplication/HelloWorldBean/remote”);

    The lookup method does not work…………please try

    HelloWorld hello = (HelloWorld) ctx.lookup(”HelloWorldBean/remote”);……….

    …it will definitely work…

  67. February 14th, 2009 at 07:47
    #67

    Nasir,

    Thanks for replying. I think the lookup depends on which JBoss version you’re using. When I wrote thist post, I had to lookup through (TestApplication/HelloWorldBean/remote). I’ll try it again with the latest JBoss version, but anyway, thanks for replying :)

  68. February 14th, 2009 at 07:49
    #68

    Jonatha,

    Você clicou com o botão direito do mouse em cima do projeto TestApplicationWeb? (ele é seu projeto WEB, você não vai precisar mais selecionar nenhum outro). Na tela que abrir, você deve selecionar apenas o nome do Servlet (no caso TestServlet) e o pacote. Espero que funcione dessa vez :)

  69. Jonatha
    February 17th, 2009 at 10:36
    #69

    Jair, bom dia!!!

    Realmente vou passo a passo e me parece que alguns passos num estam tão condizentes!!!

    teria como mandar um .zip desse projetos ai para meu email para eu testar?

    jonatha.chaves@gmail.com

    Agradeço desde já a atenção!

  70. February 17th, 2009 at 13:52
    #70

    Eu não tenho mais esse projeto. Tenha certeza que você está usando a mesma versão descrita no artigo (no caso o Eclipse Europa e não o Ganymede, mais recente). Porém, se você não conseguir seguir passo a passo, você pode criar (por exemplo o Servlet) da sua maneira e depois só copiar o código fonte.

  71. February 23rd, 2009 at 05:20
    #71

    nice articles

  72. Anthony Delgado
    February 25th, 2009 at 18:40
    #72

    Muchas, Muchas Gracias mi Amigo, desde Colombia

    many thank you very much my friend, from Colombia

  73. Kanth
    May 27th, 2009 at 17:19
    #73

    The best starter’s tutorial I found on net for EJB3 using eclipse and JBoss. Great Job. Thanks for posting this.

    P.S Tutorial didnt seem to work for the first time, gave some errors. Tried re-creating after deleting all the files completely, now worked like a charm :)

  74. Hoang Phuong Thuc
    June 12th, 2009 at 03:41
    #74

    Hi,
    When I run project TestApplicationWeb by http://localhost:8080/TestApplicationWeb/index.jsp or http://localhost:8080/TestApplicationWeb.

    I have error message:The requested resource (/TestApplicationWeb/index.jsp) is not available.
    or The requested resource (/TestApplicationWeb/) is not available

    I use Jboss 4.0.5 and jdk 1.5 and IDE is Jbuilder 2008.

    Can you help me, thank very much.

    ThucHP

  75. Hoang Phuong Thuc
    June 12th, 2009 at 04:06
    #75

    Hi,
    I have run my Project, because I didnt run as Application before so I have error. But I dont understand why I have to run as Application before run as Server Jboss and have to create project .ear to include EJB, Web into.
    Can you guidle for me to build a project EJB3 and call EJB3 by Web project, I spent more time but not success.
    Thank for your example, it is best.
    Soory because my english not well.

    BestGrad.
    ThucHP

  76. Hoang Phuong Thuc
    June 14th, 2009 at 23:59
    #76

    Hi Junior,
    Thanks a lot for a very helpful and easy to follow tutorial I was able successful, but now I tried deploy only TestApplicationEJB on JBoss 4.0.5 and deploy TestApplicationWeb on Tomcat 6.0 and not use TestApplication.Ear. I have add classPath TestApplicationEJB.jar into TestApplicationWeb
    I lookup EJB by :

    InitialContext ctx=null;
    try {
    ctx = new InitialContext();
    } catch (NamingException ex) {
    System.out.println(“Error Context!”);
    ex.printStackTrace();
    }

    try{
    HelloWorld hello = (HelloWorld) ctx.lookup(“HelloWorldBean/remote”);
    System.out.println(hello.getMessage());
    } catch (NamingException e) {
    System.out.println(“Error lookup”);
    e.printStackTrace();
    }
    When I run index.jsp and goto Servlet File on Server Tomcat I received Error Message at function lookup :
    SEVERE: Allocate exception for servlet TestServlet
    java.lang.NoClassDefFoundError: lesson/stateless/HelloWorld
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getConstructor0(Class.java:2671)
    at java.lang.Class.newInstance0(Class.java:321)
    at java.lang.Class.newInstance(Class.java:303)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1104)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
    at rg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:595)

    I couldn’t find any help in this regard in google.
    Any idea about this?!

    Thanks, ThucHP

  77. Alejandro
    July 23rd, 2009 at 19:11
    #77

    Hi.

    I’m using Eclipse 3.5 galileo and Jboss jboss-5.1.0.GA, and this example is working fine.

    Thanks

  78. August 15th, 2009 at 01:36
    #78

    Jair, parabéns pelo tutorial.
    Segui passo a passo e tudo funcionou ok.
    Estou usando jboss-5.1.0.GA.
    Quando fui ver as bibliotecas dentro da pasta client para a aplicação client stand alone, descobri que a biblioteca jboss-ejb3-client.jar não existe nessa versão.
    Sabe se foi substituida por outra?
    Um abraço.

  79. Hannis
    August 15th, 2009 at 03:37
    #79

    Hello,

    Just wanted to thank you for this tutorial. It’s the first one that actually worked for me – and I tried many! (I’m using Eclipse Galileo and Jboss 5.1.0, too.)

  80. August 15th, 2009 at 22:59
    #80

    @Hannis, thanks for your reply
    @Luis, eu sinceramente não sei, na verdade eu nunca usei a versão 5.x, só as versão 4.x. Eu particularmente estou gostando mais do glassfish do que JBoss.
    Flw

  81. September 17th, 2009 at 23:52
    #81

    very good tutorial. thanks…

  82. viswanath
    November 20th, 2009 at 03:03
    #82

    Hiiii Jair, Thank u very much.. it is a nice example. Even a beginner like me was able follow step by step procedure!
    but small error is appearing while running!

    11:29:30,898 ERROR [STDERR] javax.naming.NameNotFoundException: Remote not bound
    11:29:30,914 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    11:29:30,914 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    11:29:30,914 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    11:29:30,914 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
    11:29:30,914 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
    11:29:30,914 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
    11:29:30,914 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    11:29:30,914 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
    11:29:30,914 ERROR [STDERR] at javax.naming.InitialContext.lookup(Unknown Source)
    11:29:30,914 ERROR [STDERR] at TestServlet.doGet(TestServlet.java:19)
    11:29:30,914 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    11:29:30,914 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    11:29:30,914 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    11:29:30,914 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    11:29:30,914 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    11:29:30,914 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    11:29:30,914 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    11:29:30,914 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    11:29:30,914 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
    11:29:30,914 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    11:29:30,914 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)

  83. Nissi
    November 22nd, 2009 at 05:52
    #83

    Thanks Jair Rillo Junior, after alot of disappointments from other web tutorials on building EJB.i finaly got one that was good.Even though i made a couple of errors in the projects but the end result was GOOD.

  84. December 29th, 2009 at 04:09
    #84

    hi
    An Exellent Tut. It Helped me to create First EJB3.0 application. Thanks a lot.

  85. January 13th, 2010 at 18:22
    #85

    Hi!
    BIG thanks for that!
    It’s really helped me too. Just like “Devika.N” – your great tutorial “for dummies” ;-) helped me with my first steps in EJB3!

  86. Ashish
    February 7th, 2010 at 04:10
    #86

    hi buddy.. thanks a lot for this tutorial.. :)
    Got started with EJB3 in 5 minutes!!

  87. Ramesh
    April 5th, 2010 at 09:55
    #87

    after a 8 hrs journey .. i finally got the output…

  88. May 4th, 2010 at 08:31
    #88

    This one is really help to learn and deploy the EJB program using JBoss

  89. Avinash
    June 25th, 2010 at 21:41
    #89

    Thanks a ton for this. Went through at least 10 tutorials but dint find any of them as useful as this. The stateful one was helpful too. Keep up the good work.

    Cheers.

  90. Gideon
    June 30th, 2010 at 02:28
    #90

    hai
    i am tring to eply ur application as it is but i got runtime error
    Jboss5.1 is showing this error

    java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.newInstance(ReflectionUtils.java:153)
    at org.jboss.reflect.plugins.introspection.ReflectConstructorInfoImpl.newInstance(ReflectConstructorInfoImpl.java:106)
    at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:80)
    at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.createTarget(AOPConstructorJoinpoint.java:282)
    at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.dispatch(AOPConstructorJoinpoint.java:103)
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
    at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
    at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:66)
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
    at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.deploy(BasicKernelDeployer.java:76)
    at org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:91)
    at org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:161)
    at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:138)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:450)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Unknown Source)
    Failed to boot JBoss:
    java.lang.IllegalStateException: Incompletely deployed:

    DEPLOYMENTS IN ERROR:
    Deployment “AttachmentStore” is in error due to: java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]

    DEPLOYMENTS MISSING DEPENDENCIES:
    Deployment “ProfileServicePersistenceDeployer” is missing the following dependencies:
    Dependency “AttachmentStore” (should be in state “Installed”, but is actually in state “**ERROR**”)
    Deployment “ProfileServiceDeployer” is missing the following dependencies:
    Dependency “AttachmentStore” (should be in state “Installed”, but is actually in state “**ERROR**”)
    Deployment “ProfileService” is missing the following dependencies:
    Dependency “jboss.kernel:service=KernelController” (should be in state “Installed”, but is actually in state “**ERROR**”)
    Dependency “ProfileServiceDeployer” (should be in state “Installed”, but is actually in state “Instantiated”)
    Deployment “ProfileServiceBootstrap” is missing the following dependencies:
    Dependency “jboss.kernel:service=Kernel” (should be in state “Installed”, but is actually in state “**ERROR**”)
    Dependency “ProfileService” (should be in state “Installed”, but is actually in state “Instantiated”)

    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
    at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:142)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:450)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Unknown Source)
    10:49:01,089 INFO [ServerImpl] Runtime shutdown hook called, forceHalt: true
    10:49:01,089 INFO [ServerImpl] Shutdown complete
    Shutdown complete
    Halting VM

    pz let me know how to deply it correctly where’s the mistake is.
    thanking u
    Gideon.

  91. August 9th, 2010 at 13:18
    #91

    Só para deixar você saber, @EJB somente funciona em versoes 5.1, do JBoss, em diante. Não funciona em versões anteriores a esta.

    Regards,
    Luzia Maria

  92. Marcos
    September 29th, 2010 at 15:58
    #92

    Opa Jair… gostei muito do tutorial… é uma pena ter só um…

    Gostaria de colocar em meu blog em portugues, lógico, referenciado aqui… tem algum problema??
    De qq forma, muito obrigado.
    Abraços

  93. October 13th, 2010 at 12:34
    #93

    Manda bala Marcos, lembrando que esse cara é antigo, como a Luzia disse acima, nas versões nova do JBoss a anotação @EJB já funciona

  94. siva
    March 17th, 2011 at 09:38
    #94

    ya, this tutorial is very nice. Thank u very much.

  95. yogi
    April 12th, 2011 at 10:34
    #95

    Hi!
    I got error when i use this exaple in eclipse helios using glassfish server.
    i successfully deploy it. and i got jsp page running. but when i click on”Click here to call the EJB component” text, i got error like this.
    HTTP Status 404 –

    ——————————————————————————–

    type Status report

    message

    descriptionThe requested resource () is not available.

    ——————————————————————————–

    Oracle GlassFish server 3.0.1

  96. Unnikrishnan
    April 15th, 2011 at 13:23
    #96

    Hi
    When i tried for TestApplicationWeb -> Run As -> Run on Server , i got the following error.”HTTP Status 404 – /TestApplicationWeb/

    Could you please help me ? Log below.

    21:49:51,078 INFO [Server] Starting JBoss (MX MicroKernel)…
    21:49:51,078 INFO [Server] Release ID: JBoss [Trinity] 4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)
    21:49:51,078 INFO [Server] Home Dir: C:\Documents and Settings\Krishnan\Desktop\downloads2\jboss-4.2.0.GA\jboss-4.2.0.GA
    21:49:51,078 INFO [Server] Home URL: file:/C:/Documents and Settings/Krishnan/Desktop/downloads2/jboss-4.2.0.GA/jboss-4.2.0.GA/
    21:49:51,078 INFO [Server] Patch URL: null
    21:49:51,078 INFO [Server] Server Name: default
    21:49:51,078 INFO [Server] Server Home Dir: C:\Documents and Settings\Krishnan\Desktop\downloads2\jboss-4.2.0.GA\jboss-4.2.0.GA\server\default
    21:49:51,078 INFO [Server] Server Home URL: file:/C:/Documents and Settings/Krishnan/Desktop/downloads2/jboss-4.2.0.GA/jboss-4.2.0.GA/server/default/
    21:49:51,078 INFO [Server] Server Log Dir: C:\Documents and Settings\Krishnan\Desktop\downloads2\jboss-4.2.0.GA\jboss-4.2.0.GA\server\default\log
    21:49:51,078 INFO [Server] Server Temp Dir: C:\Documents and Settings\Krishnan\Desktop\downloads2\jboss-4.2.0.GA\jboss-4.2.0.GA\server\default\tmp
    21:49:51,078 INFO [Server] Root Deployment Filename: jboss-service.xml
    21:49:51,234 INFO [ServerInfo] Java version: 1.6.0_05,Sun Microsystems Inc.
    21:49:51,234 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 10.0-b19,Sun Microsystems Inc.
    21:49:51,234 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
    21:49:51,687 INFO [Server] Core system initialized
    21:49:52,859 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
    21:49:52,859 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
    21:49:53,156 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) – JBoss Inc.
    21:49:53,156 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
    21:49:53,281 INFO [TransactionManagerService] Starting recovery manager
    21:49:53,328 INFO [TransactionManagerService] Recovery manager started
    21:49:53,328 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
    21:49:54,890 INFO [EJB3Deployer] Starting java:comp multiplexer
    21:49:55,890 INFO [ServiceEndpointManager] jbossws-1.2.1.GA (build=200704151756)
    21:49:56,859 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.6.0_05\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.6.0_05/bin/client;C:/Program Files/Java/jre1.6.0_05/bin;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\QuickTime\QTSystem\;C:\WINDOWS\system32\Wbem;C:\Program Files\IVT Corporation\BlueSoleil\Mobile
    21:49:56,906 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
    21:49:56,906 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
    21:49:56,906 INFO [Catalina] Initialization processed in 161 ms
    21:49:56,906 INFO [StandardService] Starting service jboss.web
    21:49:56,906 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.0.GA
    21:49:56,953 INFO [Catalina] Server startup in 39 ms
    21:49:57,015 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=…/deploy/jboss-web.deployer/ROOT.war/
    21:49:57,484 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=…/deploy/http-invoker.sar/invoker.war/
    21:49:57,609 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=…/tmp/deploy/tmp47813jbossws-context-exp.war/
    21:49:57,734 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=…/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
    21:49:58,359 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=…/deploy/management/console-mgr.sar/web-console.war/
    21:49:58,687 INFO [MailService] Mail Service bound to java:/Mail
    21:49:58,812 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-ha-local-jdbc.rar
    21:49:58,843 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-ha-xa-jdbc.rar
    21:49:58,859 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-local-jdbc.rar
    21:49:58,890 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jboss-xa-jdbc.rar
    21:49:58,937 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/jms/jms-ra.rar
    21:49:59,015 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in …/deploy/quartz-ra.rar
    21:49:59,031 INFO [QuartzResourceAdapter] start quartz!!!
    21:49:59,062 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
    21:49:59,093 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
    21:49:59,093 INFO [RAMJobStore] RAMJobStore initialized.
    21:49:59,093 INFO [StdSchedulerFactory] Quartz scheduler ‘DefaultQuartzScheduler’ initialized from default resource file in Quartz package: ‘quartz.properties’
    21:49:59,093 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
    21:49:59,093 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
    21:49:59,781 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=DataSourceBinding,name=DefaultDS’ to JNDI name ‘java:DefaultDS’
    21:49:59,953 INFO [A] Bound to JNDI name: queue/A
    21:49:59,953 INFO [B] Bound to JNDI name: queue/B
    21:49:59,953 INFO [C] Bound to JNDI name: queue/C
    21:49:59,953 INFO [D] Bound to JNDI name: queue/D
    21:49:59,953 INFO [ex] Bound to JNDI name: queue/ex
    21:49:59,968 INFO [testTopic] Bound to JNDI name: topic/testTopic
    21:49:59,968 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
    21:49:59,984 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
    21:49:59,984 INFO [testQueue] Bound to JNDI name: queue/testQueue
    21:50:00,015 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
    21:50:00,031 INFO [DLQ] Bound to JNDI name: queue/DLQ
    21:50:00,109 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=ConnectionFactoryBinding,name=JmsXA’ to JNDI name ‘java:JmsXA’
    21:50:00,125 INFO [TomcatDeployer] deploy, ctxPath=/TestApp, warUrl=…/tmp/deploy/tmp47842TestApp-exp.war/
    21:50:00,203 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=…/deploy/jmx-console.war/
    21:50:00,296 INFO [EARDeployer] Init J2EE application: file:/C:/Documents and Settings/Krishnan/Desktop/downloads2/jboss-4.2.0.GA/jboss-4.2.0.GA/server/default/deploy/TestApplication.ear
    21:50:00,296 ERROR [MainDeployer] Could not initialise deployment: file:/C:/Documents and Settings/Krishnan/Desktop/downloads2/jboss-4.2.0.GA/jboss-4.2.0.GA/server/default/deploy/TestApplication.ear
    org.jboss.deployment.DeploymentException: No META-INF/application.xml found
    at org.jboss.deployment.EARDeployer.init(EARDeployer.java:146)
    at org.jboss.deployment.MainDeployer.init(MainDeployer.java:872)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:809)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy9.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceController.java:417)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy4.start(Unknown Source)
    at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy5.deploy(Unknown Source)
    at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
    at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
    at org.jboss.Main.boot(Main.java:200)
    at org.jboss.Main$1.run(Main.java:508)
    at java.lang.Thread.run(Unknown Source)
    21:50:00,296 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

    — Incompletely deployed packages —
    org.jboss.deployment.DeploymentInfo@29f8a4d7 { url=file:/C:/Documents and Settings/Krishnan/Desktop/downloads2/jboss-4.2.0.GA/jboss-4.2.0.GA/server/default/deploy/TestApplication.ear }
    deployer: org.jboss.deployment.EARDeployer@18baf36
    status: null
    state: FAILED
    watch: file:/C:/Documents and Settings/Krishnan/Desktop/downloads2/jboss-4.2.0.GA/jboss-4.2.0.GA/server/default/deploy/TestApplication.ear
    altDD: null
    lastDeployed: 1302884400296
    lastModified: 1302884400296
    mbeans:

    21:50:00,343 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
    21:50:00,375 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
    21:50:00,375 INFO [Server] JBoss (MX MicroKernel) [4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)] Started in 9s:297ms

    Thanks & Regards
    Unnikrishnan P

  97. sanjeev
    April 18th, 2011 at 13:40
    #97

    Excellent Tutorial ,

  98. genisof
    June 21st, 2011 at 20:36
    #98

    thanx man this is an excellent work :)

  99. raghu
    October 13th, 2011 at 13:48
    #99

    Hi,
    Jair Rillo Junior
    Thanks for the post.
    sir, i had problem while running the standalone prj.

    Exception in thread “main” java.io.FileNotFoundException: jndi.properties (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.(Unknown Source)
    at java.io.FileInputStream.(Unknown Source)
    at session.client.Clientside.main(Clientside.java:15)

    Iam using jboss 5 and eclipse galielo. can u plz tell me the solution

  100. Robinson
    October 18th, 2011 at 11:13
    #100

    Hi,Jair
    I see you used gloal JNDI for the HelloWorldBean lookup. But in practice we should use the ENC namespace. So what is the local name?
    “java:comp/env/ejb/local/HelloWorldBean” doesn’t work. So how can I use local jndi name?

    Thanks in advance

  101. Rosan Samuel
    November 11th, 2011 at 15:13
    #101

    Hi Friends,

    Could you help me to debug Resource Adapter in Jboss Application server with Eclipse Debug? please give your steps?

  102. Thankappan
    November 14th, 2011 at 06:39
    #102

    onnum manassilayilla…entokeyo ezhutivachirikunnu…vayichu vayichu talakarangi…eto bhrandante kandupiduttangal…matiyakikkoode mashe…vere valla paniyum nokkaruto???

  103. Tintumon
    November 14th, 2011 at 08:09
    #103

    very very fantastic,elastic,thermoplastic,gigantic,plastic tutorial….

  104. Greenhulk
    November 15th, 2011 at 10:05
    #104

    Thanks for this great tutorial! This is the first EJB Tutorial which actually worked (and I tried lots of others). There are some things I’d like to correct for the tutorial though:

    >right mouse click on TestApplicationWeb -> Properties. Go to J2EE Module Dependencies and mark the option TestApplicationEJB.jar.

    This won’t work anymore in Eclipse 3.6, since there is no “J2EE Module Dependencies” anymore. Instead go to “Deployment Assembly” and then choose “Add…”->Project->TestApplicationEJB where it will add the EJB Jar by itself.

    Deployment on JBOSS: please DON’T do “Rightclick->Run on Server”. This has messed up my JBoss setup. Instead Export the “TestApplication” as an EAR and Copy it into the deploy folder of JBoss (or directly export it to the deploy folder of JBoss). Works perfectly then.

    I worked with Eclipse 3.6 and JBoss 4.2.3

  105. Greenhulk
    November 15th, 2011 at 10:17
    #105

    Oh, and I want to add above: if you have messed up your server/deployment like me with “Run on Server” (causing Classcast Exceptions etc.), you must first remove all instances and folders from that first. One “TestApplication” folder is in the Eclipse workspace\.metadata\.plugins\org.jboss.ide.eclipse.as.core\ and one other folder somewhere in your JBoss folder. Remove both first, and then try again a clean/manual deploy :)

TOP