ejb and servlet use the same JavaBean

Discussions

EJB programming & troubleshooting: ejb and servlet use the same JavaBean

  1. ejb and servlet use the same JavaBean (2 messages)

    i have an EJB that use a JavaBean. This JavaBean is used by a one servlet and various JSP. I don't know where must i put this JavaBean. If i put on the WEB-INF/Classes/<package name> folder the EJB can access to it.

    If i put the JavaBean into the classpath in can't make hot-deploy of this JavaBean (If i make one change on the JavaBean i have to restart the Server).

    so where must i put the JavaBean to share it between an Ejb and a servlets-jsps (war file)

    Thank you.

    My configuration is

    Jboss 2.4.3
    Catalina 4.0
    win 2k
  2. ups¡¡

    maybe i don't expalint it well.

    Here is a better explanation and pardo for my poor english.

    I have a JavaBean and i use it in two servlet and in one EJB. I don't know where must i put this JavaBean class.

    If i put in WEB-INF/classes the ejb can't access to the JavaBean but the servlet can.

    If i put in the server classapth (SERVER_HOME/lib/ext, for example) servlets and EJB can access to the JavaBean but if i change the javaBean code and i recompile it, i have to restart the server. (no hot-deploy¡¡¡¡)

    So what else can i do???

    Is bad idea or bad design to use the same JavaBean in a servlet and in an EJB????

    Thanks.

  3. Maybe this post is not interesting for anybody, because is an easy or unsual but i still with it ;-)

    The best thing that i suceed is to create a .jar archive with the classes that web aplication and an EJB share, and put this file into the WEB-INF/lib and in the .ear file. I also modify the EJB manifest file and add one line,

    Class-path: /path_to_the_library.jar_on_the_ear/library.jar

    This go fine, but i have two library.jar.

    Any better way????