Custom taglibs calls "PWC6033: Unable to compile class for JSP"

When I try to use custom taglib in my webapp, it does not work on OS X (or Windows) using Eclipse and Run Jetty Run. When I run the files and run them on my Linux server running apache-tomcat-6.0.20, there are no problems. I use third-party custom taglib with no problems in both environments.

org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP

PWC6197: An error occurred at line: 6 in the jsp file: /temp.jsp
PWC6199: Generated servlet error:
com.test cannot be resolved to a type
 at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:107)
 at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:280)
 at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:350)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:411)
 ...

Custom taglib tld looks like

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC 
 "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
 "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
 <tlib-version>1.0</tlib-version>
 <jsp-version>2.0</jsp-version>
 <short-name>test</short-name>
 <uri>http://test.com/test.tld</uri>
 <description>Test</description>

 <tag>
  <name>custom</name>
  <tag-class>com.test.CustomTag</tag-class>
  <body-content>empty</body-content>
  <description>Custom tag</description>
 </tag>
</taglib>

And the tag handler

package com.test;

import javax.servlet.jsp.tagext.TagSupport;

public class CustomTag extends TagSupport {

 private static final long serialVersionUID = 1L;

}

And finally temp.jsp

<%@ taglib uri="http://test.com/test.tld" prefix="test" %>
Hi
<test:custom/>

I think my taglib definition / configuration is correct as it all works when deployed to tomcat, but I tried all day to do this work in Jetty to no avail.

+3
source share
3 answers

SOOOOOOOOOOO !!!! , , - , , , . , Jetty.

Test com. - Jetty com.test.CustomTag , , com.Test? , CustomTag ( com.Test) .

+1

. My eclipse . Jetty , . maven .

2 , . 1. mvn clean 2. mvn install -DskipTests

+1

. Jetty, - (no taglib)

- (10 10:45 0:45). . , .

Eclipse . Junit . "mvn test" PWC6033, . , .

jetty/maven, .

, /WEB -INF/tags/ognl.tag

<%@tag import="de.mypackage.WebUtils"
%><%@tag body-content="empty"
%><%@attribute name="value" required="true"
%><%=WebUtils.ognl(request, value)%>

WebUtils HttpServletRequest , .

0

Source: https://habr.com/ru/post/1753967/


All Articles