tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Bargos <jbargo...@gmail.com>
Subject Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper
Date Mon, 31 Jan 2011 14:26:45 GMT
On Mon, Jan 31, 2011 at 2:04 PM, Konstantin Kolinko
<knst.kolinko@gmail.com> wrote:
> 2011/1/31 John Bargos <jbargos12@gmail.com>:
>> Hi,
>>
>> last week, I was having fun with trivial examples accessing a
>> datasource with the standard taglibs with success.
>> Since everything was working perfectly in jsp form and morale was high,
>> I decided to precompile my web app with TCD and deploy it again in tomcat 7.0.6
>>
>> I installed ant, fetched dependencies, installed TCD set up the
>> project's properties and fired "ant compile" away.
>>
>> 2 questions:
>>
>> A small problem appeared with addWebXmlMappings="true". apparently ant reported:
>>
>> \build.xml:67: jasper doesn't support the "addWebXmlMappings" attribute
>
> That is strange, because
> 1) org.apache.jasper.JspC has setAddWebXmlMappings(boolean) method, so
> it should not fail
>
> 2) The jasper call in build.xml (from
> apache-tomcat-7.0.6-deployer.zip) is on lines 58-62, not on line 67 as
> in the message.
>


2) don't worry about line numbers cause I added a few lines of my own
in there to set up properties, the jasper task is:

    <jasper validateXml="false"
             uriroot="${webapp.path}"
             webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
             addWebXmlMappings="true"
             outputDir="${webapp.path}/WEB-INF/classes" />

1) I checked the libs in ant 1.8.2.
apparently ant ships with:

jasper-compiler.version=4.1.36
jasper-runtime.version=${jasper-compiler.version}

..in libraries.properties and you fetch those jars

I tried to find the jars in tomcat 7.0.6 \lib: there's jasper.jar and
jasper-el.jar so I'm at a loss to deduce their version, their file
sizes are very different.

>
>
>> Apparently ant 1.8.2 with all dependencies fetched *today* isn't enough?
>
>>
>> java.lang.NullPointerException
>>     at org.apache.jasper.runtime.
>> TagHandlerPool.get(TagHandlerPool.java:106)
>>     at index_jsp._jspx_meth_sql_query_0(Unknown Source)
>
> 1) Can you compare the java source of index_jsp._jspx_meth_sql_query_0
> when generated by TCD and the one generated when index.jsp is compiled
> at run time?
> 2) Please create a bugzilla entry.
>

The sources have vastly different init:

the one generated in tomcat is reusing TagHandlerPool:
  public void _jspInit() {
    _005fjspx_005ftagPool_005fsql_005fquery_0026_005fvar_005fdataSource
= org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems =
org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody =
org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _el_expressionfactory =
_jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_instancemanager =
org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
  }


while the precompiled one creates new objects:
  public index_jsp() {
    _jspx_tagPool_sql_query_var_dataSource = new
org.apache.jasper.runtime.TagHandlerPool();
    _jspx_tagPool_c_forEach_var_items = new
org.apache.jasper.runtime.TagHandlerPool();
    _jspx_tagPool_c_out_value_nobody = new
org.apache.jasper.runtime.TagHandlerPool();
  }


