4 Replies Latest reply on Dec 6, 2001 6:25 AM by jules_gosnell

    JBoss3.0, jetty, JSP and classpath

    vad

      My system : jdk1.3.1 on NT4, JBoss3.0 build snapshot 25/11/2001.

      I have a classpath problem : I deploy a war which contains servlets and JSP. I get compile errors from Jetty when accessing the JSP, which complains that it can't find javax.servlet.http.* and other packages which are in the jetty-plugin.sar. I've also tried not to put jetty-plugin in a sar, but to deploy a jetty-service.xml with the necessary ... same results.

      What am I doing wrong?

      Vad

        • 1. Re: JBoss3.0, jetty, JSP and classpath
          tbfmicke

          I had the same problem, it was due to a small bug
          in org.jboss.jetty.JBossWebApplicationContext.

          When I did the changes outlined below it worked.
          I was told that the changes would be inserted into
          CVS a few days ago.



          --------------------------------------------------
          Index: JBossWebApplicationContext.java
          ===================================================================
          RCS file:
          /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JBossWebApplicat
          ionContext.java,v
          retrieving revision 1.2
          diff -r1.2 JBossWebApplicationContext.java
          219c219,220
          < fileClassPath+=jar;
          ---
          > // fileClassPath+=jar;
          > fileClassPath+= System.getProperty("path.separator") +jar;
          230c231,232
          < fileClassPath+=":"+jar;
          ---
          > // fileClassPath+=":"+jar;
          > fileClassPath+= System.getProperty("path.separator") + jar;

          >

          • 2. Re: JBoss3.0, jetty, JSP and classpath
            jules_gosnell

            Guys,

            JSPs are very problematic.

            Jetty is only explicitly control of what goes on it the WAR, but many classes are loaded into it's classloader before it takes control.

            If you could just pass a ClassLoader to the JSP compiler, there would be no problem - but you cannot. You have to pass it a classpath string.

            Extracting one of these from a hierarchy of ClassLoaders in non-trivial.

            For this reason, JSP on-the-fly compilation will lag a little in RH (it probably never worked properly in 2.4 anyway - we are talking Jetty) .
            When Marc checks in his new scoped ClassLoader I shall try to sort out a proper solution for JSP compilation - anything up until then is a temporary hack.

            The best solution until then is to precompile you JSPs - all your problems will go away magically.....

            Jules

            • 3. Re: JBoss3.0, jetty, JSP and classpath
              mepalmer

              Hey guys,
              I'm a bit new to this... but, how do we precompile our JSPs? Is it pretty easy to do? I'm trying to use JBoss3.0 with Jetty also. I'm not finding anything on how to precompile the JSPs. I'm just seeing messages that say it solves some problems and performance issues.

              Thanks,
              Matthew

              • 4. Re: JBoss3.0, jetty, JSP and classpath
                jules_gosnell

                Look on the web.

                Try the jakarta site. There must be something in the jasper (JSP engine used by Tomcat and Jetty) doc about it.

                From memory I think the compiler is called jspc.

                It just does what Jasper would do the first time you hit a page, but before deploy time, whilst you have full control over the classpath.

                Good luck,


                Jules