Bug 30258 - java.lang.IllegalStateException: can't declare any more prefixes in this context
Summary: java.lang.IllegalStateException: can't declare any more prefixes in this context
Status: RESOLVED INVALID
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.0
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-22 12:35 UTC by Krishna Kumar.C
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 
context

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?

Cheers
kk
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-
14T14:38:08\"/> 

Any body knows why this is happening?
Cheers
kk 
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 
dignosis
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" %>
<html> 
 <head>
  <title>XML Test</title>
 </head>
 <body bgcolor="white">
  <center>
  <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}" />   
  </center>
 </body>
</html>

The xml to parse:

<?xml version="1.0"?>
<note>
 <to>Pete</to>
 <from>Franco</from>
 <heading>Example</heading>
 <body>My JSP XML transformation!</body>
</note>

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%">
     <tr>
      <td>From:</td>
      <td><xsl:value-of select="from"/></td>
     </tr>
     <tr>
      <td>To:</td>
      <td><xsl:value-of select="to"/></td>
     </tr>
     <tr>
      <td>Title:</td>
      <td><xsl:value-of select="heading"/></td>
     </tr>
     <tr>
      <td>Message:</td>
      <td><xsl:value-of select="body"/></td>
     </tr>
   </table>
  </xsl:template>
</xsl:stylesheet>

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:

http://www.apache.org/dyn/closer.cgi/xml/xalan-j

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

xalan.jar
xercesImpl.jar
xml-apis.jar

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,

Adding 

xalan.jar
xercesImpl.jar
xml-apis.jar

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