3 Replies Latest reply on May 16, 2002 7:12 AM by Jamal Karimi

    HOW: JSP Access JNDI/JBOSS when outside of EAR

    Alan Newbie

      I currently have an application bundled into .war and .jar files that are deployed as a .ear. I want to move all of my files from .war into Tomcat so that they can be edited and redeployed without having to redeploy my entire application. How can I allow those JSP's to find my EJB's in JBOSS jndi (the lookup failes with " not bound".

      Thanks!
      Alan

        • 1. Re: HOW: JSP Access JNDI/JBOSS when outside of EAR
          Jamal Karimi Newbie

          Hi,

          do you mean a separate Tomcat connecting JBoss?
          If yes I do it so, without problems and I'm searching a way to deploy my war in my ear, like you do!

          Perhaps we can help eachother :)

          What do you want to know?

          jamal

          • 2. Re: HOW: JSP Access JNDI/JBOSS when outside of EAR
            Alan Newbie

            I'm running JBoss/Tomcat on the same JVM. What do I have to do special to configure tomcat and/or jboss to let the jsp's talk to JNDI and the EJB's???

            ear deployment was easy. using ANT is by far the best way to do it. it seems almost impossible otherwise, so get it from the jakarta site if you don't already have it.

            basically you just need the following

            app.war = all jsp files, html, images, UI utililty classes
            app.ejb = all ejb files, ejb-jar.xml, jboss.xml, Manifest
            app.ear = app.war + app.ejb + application.xml + Manifest

            hope this helps!
            Al

            • 3. Re: HOW: JSP Access JNDI/JBOSS when outside of EAR
              Jamal Karimi Newbie

              As I said I have a separate Tomcat running while JBoss 3.0 RC1 is running and this works with the following pereferences. I know I can run my war in an ear in JBoss, but this is my problem, see beneath.

              ** setting the servlet context in init() method of my servlet **
              ** you have to look if it's the same in JSP **

              Properties newProps = System.getProperties();
              newProps.put ("java.naming.factory.initial", getServletContext().getInitParameter ("java.naming.factory.initial"));
              newProps.put ("java.naming.provider.url", getServletContext().getInitParameter ("java.naming.provider.url"));
              System.setProperties (newProps);

              ** parameters come from my web.xml file **

              <context-param>
              <param-name>java.naming.factory.initial</param-name>
              <param-value>org.jnp.interfaces.NamingContextFactory</param-value>
              </context-param>
              <context-param>
              <param-name>java.naming.provider.url</param-name>
              <param-value>localhost:1099</param-value>
              </context-param>

              After this I can make lookups without problems. I hope this works for you too (running separate war and ear).

              So now to my problem: I use of course Ant :-). Building a war which is deployed is easy. But I can't make lookup on my ejb's.
              please see my posting
              http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/