Yesterday and today I dug into JBoss and tried the tutorial which is put up at JBoss site.
I downloaded
JBoss AS 4.0.3
JBoss IDE 1.5.0.M3
And all the tutorials.
Initally I tried downloading the JBoss Plugin but that did not work with my version of Eclipse. So I decided to download the IDE provided JBoss incluse of Eclipse etc.
The bundled one worked for me.
Following the tutorial was a breeze. However when I deployed the application the first page came out fine. When I tried to run the servlet it threw a Servlet Exception. Dug in a found that the Servlet Exception was being caused by a ClassCastException at
home = (FiboHome) PortableRemoteObject.narrow(ref, FiboHome.class);
Since I am new to JNDI I started poking around with the
Object ref = context.lookup(“java:/comp/env/ejb/Fibo”);
and the deployement discriptors.
Trying all permutations and combinations of one or the other. Then I got back to searching the net. I also lurked in IRC channels to get some hints. Thats when I hit the site.
http://www.jboss.org/?module=bb&op=viewtopic&t=59192
which lead me to sites
http://www.jbossgroup.com/index.html?module=bb&op=viewtopic&p=3887843
http://jira.jboss.com/jira/browse/JBAS-1775
http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration
http://jira.jboss.com/jira/browse/JBAS-1691
Finally like I mentioned in the forum
This is basically a classloading problem.
The new JBoss does not have a flat classloader like the old JBoss. So if you load a class in your EJB and you load a class in your servlet even though the bytecode is the same they are treated as diffrent classes.
So for the tutorial to work you should remove the FiboEJB-client.jar from your FiboWEB.war file. Your servlet will reference the class FiboHome from the FiboEJB.jar file.
Hopefully the maintainers will fill in this part in the tutorial.
Till the next blog……