Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: V3
    • Fix Version/s: None
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      11,791

      Description

      We develop an web application that allows loading plugins.
      Plugins are loaded in a classloader that set webapp classloader as
      parent. Those plugins provides theirs own jsp files.
      But if a plugin jsp file uses a plugin class
      a JSP compilation fails with NoClassDefFound errors.

      For tomcat and jetty we worked it around by creating a jsp
      servlet per plugin with properly set classloader.

      Unfortunately, this approach failed in glassfish v3 with errors like:
      PWC6199: Generated servlet error: string:///msBuildRunParams_jsp.java:88:
      package javax.servlet.Servlet does not exist

      How can I make glassfish jsp compiler consider plugin classloaders or
      how can I create a new instance of JSP compiler servlet per-plugin.

        Activity

        Hide
        kchung added a comment -

        Looking at your test case, you'll need to make sure that at the invocation of

        CustomProcessor.init(ServletConfig config)

        config contains all the init parameters of web-test_war

        Show
        kchung added a comment - Looking at your test case, you'll need to make sure that at the invocation of CustomProcessor.init(ServletConfig config) config contains all the init parameters of web-test_war
        Hide
        jonnyzzz added a comment -

        Thank you for the hint. Actually, I failed to make it work. I continue to get error that classes are not found. How should I specify classpath. Do you have examples?

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:3: package javax.servlet does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:4: package javax.servlet.http does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:5: package javax.servlet.jsp does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:9: package javax.servlet.jsp.tagext does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:10: package org.apache.jasper.runtime does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:13: package org.apache.jasper.runtime does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:19: cannot find symbol
        symbol : class JspFactory
        location: class org.apache.jsp.tag.web.linkCSS_tag

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:23: cannot find symbol
        symbol : class JspContext
        location: class org.apache.jsp.tag.web.linkCSS_tag

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:25: package org.apache.jasper.runtime does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:26: package org.apache.jasper.runtime does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:27: package org.apache.jasper.runtime does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:28: package org.apache.jasper.runtime does not exist

        PWC6199: Generated servlet error:
        string:///linkCSS_tag.java:30: package org.glassfish.jsp.api does not exist

        Show
        jonnyzzz added a comment - Thank you for the hint. Actually, I failed to make it work. I continue to get error that classes are not found. How should I specify classpath. Do you have examples? PWC6199: Generated servlet error: string:///linkCSS_tag.java:3: package javax.servlet does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:4: package javax.servlet.http does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:5: package javax.servlet.jsp does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:9: package javax.servlet.jsp.tagext does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:10: package org.apache.jasper.runtime does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:13: package org.apache.jasper.runtime does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:19: cannot find symbol symbol : class JspFactory location: class org.apache.jsp.tag.web.linkCSS_tag PWC6199: Generated servlet error: string:///linkCSS_tag.java:23: cannot find symbol symbol : class JspContext location: class org.apache.jsp.tag.web.linkCSS_tag PWC6199: Generated servlet error: string:///linkCSS_tag.java:25: package org.apache.jasper.runtime does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:26: package org.apache.jasper.runtime does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:27: package org.apache.jasper.runtime does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:28: package org.apache.jasper.runtime does not exist PWC6199: Generated servlet error: string:///linkCSS_tag.java:30: package org.glassfish.jsp.api does not exist
        Hide
        kaelsan added a comment -

        I have the same problem. Any example of "In context attribute org.apache.catalina.jsp_classpath" cited by kchung?

        Show
        kaelsan added a comment - I have the same problem. Any example of "In context attribute org.apache.catalina.jsp_classpath" cited by kchung?
        Hide
        kchung added a comment -

        Example? What kind of example do you need? If you look at the web container code, in org.apache.catalina.loader.WebappLoader.setClassPath() (in web/web-core module), it computes the classpath, which is just a string of classpaths, separated by File.pathSeparator, and this string is set to that attributes:

        servletContext.setAttribute(Globals.CLASS_PATH_ATTR,
        classpath.toString());

        But this does not include the system jars, which contains the javax.* classes. For that the JspServlet init param is used. Look at the code in
        com.sun.enterprise.web.WebModuleListener.configureJsp (in web/web-glue module).

        The web container in glassfish already computes that for you. The easiest way is to copy the init params from any JSP servlet, to the JSP page you want compilation to take place.

        Remember all this is in the domain of internal API, and are subjected to change in the future.

        Show
        kchung added a comment - Example? What kind of example do you need? If you look at the web container code, in org.apache.catalina.loader.WebappLoader.setClassPath() (in web/web-core module), it computes the classpath, which is just a string of classpaths, separated by File.pathSeparator, and this string is set to that attributes: servletContext.setAttribute(Globals.CLASS_PATH_ATTR, classpath.toString()); But this does not include the system jars, which contains the javax.* classes. For that the JspServlet init param is used. Look at the code in com.sun.enterprise.web.WebModuleListener.configureJsp (in web/web-glue module). The web container in glassfish already computes that for you. The easiest way is to copy the init params from any JSP servlet, to the JSP page you want compilation to take place. Remember all this is in the domain of internal API, and are subjected to change in the future.
        Hide
        kaelsan added a comment - - edited

        I understood the problem but I don't know exactly how to solve it... in practice.
        As you said, the problem is in the JSP compiler classpath, the jars have not "javax".
        But how to do it? This is done in web.xml? This would be the example I need.

        Show
        kaelsan added a comment - - edited I understood the problem but I don't know exactly how to solve it... in practice. As you said, the problem is in the JSP compiler classpath, the jars have not "javax". But how to do it? This is done in web.xml? This would be the example I need.

          People

          • Assignee:
            kchung
            Reporter:
            jonnyzzz
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: