You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Bargos <jb...@gmail.com> on 2011/01/31 03:20:01 UTC

Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

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

Apparently ant 1.8.2 with all dependencies fetched *today* isn't enough?

Bypassing this problem by manually merging the servlet mappings from
generated_web.xml to web.xml and deploying, I get an exception when
accessing my page:

java.lang.NullPointerException
    at org.apache.jasper.runtime.
TagHandlerPool.get(TagHandlerPool.java:106)
    at index_jsp._jspx_meth_sql_query_0(Unknown Source)
    at index_jsp._jspService(Unknown Source)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:284)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1684)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I'm using:

apache-ant-1.8.2
jakarta-taglibs-standard-1.1.2
apache-tomcat-7.0.6-deployer
apache-tomcat-7.0.6

2 libs for the tags: in \WEB-INF\lib
jstl.jar
standard.jar

my toned down index.jsp is very simple:


<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<head>
<title>Zend page.</title>
</head>
<body>
<p align="center"><font color="#FF0000" size="6"><%="Zend"%></font></p>

<sql:query var = "users" dataSource="zoomla">
select * from zend_users;
</sql:query>

<table border=1>
<c:forEach var="row" items="${users.rows}">
<tr>
<td><c:out value="${row.idkp}"/></td>
<td><c:out value="${row.login}"/></td>
<td><c:out value="${row.password}"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>

the web.xml is pretty spartan as well:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="3.0">

  <display-name>datasource fun</display-name>
  <description>
    datasource fun
  </description>

    <servlet>
        <servlet-name>index_jsp</servlet-name>
        <servlet-class>index_jsp</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>index_jsp</servlet-name>
        <url-pattern>/index.jsp</url-pattern>
    </servlet-mapping>

<resource-ref>
 <description>postgreSQL Datasource fun</description>
 <res-ref-name>jdbc/postgres</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>
</web-app>

so what's going on here? any pointers? looks like google is my enemy
on this one :(

Your input and help is much appreciated,

John

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


RE: Tomcat in CentOS 5.5

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Christian Garling 
> Sent: Monday, January 31, 2011 10:37
> To: Tomcat Users List
> Subject: Tomcat in CentOS 5.5
> 
> Hi there,
> 
> I am new on this list, so first I want to say hello to you. 
> But now to my problem.
> 
> We develop software for the touristical branch which runs 
> mainly under CentOS. Our customers are big companies. Of 
> course they have SLAs with their server providers, so they 
> cant use any software version they want. 

Centos 5.5 is not covered by an SLA, you should use RHEL 5 (and I belive the
current patch version is 5.6)

> CentOS 5.5 ships Tomcat 6.0.18, so this version is available 
> at customers site. The developer who writes the java parts of 
> our application told me, that we cant use the Tomcat version 
> shipped with CentOS, because it has too many bugs. But if we 
> use another one, we break with customers SLAs. I might be 
> true, that there are bugs in Tomcat 6.0.18, but CentOS is an 
> enterprise operating system. I can not believe that these 

Yes the upsream provider Red Hat may provide fixes, you should look at the
src.rpm files for tomcat to see.

> bugs are not fixed with patches there. Can somebody shed some 
> light into this?
> 

In you situation we would install a version of Tomcat suited to the
Customer/Task in /var/opt/apache/tomcat/version and create a SysV init script
and plug it into the vendors mod_ajp facility.

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

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.



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


RE: Tomcat in CentOS 5.5

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christian Garling [mailto:christian.garling@cg-networks.de] 
> Subject: Tomcat in CentOS 5.5

> CentOS 5.5 ships Tomcat 6.0.18, so this version is available at 
> customers site. The developer who writes the java parts of our 
> application told me, that we cant use the Tomcat version shipped with 
> CentOS, because it has too many bugs. But if we use another one, we 
> break with customers SLAs. I might be true, that there are bugs in 
> Tomcat 6.0.18, but CentOS is an enterprise operating system.

You'll have to talk to CentOS, not the Tomcat users (or developers).  The Tomcat developers are extremely prompt at providing updates for Tomcat, but have absolutely no control (and very little influence) over any of the 3rd-party repackagers, such as CentOS.  If you're not running a Tomcat downloaded from tomcat.apache.org, you need to have your discussions with whomever you are getting Tomcat from.

The usual recommendation (which I whole-heartedly agree with) is to ditch the 3rd-party version of Tomcat, and always use a real one - regardless of platform.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.



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


Tomcat in CentOS 5.5

Posted by Christian Garling <ch...@cg-networks.de>.
Hi there,

I am new on this list, so first I want to say hello to you. But now to 
my problem.

We develop software for the touristical branch which runs mainly under 
CentOS. Our customers are big companies. Of course they have SLAs with 
their server providers, so they cant use any software version they want. 
CentOS 5.5 ships Tomcat 6.0.18, so this version is available at 
customers site. The developer who writes the java parts of our 
application told me, that we cant use the Tomcat version shipped with 
CentOS, because it has too many bugs. But if we use another one, we 
break with customers SLAs. I might be true, that there are bugs in 
Tomcat 6.0.18, but CentOS is an enterprise operating system. I can not 
believe that these bugs are not fixed with patches there. Can somebody 
shed some light into this?

Best regards, Christian

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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by Mark Thomas <ma...@apache.org>.
On 31/01/2011 22:51, Christopher Schultz wrote:
> John,
> 
> On 1/31/2011 10:23 AM, John Bargos wrote:
>> Yeah, I checked that doc b4 starting, I also checked catalina.tasks in
>> catalina-ant.jar and the new jasper.jar libs in the deployer\lib, so
>> yesterday I thought the task def was ok and I was ready to compile.
> 
> I've been playing with the JSP precompiler in 7.0.x and I'm working on
> an ant script that I hope will ship with Tomcat in the future. I'm
> including it in it's current form below.

You've seen [1] right?

> Currently, it will generate a web.xml fragment, but if you set
> "jspc.jar.file", it will even generate a JAR file that you can drop into
> your WEB-INF/lib directory and don't have to do your own web.xml merge.
> Cool, right?

That would be a nice extension to the current script

> 4. You saw different code generated by the precompiler and Jasper
>    running within Tomcat: that's because within Tomcat, Jasper can
>    rely on certain things being available such as tag pools. The
>    precompiler apparently does not do tag pooling. Don't worry
>    too much about this right now.

Huh? -poolingEnabled - defaults to true.

The output should be identical for identical input. It it isn't,
something is broken. With the exception of some white space differences
when I tested 7.0.x a week or so ago the outputs were identical.

Mark

[1]
http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html#Web_Application_Compilation

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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John,

On 1/31/2011 10:23 AM, John Bargos wrote:
> Yeah, I checked that doc b4 starting, I also checked catalina.tasks in
> catalina-ant.jar and the new jasper.jar libs in the deployer\lib, so
> yesterday I thought the task def was ok and I was ready to compile.

I've been playing with the JSP precompiler in 7.0.x and I'm working on
an ant script that I hope will ship with Tomcat in the future. I'm
including it in it's current form below.

All you need to do is set catalina.home to Tomcat's home directory, set
a "compile.classpath" for your webapp's libraries (probably WEB-INF/lib
or whatever) and then set whatever "jspc.X" properties you want to set.

