0

I'm using JBoss 4.2.3, EJB2, XDoclet and have deployed one EAR with the EJBs in it, and other EARs with various websites in them.

When trying to access an EJB from one of the websites, I get NoClassDefFoundError. It seems that the lookup is successful. I can see, for example, that getContext().lookup(SecurityServiceRemoteHome.JNDI_NAME) returns something of class "$Proxy266". I also see in JBoss's JNDI View this binding:

remote (proxy: $Proxy266 implements interface com.icumed.ifactory.service.session.SecurityServiceRemoteHome,interface javax.ejb.Handle)

FYI, SecurityServiceRemoteHome.JNDI_NAME = "ejb/ifactory/SecurityService/remote"

Right after the lookup, I call this, which is where the error is thrown:

home = (SecurityServiceRemoteHome)PortableRemoteObject.narrow(obj,
    SecurityServiceRemoteHome.class);

I've heard that this might be unnecessary and I can just do a straight type conversion here, but I don't think that's the problem. From what I've read on the web so far, it seems like maybe the SecurityServiceRemoteHome cannot be fully loaded. Perhaps some ancillary classes are missing? I don't see any errors indicating this, though. What's the best way to go about debugging this?

Gary Kephart
  • 4,860
  • 5
  • 39
  • 52
  • Ok, *that* wasn't a problem. I added some debugging and I was able to log every single class definition for superclasses, interfaces, method return types and method parameters. So how can that first class def, SecurityServiceRemoteHome, be not found? – Gary Kephart Mar 08 '12 at 21:55
  • Ah, here's something that might help you help me. The extended message of the exception is: java.lang.ClassNotFoundException: No ClassLoaders found for: ...SecurityServiceRemoteHome – Gary Kephart Mar 08 '12 at 21:56
  • And SecurityServiceRemoteHome and every class it depends on seem to have the same class loader: org.jboss.mx.loading.UnifiedClassLoader3 – Gary Kephart Mar 08 '12 at 22:11
  • my solution could perhaps help you [Here][1] [1]: http://stackoverflow.com/questions/3461866/classloader-problem-with-ejb/18868643#18868643 – ilias Sep 18 '13 at 09:38

1 Answers1

0

After even more digging around, I found the answer. It has to do with the jboss-app.xml file and the loader-repository element. The background is that I previously had one complete EAR file with all the WARs and EJBs in it. I have decided to break them apart, and when I did so, I modified the jboss-app.xml files so that the archive name was different for each one. That was wrong. They must be the same between the EAR for the EJBs and the EARs for the WARs (Yes, I don't really need an EAR file if it's just a WAR...except on OC4J). Furthermore, I must have the loader-repository element present with an archive name. Leaving that out causes other problems.

Gary Kephart
  • 4,860
  • 5
  • 39
  • 52