• ↑↓ to navigate
  • ↵ to open
  • ⟶ to select
  • ⌘ ⌥ ↵ to open in a panel
  • ←→ to navigate
  • esc to dismiss
⌘ '
keyboard shortcuts

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

Semantic Network

graph semantic__EJB_JAR_File_ {
  layout=neato
  node [shape=ellipse fontname="Helvetica" fontsize=11 style=filled]
  THIS [label=""Ejb Jar File"" fillcolor="#ffd700" fontsize=13 style="filled,bold"]
  REL1 [label="Related Concept" fillcolor="#f0f0f0"]
  REL2 [label="Builds Into" fillcolor="#d4edda"]
  THIS -- REL1 [label="related"]
  THIS -- REL2 [label="builds into"]
}

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)