Currently, it will generate a web.xml fragment, but if you set
"jspc.jar.file", it will even generate a JAR file that you can drop into
your WEB-INF/lib directory and don't have to do your own web.xml merge.
Cool, right?

A couple of VERY IMPORTANT notes:

1. This is currently experimental and not very flexible. I'm trying to
see what I can get out of the code without modifying it. Keep reading.

2. You need to patch
lib/jasper.jar!org/apache/jasper/resources/LocalStrings.properties like
this (apologies for any wrapping... just read the patch and apply it
manually: it's not that complicated):

> Index: java/org/apache/jasper/resources/LocalStrings.properties
> ===================================================================
> --- java/org/apache/jasper/resources/LocalStrings.properties    (revision 1063336)
> +++ java/org/apache/jasper/resources/LocalStrings.properties    (working copy)
> @@ -265,31 +265,32 @@
>  \    -source <version>   Set the -source argument to the compiler (default 1.6)\n\
>  \    -target <version>   Set the -target argument to the compiler (default 1.6)\n\
>  
> -jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>\n\
> +jspc.webxml.header=<?xml version="1.0" encoding="{0}"?>\n\
>  \n\
> -<!DOCTYPE web-app\n\
> -\    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"\n\
> -\    "http://java.sun.com/dtd/web-app_2_3.dtd">\n\
> +<web-app xmlns="http://java.sun.com/xml/ns/javaee"\n\
> +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\
> +  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee\n\
> +                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"\n\
> +  version="3.0">\n\
>  <!--\n\
> -Automatically created by Apache Tomcat JspC.\n\
> +Automatically created by Apache Tomcat JspC {1, date, short} {1, time, short}.\n\
>  -->\n\
>  <web-app>\n\
>  \n
>  jspc.webxml.footer=\n\
> -</web-app>\n\
> -\n
> -jspc.webinc.header=\n\
> +</web-app>\n
> +jspc.webinc.header=<?xml version="1.0" encoding="{0}"?>\n\
> +\n\
> +<web-fragment xmlns="http://java.sun.com/xml/ns/javaee"\n\
> +      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\
> +      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee\n\
> +                          http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"\n\
> +      version="3.0">\n\
>  <!--\n\
> -Automatically created by Apache Tomcat JspC.\n\
> -Place this fragment in the web.xml before all icon, display-name,\n\
> -description, distributable, and context-param elements.\n\
> +Automatically created by Apache Tomcat JspC {1, date, short} {1, time, short}.\n\
>  -->\n
>  jspc.webinc.footer=\n\
> -<!--\n\
> -All session-config, mime-mapping, welcome-file-list, error-page, taglib,\n\
> -resource-ref, security-constraint, login-config, security-role,\n\
> -env-entry, and ejb-ref elements should follow this fragment.\n\
> --->\n
> +</web-fragment>\n
>  jspc.webinc.insertEnd=<!-- JSPC servlet mappings end -->
>  jspc.webinc.insertStart=<!-- JSPC servlet mappings start -->
>  jspc.error.jasperException=error-the file ''{0}'' generated the following parse exception: {1}

3. It's very important that you your uriroot ("jsp.source.dir") have a
   WEB-INF/web.xml file that has the correct header in it, or you might
   get strange behavior:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  version="3.0">

4. You saw different code generated by the precompiler and Jasper
   running within Tomcat: that's because within Tomcat, Jasper can
   rely on certain things being available such as tag pools. The
   precompiler apparently does not do tag pooling. Don't worry
   too much about this right now.

Now that you've read all the nastiness, here's the build script:

<?xml version="1.0" encoding="UTF-8" ?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
- -->
<project name="Tomcat-JSPC" default="" basedir=".">
  <import file="${catalina.home}/bin/catalina-tasks.xml" />

  <target name="jspc" description="Compiles JSPs" depends="jspc:jasper,
jspc:javac, jspc:jar">
  </target>

  <target name="jspc:jasper">
    <condition property="jspc-configuration-okay">
      <and>
        <isset property="catalina.home" />
        <isset property="jspc.target.dir" />
        <isset property="jspc.source.dir" />
        <resourcecount refid="compile.classpath" when="greater" count="0" />
      </and>
    </condition>

    <fail unless="jspc-configuration-okay">
      JspC requires the following properties to be set:

      catalina.home=${catalina.home}
      jspc.target.dir=${jspc.target.dir}
      jspc.source.dir=${jspc.source.dir}

      Also, you need to have the following classpath reference set:
      &lt;path id="jspc.classpath"&gt;

      It should point to all of the classes and libraries referenced
      by your JSP sources.
    </fail>

    <delete dir="${jspc.target.dir}" />
    <mkdir dir="${jspc.target.dir}" />
    <mkdir dir="${jspc.target.dir}/src" />
    <mkdir dir="${jspc.target.dir}/classes" />
    <mkdir dir="${jspc.target.dir}/META-INF" />

    <!-- Invoke Jasper -->
    <jasper compile="false"
            uriroot="${jspc.source.dir}"
            outputDir="${jspc.target.dir}/src"
            webXmlFragment="${jspc.target.dir}/META-INF/web-fragment.xml">
    </jasper>
  </target>

  <target name="jspc:javac">
    <!-- Compile the classes -->
    <javac srcdir="${jspc.target.dir}/src"
           destdir="${jspc.target.dir}/classes"
           deprecation="${javac.deprecation}"
           includeAntRuntime="false">
      <classpath>
        <path refid="jspc.classpath" />
        <fileset dir="${catalina.home}/lib" includes="*.jar" />
      </classpath>
    </javac>
  </target>

  <target name="jspc:jar" if="jspc.jar.file">
    <!-- Package into a .jar file -->
    <jar
         destfile="${jspc.jar.file}"
         compress="true">
      <fileset dir="${jspc.target.dir}"
includes="META-INF/web-fragment.xml" />
      <fileset dir="${jspc.target.dir}/classes" includes="**/*" />
    </jar>
  </target>
</project>

Let me know how it goes.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1HPNYACgkQ9CaO5/Lv0PAQXgCfSgSZ7zwFIgJW9rtkYDC/a1Uy
8aYAoKCiFx1ddRTbXNiYIOXPrR7ogndP
=biHz
-----END PGP SIGNATURE-----

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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by John Bargos <jb...@gmail.com>.
Fixed it,

Apparently this was classpath hell again.

Ant and jasper also need the complete tomcat lib in classpath

2 suggestion for build.xml:

1. Add a property for the base tomcat dir:
<property name="tomcat"   value="C:/tomcat"/>

2. Add the /lib path into
a. both in the deployer classpath:

  <path id="deployer.classpath">
    <fileset dir="${basedir}/lib">
      <include name="*.jar"/>
    </fileset>
	
->    <fileset dir="${tomcat}/lib">
->      <include name="*.jar"/>
->    </fileset>

  </path>

b. and into the javac task:

    <javac destdir="${webapp.path}/WEB-INF/classes"
           optimize="off"
           debug="${compile.debug}"
           deprecation="${compile.deprecation}"
           failonerror="false"
           srcdir="${webapp.path}/WEB-INF/classes"
           encoding="UTF-8"
           excludes="**/*.smap">
      <classpath>
        <fileset dir="${webapp.path}/WEB-INF/lib">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="${basedir}/lib">
          <include name="*.jar"/>
        </fileset>
->	<fileset dir="${tomcat}/lib">
->	  <include name="*.jar"/>
->	</fileset>
		
      </classpath>
      <include name="**" />
      <exclude name="tags/**" />
    </javac>

Thanks for all your help!

John



On Mon, Jan 31, 2011 at 5:23 PM, John Bargos <jb...@gmail.com> wrote:
> On Mon, Jan 31, 2011 at 5:06 PM, Konstantin Kolinko
> <kn...@gmail.com> wrote:
>> 2011/1/31 John Bargos <jb...@gmail.com>:
>>> 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
>>
>> http://ant.apache.org/manual/Tasks/jspc.html
>> Deprecated. Nobody uses that.
>>
>> You should be using the jars that come with Tomcat.
>>
>> The real docs are here:
>> http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html
>>
>>
>
> Yeah, I checked that doc b4 starting, I also checked catalina.tasks in
> catalina-ant.jar and the new jasper.jar libs in the deployer\lib, so
> yesterday I thought the task def was ok and I was ready to compile.
>
> I tried forcibly removing the old jasper jars from ant\lib.. it
> doesn't cut it..:
>
> BUILD FAILED
> \apache-tomcat-7.0.6-deployer\build.xml:66:
> java.lang.NoClassDefFoundError: org/apache/tomcat/JarScannerCa
> llback
>        at org.apache.jasper.JspC.initServletContext(JspC.java:1437)
>        at org.apache.jasper.JspC.execute(JspC.java:1303)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
>        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>        at org.apache.tools.ant.Task.perform(Task.java:348)
>        at org.apache.tools.ant.Target.execute(Target.java:390)
>        at org.apache.tools.ant.Target.performTasks(Target.java:411)
>        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
>        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
>        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
>        at org.apache.tools.ant.Main.runBuild(Main.java:809)
>        at org.apache.tools.ant.Main.startAnt(Main.java:217)
>        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
>        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.tomcat.JarScannerCallback
>        at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)
>        at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
>        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        ... 25 more
>
> Total time: 0 seconds
>
>
> Kind regards,
>
> John
>
>>
>>> I think it's early to create a bugzilla entry. Should I look for jasper >4.1.36?
>>
>> 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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by John Bargos <jb...@gmail.com>.
On Mon, Jan 31, 2011 at 5:06 PM, Konstantin Kolinko
<kn...@gmail.com> wrote:
> 2011/1/31 John Bargos <jb...@gmail.com>:
>> 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
>
> http://ant.apache.org/manual/Tasks/jspc.html
> Deprecated. Nobody uses that.
>
> You should be using the jars that come with Tomcat.
>
> The real docs are here:
> http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html
>
>

