Tuesday, December 12, 2006

According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Keywords:
Compile JSP tomcat JSTL error "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"

Problem:
Compile error from tomcat when it encounters a JSP: "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"

Solution:
For some reason the JSP is using the 1.2 JSP (and 1.0 JSTL) and EL expressions aren't understood. There's a lot of hits on the web for this but in summary there are 2 important things to do to ensure you're getting the right version of the spec:
  1. Reference the correct servlet specification in your deployment descriptor:
    <?xml version="1.0"?>
    <web-app version="2.4"
     xmlns="http://java.sun.com/xml/ns/j2ee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  2. Reference the correct JSTL uri in your JSP:
    change
    <%@ taglib uri='http://java.sun.com/jstl/core' prefix='c'%>

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

Notes:


What Specification goes with what?
Web-app(deployment schema)2.32.42.5
http://java.sun.com/dtd/web-app_2_3.dtdhttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsdhttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
Servlet2.32.42.5
JSP1.22.02.1
JSTL(core uri reference)1.01.11.2
http://java.sun.com/jstl/corehttp://java.sun.com/jsp/jstl/corehttp://java.sun.com/jsp/jstl/core
Tomcat4.x5.x6.x
WebSphere5.x6.x7.x (?)

Friday, December 08, 2006

WebSphere DTMConfigurationException: No default implementation found

Keywords:
WebSphere DTMConfigurationException DTMManager xalan 6.0.2.11

Problem:After upgrading the WebSphere Application Server JDK with the .11 Fix pack (making it 6.0.2.11) there is the following error when my web app. tries to get a transformer:
org.apache.xml.dtm.DTMConfigurationException: No default implementation found
    at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:177)
    at org.apache.xpath.XPathContext.(XPathContext.java:125)
    at org.apache.xalan.transformer.TransformerImpl.(TransformerImpl.java:398)
    at org.apache.xalan.templates.StylesheetRoot.newTransformer(StylesheetRoot.java:197)

Solution:
The problem seems to be at least associated with the fix pack creating a new file "xalan.properties" in APPSERVER_HOME\java\jre\lib. It could also be upgrading the xalan libraries as well (in xml.jar).

Edit this file - you'll notice this isn't defining any properties, everything is commented out - and add the property:
org.apache.xml.dtm.DTMManager=org.apache.xml.dtm.ref.DTMManagerDefault


Notes:
Alternatively, remove or rename this file and the problem should also go away.

Alternatively again, add the JVM system property "org.apache.xml.dtm.DTMManager". You can do this on WebSphere by going to:
Application servers > server1 > Process Definition > Java Virtual Machine
... and adding to the Generic JVM arguments:
-Dorg.apache.xml.dtm.DTMManager=org.apache.xml.dtm.ref.DTMManagerDefault

Restart the server and the problem should also go away - use this approach for where you don't have access to the APPSERVER_HOME\java\jre\lib files and can only configure your application's JVM.