When doing this, I get a ClassNotFoundException for the interface class, even though the interface class is inside a JAR in the WAR's WEB-INF/lib directory. Here's the start of the stack trace:
If you have the bean interfaces in the .war/WEB-INF/lib/somejar.jar, then i would have expected this to work - atleast not throw a ClassNotFoundException. Can you post the output of:
jar -tf somejar.jar
where somejar.jar is the one which is placed in .war/WEB-INF/lib and contains the bean interfaces.
As for the details around JBoss classloading, see these wiki pages:
The .class file for the interface is present in the JAR. In addition, I added another line prior to my ctx.lookup() call that says:
And I get good output from that, which tells me that the interface class is being found in the classpath. So I guess I'm confused as to what the call in InitialNamingContext uses as its classpath?
If you have a sample application which easily reproduces this, then please create a JIRA here https://jira.jboss.org/jira/browse/EJBTHREE and attach the application to that JIRA. We'll take a look.
Sorry it took me a while to get back to this -- I have been out of town. OK, the short answer is, this isn't a problem anymore; the piece of info I neglected to provide, and which at the time didn't seem pertinent but in hindsight is very pertinent, is that this WAR I have been deploying is a Liferay portlet WAR, and I have been deploying it via Liferay, which is supposed to then deploy it to JBoss. Apparently something is going wonky in the Liferay deployment step. Just by accident, I deployed the WAR directly into JBoss (skipping Liferay), and then ran my test app -- and voila, my calls to the EJBs from the servlet in the WAR succeeded! So we are now trying to track down what could be getting messed up with the Liferay 5.2.x -> JBoss 6.0.0 M1 deployment. We can see that Liferay is significantly changing the web.xml descriptor, which might have something to do with it. We can also see that all of the files that are needed (including the JAR containing the interface classes) are deployed correctly. I don't see anything that specifically talks about a classpath in the modified web.xml file, but we're early in our investigations. I will report back if we find anything -- we can't be the only people trying to use Liferay 5.2.x with JBoss 6.0.0 M1...
If anyone else encounters this, here's the deal -- Liferay's "speed filters" (which minify and compress output) plays havoc somehow with the classpath, so the servlets in our portlet WAR (which made calls to EJBs) did not have the correct classpath. We haven't gone too in-depth to figure out how to really fix this so that the speed filters are still present, but to work around this, we just disabled the filters by adding the following line into the liferay-plugin-package.properties file:
Once the filters are disabled, everything works as expected.