Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9158195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:11:30+00:00 2026-06-17T13:11:30+00:00

I have an MDB EJB, with static block inside it. I used the static

  • 0

I have an MDB EJB, with static block inside it. I used the static block to initialize some components only once at the first time the application runs (i.e at deployment). The MDB EJB is deployed on a separate sever (My_Server) other than the Admin_Server.

The problem is that the static block is called twice!

  • The first time: just after deploying the MDB EJB (tageted to the My_Server).
  • The second time: after the JMS queue (that the MDB is associated with) receives a message.

Also, I printed the server name and the pid, and they are same in both:

System.out.println("server name: " + System.getProperty("weblogic.Name"));
System.out.println("pid: " + ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);

I also noticed some weird behaviors. Basically, I attached a Shutdown Hook (from inside the static block) to send me email on shutdown of the application.

  • I got notified once I shutdown the My_Server.
  • I got notified also once I shutdown the Admin_Server.

How can I solve this issue?


Some extra info:

Weblogic version: 10.3.0
EJB version: 3.0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:11:31+00:00Added an answer on June 17, 2026 at 1:11 pm

    This only happens when you have multiple classloaders. I would not have static initializers in an EJB, rely on either EJB lifecycle hooks or export the initializer into an unmanaged class.

    EJB 3.1 added annotations like @Singleton and @Startup, but unfortunately in 3.0 you are stuck with provider-based solutions for these guarantees.

    Admin vs regular server behavior is quite common as WebLogic usually deploys to both. See this page for more information.

    For Weblogic shutdown hooks check this documentation page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application in which some operations are performed by MDB. These MDB
using ejb 3.1, servlet 3.0 (glassfish server v3) Scenario: I have MDB that listen
I'm writing, or trying to write, Baby's First MDB on WebSphere 7. I have
I have an EAR application which contains an MDB and a WAR. In this
I have an .mdb file, which is used as a data storage by one
I have an application uploading Access MDB (its file format) that I need to
I'm using MS ACCESS 2000. I have few tables in AB.mdb linked to some
I have an mdb which used to contain a bunch of linked tables. These
It's simple: I have an MDB and an EJB that sends messages to a
I am a relative newb to EJB. Background: I have an MDB using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.