Bug 30258

Summary: java.lang.IllegalStateException: can't declare any more prefixes in this context
Product: Taglibs Reporter: Krishna Kumar.C <ckri>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Severity: critical CC: mike.skells
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Krishna Kumar.C 2004-07-22 12:35:25 UTC
Dear All,
I am using JSTL transform tag to transform the xml using XSLT.
I am using the following code:
<c:import url="/resources/homepages/syncdiff/xsl/syncdiff.xsl" var="xslt"/>
<x:transform xml="${adapterUDMVar}" xslt="${xslt}" />
and the xml used is as given below :
<UDM xmlns="http://www.cramer.com/udm" versionNumber="1.0" generatedBy="Netman 
Aps" source="ResourceManager" UDMDateTime="2004-07-14T14:38:08"/>

I am getting the following error:
java.lang.IllegalStateException: can't declare any more prefixes in this 

but this error goes if I remove the xmlns:udm="http://www.cramer.com/udm" 
attribute from UDM tag. 

Could anyone tell me what could be the problem?

Comment 1 Krishna Kumar.C 2004-07-22 13:07:59 UTC
Please note that if I provide the xml via a <c:set tag it works

<c:set var="adapterUDMVar" value="<UDM xmlns=\"http://www.cramer.com/udm\" 
xmlns:udm=\"http://www.cramer.com/udm\" versionNumber=\"1.0\" 
generatedBy=\"Netman Aps\" source=\"ResourceManager\" UDMDateTime=\"2004-07-

Any body knows why this is happening?
Comment 2 Mike Skells 2004-07-22 13:14:53 UTC
I get a similar error in tomcat 5 when parsing some XML files. 

They work OK in tomcat 4.0 (same machine, jvm, webapp etc)

I havnt had a chance to chase this further, but this may help someone elses 
Comment 3 Jan Pernica 2004-08-26 12:19:16 UTC
The same for me. But one think: If I start the tomcat as the service, I get the
specified error. When I start it using startup.bat everythink is working OK.

The error is:
java.lang.IllegalStateException: can't declare any more prefixes in this context
	at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
	at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
	at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
Comment 4 Felipe Leme 2004-09-28 03:06:33 UTC
This is a JSTL/Standard issue, not XTags.

Anyway, could you please provide more info, like with version of Standard and
Tomcat you are using, the JDK version, the URI for the URL and what do you have
on WEB-INF/lib? This looks like an XML parsing issue...

-- Felipe
Comment 5 Franco Skrzypczak 2004-09-28 14:09:00 UTC
I have two taglib includes at the top of my JSP.  One for the jstl core and one
for jstl xml.  When I try the transformation I get a similair error
(java.lang.IllegalStateException: can't declare any more prefixes in this
context) .  When I remove one of the taglibs I get a different error.  

I am running tomcat 5.0.28 on the Java SDK 1.4.2_05 on windows.  Tomcat is
running as a service. 

Here is an example of the jsp:

<%@ page language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
  <title>XML Test</title>
 <body bgcolor="white">
  <c:import url="http://localhost:8080/jsp-examples/test/note.xml" var="myxml" />
  <c:import url="http://localhost:8080/jsp-examples/test/note.xsl" var="myxslt" />
  <x:transform xml="${myxml}" xslt="${myxslt}" />   

The xml to parse:

<?xml version="1.0"?>
 <body>My JSP XML transformation!</body>

And finally the xslt:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="note">
   <table border="0" width="50%">
      <td><xsl:value-of select="from"/></td>
      <td><xsl:value-of select="to"/></td>
      <td><xsl:value-of select="heading"/></td>
      <td><xsl:value-of select="body"/></td>

Within my WEB-INF/lib folder I only have two jars, namely jslt.jar and standard.jar

Comment 6 Kris Schneider 2004-09-28 15:19:02 UTC
Try installing the latest version of Xalan (2.6.0, I believe) in
$CATALINA_HOME/common/endorsed. You can get Xalan from:


Make sure to also install the version of Xerces that is included with Xalan. So,
$CATALINA_HOME/common/endorsed should have:


All those JAR files should come from the Xalan version you download.
Comment 7 Franco Skrzypczak 2004-09-30 08:14:33 UTC
Thanks Kris,



To the commons/endorsed folder solved the problem..

Comment 8 Kris Schneider 2004-09-30 11:47:13 UTC
Resolving as INVALID since it appears to be working as expected with appropriate
versions of Xerces and Xalan.
Comment 9 Paul R. Brown 2004-10-16 03:42:12 UTC
This may actually be a bad SAX hygeine issue; fiddling with library versions may
just be getting you to an older and more permissive version of SAX.

See http://blogs.fivesight.com/pbblog/index.php?p=45