Yeah, I checked that doc b4 starting, I also checked catalina.tasks in
catalina-ant.jar and the new jasper.jar libs in the deployer\lib, so
yesterday I thought the task def was ok and I was ready to compile.

I tried forcibly removing the old jasper jars from ant\lib.. it
doesn't cut it..:

BUILD FAILED
\apache-tomcat-7.0.6-deployer\build.xml:66:
java.lang.NoClassDefFoundError: org/apache/tomcat/JarScannerCa
llback
        at org.apache.jasper.JspC.initServletContext(JspC.java:1437)
        at org.apache.jasper.JspC.execute(JspC.java:1303)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:809)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException:
org.apache.tomcat.JarScannerCallback
        at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)
        at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 25 more

Total time: 0 seconds


Kind regards,

John

>
>> I think it's early to create a bugzilla entry. Should I look for jasper >4.1.36?
>
> 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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/1/31 John Bargos <jb...@gmail.com>:
> 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

http://ant.apache.org/manual/Tasks/jspc.html
Deprecated. Nobody uses that.

You should be using the jars that come with Tomcat.

The real docs are here:
http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html



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

Best regards,
Konstantin Kolinko

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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by Mark Thomas <ma...@apache.org>.
On 31/01/2011 14:26, John Bargos wrote:

> 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.

Look in the manifests.

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

That version of Jasper is never going to work with Tomcat 7. You need to
use the Tomcat 7 versions.

Mark

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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by John Bargos <jb...@gmail.com>.
On Mon, Jan 31, 2011 at 2:04 PM, Konstantin Kolinko
<kn...@gmail.com> wrote:
> 2011/1/31 John Bargos <jb...@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


Re: Problem with standard taglibs after precompiling a web app with TCD in 7.0.6 & no support for "addWebXmlMappings" in jasper

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/1/31 John Bargos <jb...@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.



> 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.

Best regards,
Konstantin Kolinko

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