views:

31

answers:

1

Hi!

I'm working on a project which includes persistence library (JPA 1.2), EJB 3 and Web presentation layer (JSF). I develop application using Eclipse and application is published on Websphere Application Server Community Edition (Geronimo 2.1.4) through eclipse plugin (but the same thing happens if I publish manually). When publishing to server I get the following error:

java.lang.NoClassDefFoundError: Could not fully load class: manager.administration.vehicles.VehicleTypeAdminBean
 due to:manager/vehicles/VehicleType
 in classLoader: 
org.apache.geronimo.kernel.classloader.TemporaryClassLoader@18878c7
    at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:177)
    at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:146)...

In web.xml I have reference to EJB:

<ejb-local-ref>
    <ejb-ref-name>ejb/VehicleTypeAdmin</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local>manager.administration.vehicles.VehicleTypeAdmin</local>
    <ejb-link>VehicleTypeAdminBean</ejb-link>
</ejb-local-ref>

EJB project has a reference to persistence project, and Web project has references to both projects. I don't get any compilation errors, so I suppose classes and references are correct.

I don't know if it is app server problem, but I ran previously application on the same server using same configuration parameters.

Does anybody have a clue what might be the problem?

A: 

Looks almost like it couldn't find the class manager.vehicles.VehicleType when it was attempting to create/load the class manager.administration.vehicles.VehicleTypeAdminBean.

I've encountered similar problems before. When the class loader attempts to load the class it looks at the import statements (and other class usage declarations) and then attempts to load those classes and so on until it reaches the bottom of the chain (ie java.lang.Object). If it cannot find one class along the chain (in your case it looks like it cannot load VehicleType) then it will state that it cannot load the class at the top of the chain (in your case VehicleTypeAdminBean).

Is the VehicleType class in a different jar? If you have a web module and and EJB module do you have the jar containing the VehicleType class in the appropriate place(s). Sometimes with web projects you have to put the jars in the WebContent/WEB-INF/lib folder or it won't find them.

Are both of these projects deployed separately (ie. two ears? or one ear and one war?) or are they together (ie, one ear with jars and a war inside?). I'm assuming the second given you declared your EJB local?

The jars that you are dependent on also have to be declared in your MANIFEST.MF files in the projects that use it.

I'm kind of running on guesses since I do not know your project structure. Showing that would help quite a bit. But I'd still check on where VehicleType is located with regards to your EJB class. You might find it isn't where you think it is come packaging or runtime.

Chris Aldrich
Thank you for your reply.Yes, you are right, I was missing jar with VehicleType class in classpath. I referenced it, but in deployment it was omitted. When I added it to export in eclipse, it was added in classpath and no class loading error occured, so the problem was solved.
Vladimir