The working "_jspx_meth_sql_query_0":

  private boolean _jspx_meth_sql_005fquery_005f0(PageContext _jspx_page_context)
          throws Throwable {
    PageContext pageContext = _jspx_page_context;
    JspWriter out = _jspx_page_context.getOut();
    //  sql:query
    org.apache.taglibs.standard.tag.rt.sql.QueryTag
_jspx_th_sql_005fquery_005f0 =
(org.apache.taglibs.standard.tag.rt.sql.QueryTag)
_005fjspx_005ftagPool_005fsql_005fquery_0026_005fvar_005fdataSource.get(org.apache.taglibs.standard.tag.rt.sql.QueryTag.class);
    _jspx_th_sql_005fquery_005f0.setPageContext(_jspx_page_context);
    _jspx_th_sql_005fquery_005f0.setParent(null);
    // /index.jsp(15,0) name = var type = java.lang.String reqTime =
false required = true fragment = false deferredValue = false
expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_sql_005fquery_005f0.setVar("users");
    // /index.jsp(15,0) name = dataSource type = null reqTime = true
required = false fragment = false deferredValue = false
expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_sql_005fquery_005f0.setDataSource(new String("zoomla"));
    int[] _jspx_push_body_count_sql_005fquery_005f0 = new int[] { 0 };
    try {
      int _jspx_eval_sql_005fquery_005f0 =
_jspx_th_sql_005fquery_005f0.doStartTag();
      if (_jspx_eval_sql_005fquery_005f0 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        if (_jspx_eval_sql_005fquery_005f0 !=
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
          out = _jspx_page_context.pushBody();
          _jspx_push_body_count_sql_005fquery_005f0[0]++;
          _jspx_th_sql_005fquery_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent)
out);
          _jspx_th_sql_005fquery_005f0.doInitBody();
        }
        do {
          out.write("\r\n");
          out.write("select * from zend_users;\r\n");
          int evalDoAfterBody = _jspx_th_sql_005fquery_005f0.doAfterBody();
          if (evalDoAfterBody !=
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
            break;
        } while (true);
        if (_jspx_eval_sql_005fquery_005f0 !=
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
          out = _jspx_page_context.popBody();
          _jspx_push_body_count_sql_005fquery_005f0[0]--;
        }
      }
      if (_jspx_th_sql_005fquery_005f0.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (Throwable _jspx_exception) {
      while (_jspx_push_body_count_sql_005fquery_005f0[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_sql_005fquery_005f0.doCatch(_jspx_exception);
    } finally {
      _jspx_th_sql_005fquery_005f0.doFinally();
      _005fjspx_005ftagPool_005fsql_005fquery_0026_005fvar_005fdataSource.reuse(_jspx_th_sql_005fquery_005f0);
    }
    return false;
  }

and the precompiled _jspx_meth_sql_query_0:

  private boolean _jspx_meth_sql_query_0(javax.servlet.jsp.PageContext
pageContext)
          throws Throwable {
    JspWriter out = pageContext.getOut();
    /* ----  sql:query ---- */
    org.apache.taglibs.standard.tag.rt.sql.QueryTag
_jspx_th_sql_query_0 =
(org.apache.taglibs.standard.tag.rt.sql.QueryTag)
_jspx_tagPool_sql_query_var_dataSource.get(org.apache.taglibs.standard.tag.rt.sql.QueryTag.class);
    _jspx_th_sql_query_0.setPageContext(pageContext);
    _jspx_th_sql_query_0.setParent(null);
    _jspx_th_sql_query_0.setVar("users");
    _jspx_th_sql_query_0.setDataSource(new String("zoomla"));
    int[] _jspx_push_body_count_sql_query_0 = new int[] { 0 };
    try {
      int _jspx_eval_sql_query_0 = _jspx_th_sql_query_0.doStartTag();
      if (_jspx_eval_sql_query_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        if (_jspx_eval_sql_query_0 !=
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
          javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
          _jspx_push_body_count_sql_query_0[0]++;
          out = _bc;
          _jspx_th_sql_query_0.setBodyContent(_bc);
          _jspx_th_sql_query_0.doInitBody();
        }
        do {
          out.write("\r\nselect * from zend_users;\r\n");
          int evalDoAfterBody = _jspx_th_sql_query_0.doAfterBody();
          if (evalDoAfterBody !=
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
            break;
        } while (true);
        if (_jspx_eval_sql_query_0 !=
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
          out = pageContext.popBody();
          _jspx_push_body_count_sql_query_0[0]--;
      }
      if (_jspx_th_sql_query_0.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
        return true;
    } catch (Throwable _jspx_exception) {
      while (_jspx_push_body_count_sql_query_0[0]-- > 0)
        out = pageContext.popBody();
      _jspx_th_sql_query_0.doCatch(_jspx_exception);
    } finally {
      _jspx_th_sql_query_0.doFinally();
      _jspx_tagPool_sql_query_var_dataSource.reuse(_jspx_th_sql_query_0);
    }
    return false;
  }

I think it's early to create a bugzilla entry. Should I look for jasper >4.1.36?

Regards,

John


> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message