Servlet and EJB sharing a Singleton

Discussions

EJB design: Servlet and EJB sharing a Singleton

  1. Servlet and EJB sharing a Singleton (4 messages)

    I have a servlet and stateless session bean deployed in the same WebLogic server. The servlet is in a war and session bean in a jar. I want them to be able to access the same singleton and since the're in the same WebLogic server I assumed this would be possible, but they each have a different singleton. How can I get them to access the same singleton?
  2. need more info:

    where is your singleton class residing, with War or Jar ?
  3. Put the jar and war in an EAR file. You need to create application.xml to define the relationship. Consult Weblogic doc
  4. Thanks! Putting it in an EAR solved the problem.
  5. I think it has got a lot to do with the way your class-loader policy is set up for you.

    Kapil