7 Replies Latest reply on Jan 31, 2003 10:47 AM by adrian.brock

    WAR Deployment Examples

    carcudi

      Sorry for the cross post, but the Tomcat forum appears to be the Siberia of the JBoss world.

      At any rate...

      Deployed the examples application from the bundled Tomcat (JB 3.0.4 + TC 4.11.2) by creating a WAR file from the subdirectories and placing it in the default/deploy folder and restarting the server.

      Figured this out mostly by taking a conglomeration of suggestions from the forums and following a couple of hunches. Unfortunately, it varies from the recommended deployment by one directory level (since the going wisdom says to create an "examples.war" folder then plop the war into it).

      The mail example works fine when you realize that the javax.mail.session class is tucked away under the the java:/Mail key (JBoss JNDI) rather than the java:comp/env/mail/session key listed in the TC web.xml file.

      Good news, it works. Bad news, I'm two steps in the door and already having to tweak the recommended settings. Can anybody tell me why I am doing the right thing the wrong way and how I can make it do what it's supposed to according to plan?

        • 1. Re: WAR Deployment Examples

          Not sure what the problem here is but...

          java:comp/env/mail/session is a lookup to a private name space, so somewhere in your deployment descriptors you need to map this to java:/Mail (I'm not familiar with the examples.war your trying to deploy, nor have I actually tried to use the mail session in JBoss).

          Deploying a packaged examples.war under deploy directory is ok. You only need to create an examples.war directory under deploy if you want to deploy your web archive in an expanded format (not in a single package)

          HTH

          • 2. Re: WAR Deployment Examples
            carcudi

            I Posted a reply to this earlier, but it didn't take.

            At any rate, everything I mentioned in the original EMail was working, just slightly tweaked.

            I guess my question would be, is it possible to cross reference jndi entries via other entries?

            The web.xml file for this app contains the resource ref:

            <resource-ref>
            <res-ref-name>mail/Session</res-ref-name>
            <res-type>javax.mail.Session</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>

            How might I modify this entry to "redirect" to the JBoss java:/Mail ref, and therefore eliminate the need to modify the source Java code to point directly to java:/Mail?

            • 3. Re: WAR Deployment Examples
              carcudi

              I Posted a reply to this earlier, but it didn't take.

              At any rate, everything I mentioned in the original EMail was working, just slightly tweaked.

              I guess my question would be, is it possible to cross reference jndi entries via other entries?

              The web.xml file for this app contains the resource ref:

              <resource-ref>
              <res-ref-name>mail/Session</res-ref-name>
              <res-type>javax.mail.Session</res-type>
              <res-auth>Container</res-auth>
              </resource-ref>

              How might I modify this entry to "redirect" to the JBoss java:/Mail ref, and therefore eliminate the need to modify the source Java code to point directly to java:/Mail?

              • 4. Re: WAR Deployment Examples

                example.war/WEB-INF/jboss-web.xml

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE jboss-web
                PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
                "http://www.jboss.org/j2ee/dtds/jboss-web_3_0.dtd">

                <jboss-web>

                <resource-ref>
                <res-ref-name>mail/Session</res-ref-name>
                <jndi-name>java:/Mail</jndi-name>
                </resource-ref>

                </jboss-web>

                The Tomcat distro does not include any jboss-web.xml

                Regards,
                Adrian

                • 5. Re: WAR Deployment Examples
                  carcudi

                  Pretty neat trick. And it works like a champ.

                  I guess for compatibility's sake, it makes good sense to put the redirect reference in its own jboss-specific xml file.

                  Would it have worked even if I'd added this reference in the original web.xml file.

                  • 6. Re: WAR Deployment Examples
                    carcudi

                    Sorry, that last post was supposed to end with a question.

                    "Would it have worked even if I'd added this reference in the original web.xml file?"

                    • 7. Re: WAR Deployment Examples

                      No, jndi mapping is not part of the spec.

                      It is container specific.

                      Regards,
                      Adrian