Migration Solutions for ColdFusion Applications to ASP.NET
      
New Atlanta Product Forums Profile | Search | Login | RSS
New Topic Reply   Previous Page  Page: 1   Next Page

Thread: ClassCastException when using nested tag files
Created on: 04/14/11 04:07 PM Replies: 5
cpdjh02


Joined: 04/08/11
Posts: 17
ClassCastException when using nested tag files
04/14/11 4:07 PM

I think this might be related to bug #3399 described on this post: http://forums.newatlanta.com/messages.cfm?threadid=4B90F7E2-7958-4F0F-865CBD1BA8CE0BB8

I have two .tag files in the first one:
WEB-INF\tags\tagOne.tag
I use a second tag:
WEB-INF\tags\nested\tagTwo.tag


The WEB-INF\tags\tagOne.tag file has the following code:
<%@ taglib tagdir="/WEB-INF/tags/nested" prefix="nestedTags" %>

Simple tag that calls a second tag.

<nestedTags:tagTwo/>


The WEB-INF\tags\nested\tagTwo.tag has the following code:
Simple tag that prints out tagTwo.<br/>


Then when I call the tagOne tag from with in a JSP like so:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>

<%@ taglib tagdir="/WEB-INF/tags" prefix="testTags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>

<title>Test for tagdir tags.</title>   

</head>

<body>

This is my JSP page testing nested tags.

   <testTags:tagOne/>

<br>

</body>

</html>


I get the following ClassCastException:
java.lang.ClassCastException: com.newatlanta.servletexec.JspPageContextWrapper cannot be cast to com.newatlanta.servletexec.JspPageContext
   at pagecompile._WEB_INF._tags._tagOne_xtag.doTag(_tagOne_xtag.java:79)
   at pagecompile._nestedTagTest_xjsp._jspService(_nestedTagTest_xjsp.java:54)

Is there anything I can do to work around this?
Thanks
David
Link | Top | Bottom
cpdjh02


Joined: 04/08/11
Posts: 17
RE: ClassCastException when using nested tag files
04/14/11 4:09 PM

I should have used a more illustrative stack trace
java.lang.ClassCastException: com.newatlanta.servletexec.JspPageContextWrapper cannot be cast to com.newatlanta.servletexec.JspPageContext
   at com.newatlanta.servletexec.JspPageContextWrapper.<init>(JspPageContextWrapper.java:41)
   at pagecompile._WEB_INF._tags._nested._tagTwo_xtag.setJspContext(_tagTwo_xtag.java:33)
   at pagecompile._WEB_INF._tags._tagOne_xtag.doTag(_tagOne_xtag.java:62)
   at pagecompile._nestedTagTest_xjsp._jspService(_nestedTagTest_xjsp.java:54)
Link | Top | Bottom
paulbonfanti


Joined: 10/04/07
Posts: 451
RE: ClassCastException when using nested tag files
04/15/11 11:38 AM

You are running into bug #3092 which can be viewed at:

http://www.newatlanta.com/c/auth/support/servletexec/bugtracking/detail?bugId=3092

There's a fix for this is the latest hotfix which can be downloaded from:

http://www.newatlanta.com/c/products/servletexec/download/hotfix/showHotfixes

Note that this bug report describes a different workaround for tags using other tags but you might like the workaround I described better.
Paul Bonfanti, New Atlanta
Link | Top | Bottom
cpdjh02


Joined: 04/08/11
Posts: 17
RE: ClassCastException when using nested tag files
04/15/11 11:43 AM

Thank you Paul.

Is there away to view the bug tracking link with out being assigned as a technical contact on a ServletExec support contract?

Thanks
David
Link | Top | Bottom
paulbonfanti


Joined: 10/04/07
Posts: 451
RE: ClassCastException when using nested tag files
04/15/11 12:04 PM

No I'm afraid not. Here's the workaround described in the bug report:

The most reliable workaround would be to create a TLD file containing
<tag-file> elements, listing the tag files in order of ascending
dependency (list the least dependent tag files first followed by the most
dependent).
Summary:
Ensure that tag files with no references to other tag files are listed first in
the TLD.

Then use <%@ taglib uri="<TLD file>" ...> instead of
<%@ taglib tagdir="<tag directory>" ...>.

That way you can reliably control the order in which SE processes your tag
files.


Another workaround would involve continuing to use tagdir in the taglib
directive, but renaming the .tag files themselves such that their file system
ordering matches the order in which they must be processed (ascending
dependence).

Here's some more detail from the comments section of the bug report:

When SE sees "tagdir" it looks in that directory and processes each
tag file it finds there sequentially.
The natural, file-system, alphabetical ordering of the tag files within a
particular tag directory impacts the order in which SE will process them.

Therefore, if a.tag tries to use b.tag it will fail since b.tag has not yet
been defined. The reverse (b.tag making use of a.tag would work provided you
are running with an SE version that contains this bug fix which will prevent a
ClassCastException).
Paul Bonfanti, New Atlanta
Link | Top | Bottom
cpdjh02


Joined: 04/08/11
Posts: 17
RE: ClassCastException when using nested tag files
04/15/11 12:06 PM

Thanks for all your help Paul.

Dave
Link | Top | Bottom

New Post
Please login to post a response.


company media information terms of use privacy policy contact us
This page was dynamically built on the BlueDragon CFML Engine