• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

You’ve written your bean class, interfaces, and deployment descriptor. How do you package them for deployment to any EJB container? You need a standard format that bundles everything together.

Core Idea

The EJB-JAR file is a standard Java archive (.jar) containing all the classes (bean class, home/remote/local interfaces, helpers) plus the ejb-jar.xml deployment descriptor. This single file is what you deploy to the container—it’s vendor-neutral and portable.

How It Works

  1. Compile: javac converts .java.class for all your files
  2. Package: jar cvf MyBean.jar *.class ejb-jar.xml creates the archive
  3. Deploy: Copy JAR to container’s deployment folder or use vendor tools
  4. Container verifies: Checks the JAR structure and generates EJB Object/Home Object

Visual Explanation

EJbJar cluster_sources Source Files cluster_container Container Bean HelloBean.class JAR MyBean.jar (Standard Archive) Bean->JAR Home HelloHome.class Home->JAR Remote Hello.class Remote->JAR XML ejb-jar.xml XML->JAR Verified Verified & Generated JAR->Verified Deploy

Key Properties

  • Standard format: Any EJB container can read an EJB-JAR file
  • Contains: Classes + META-INF/ejb-jar.xml (deployment descriptor)
  • Optional: May include META-INF/webservices.xml or vendor-specific files
  • Vendor-neutral: Write once, deploy on any EJB container

Connections

Edge Cases & Gotchas

  • Missing ejb-jar.xml: Container rejects the JAR—deployment fails
  • Classpath issues: All dependencies must be in the JAR or server classpath
  • Vendor-specific files: Some containers need extra files in META-INF/ (e.g., weblogic-ejb-jar.xml)