1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[JBoss] Jar within War - NoClassDefFound Exception

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 23, 2025.

  1. Stack

    Stack Membro Participativo

    I have deployed 2 apps as app1.war and app2.war on jboss. These two apps use a common java package, say, myPackage. Earlier my wars looked like this

    app[12].war/
    -----web.xml
    -----app specific classes (.class files like)
    -----appClass1.class
    -----appClass2.class etc..
    -----WEB-INF/
    -----myPackage/ (this was just a folder under the war, not a jar package)
    ----------classes belonging to the common package like
    ----------common_class1.class
    ----------common_class2.class
    ----------.
    ----------.

    But this created problems since both set of common classes would have the exact same names etc.. in both war files. So I decided to compile the common package as a jar file and dropped it in WEB-INF/lib in each of the war files and now my war file looks like

    app[12].war/
    -----web.xml
    -----app specific classes (.class files like)
    -----appClass1.class
    -----appClass2.class etc..
    -----WEB-INF/
    ----------lib/
    ----------myPackage.jar (this is now a jar package)
    ----------myPackage/
    ---------------classes belonging to the common package like
    ---------------common_class1.class
    ---------------common_class2.class
    ---------------.
    ---------------.

    But now my app specific classes which need to access class files withing myPackage.jar throw java.lang.ClassNotFoundException Exception.

    I Googled but nothing addressed this particular problem. I'm probably doing something outrageously wrong. What can I try next?

    PS: I'm deploying my wars in JBOSS 4.2.3

    Continue reading...

Compartilhe esta Página