facebook

EAR deploy problems with ClassNotFound re Hibernate

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #228903 Reply

    krimple
    Member

    Hello, I’m a newbie with MyEclipse, and so far have been quite impressed with the struts, ejb and hibernate features, not to mention the excellent integration with XDoclet.

    I’m trying to set up my application development framework for an upcoming team project. The project will be deployed as an enterprise archive, use a web application for UI, have one or more EJB projects, and some dependent java projects.

    The application will use third-party jars, and I assume at this point, hibernate. Velocity is in the mix as well.

    I’ve been quite successful with the basic steps of setting up the EAR project, web project and EJB project, and the beanshell servlet script that tests the access of the EJB from the web project runs swimmingly. I also tested hibernate within the web application, and due to the web class loader (placing the dependent jars in WEB-INF/lib) everything works great there.

    Where I’m having trouble is when I’ve added hibernate to the EJB project, and added a hibernate test method to the stateless session bean.

    The jars were included in the EJB project once I added hibernate support, and are used for build (once I added hibernate2.jar to my build class path). I’ve copied the jar files to the root of the EAR file, and modified by Class-Path entry of the EAR (and the EJB project, but that, I think, is ignored by J2EE) to the following:

    Manifest-Version: 1.0
    Class-Path: c3p0-0.8.4.5.jar,
    ..
    hibernate2.jar,
    ..
    xml-apis.jar
    Bundle-ClassPath: c3p0-0.8.4.5.jar,
    ..
    hibernate2.jar,
    xml-apis.jar

    I’m using BEA Weblogic, and the beanshell script gives me a

    <EJB Exception occurred during invocation from home: com.rimple.ejb.DemoFacade_4ora10_HomeImpl@fceb09 threw exception: java.lang.NoClassDefFoundError: net/sf/hibernate/cfg/Configuration
    java.lang.NoClassDefFoundError: net/sf/hibernate/cfg/Configuration
    at com.rimple.db.SessionFactory.<clinit>

    I checked the EAR file deployment, and the jars are there. The MANIFEST points directly to them. I’ve tried putting them in META-INF, referencing META-INF, and not, so I’ve tried all combinations I can think of.

    Is there something here I’m missing? I did a search of this forum, and the only feature people seem to be talking about is putting the class path in the MANIFEST.MF file.

    Any help in resolving this would be greatly appreciated, as I really want to use this tool for my development team. It sure beats Idea in terms of price, and gives me everything I think I need for my upcoming project.

    Details for configuration, etc:

    Windows XP
    Eclipse 3.0.2
    MyEclipse 3.8.4+QF2
    BEA Weblogic 8.1 sp4
    JDK 1.4.2_06 (sun)
    J2EE 1.3 project
    EJB 2.0 project

    Thanks,

    Ken Rimple

    #228909 Reply

    krimple
    Member

    For those of you who want to solve this problem, it would help to RTFM at BEA’s e-docs site. Here’s the URL, for those of you who are curious:

    1. Create an APP-INF directory in the EAR root
    2. Create a lib directory in the EAR/APP-INF directory
    3. Copy all of your utility jar files to APP-INF/lib
    4. Re-deploy

    I do remember now that this is how you do BEA deployment–forgive me, I was last using BEA’s workshop and since it did everything its’ own way, I thought that was only for BEA WLI stuff.

    Once I did that, it worked like a charm. BTW–you can remove the Class-Path entries.

    Details for the curious:

    http://e-docs.bea.com/wls/docs81/programming/classloading.html#1073478

    Quote:

    Packaging Shared Utility Classes

    WebLogic Server provides a location within an EAR file where you can store shared utility classes. Place utility JAR files in the APP-INF/lib directory and individual classes in the APP-INF/classes directory. (Do not place JAR files in the /classes directory or classes in the /lib directory.) These classes are loaded into the root classloader for the application.

    This feature obviates the need to place utility classes in the system classpath or place classes in an EJB JAR file (which depends on the standard WebLogic Server classloader hierarchy). Be aware that using this feature is subtly different from using the manifest Class-Path described in the following section. With this feature, class definitions are shared across the application. With manifest Class-Path, the classpath of the referencing module is simply extended, which means that separate copies of the classes exist for each module.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: EAR deploy problems with ClassNotFound re Hibernate

You must be logged in to post in the forum log in