JSPs with custom components will not compile

All,

I have written a custom component, but am having trouble getting it to work. When i place it in a jsp or jspx and try to run the application using this control, i get compilation errors:

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

Generated servlet error:

[javac] C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java:2053: cannot find symbol

[javac] symbol : method setPageContext(javax.servlet.jsp.PageContext)

[javac] location: class cpidemo.wpfRenderer

[javac]_jspx_th_cpi_wpf_0.setPageContext(_jspx_page_context);

[javac]^

Generated servlet error:

[javac] C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java:2054: cannot find symbol

[javac] symbol : method setParent(javax.servlet.jsp.tagext.Tag)

[javac] location: class cpidemo.wpfRenderer

[javac]_jspx_th_cpi_wpf_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_webuijsf_panelLayout_2);

[javac]^

Generated servlet error:

[javac] C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java:2063: cannot find symbol

[javac] symbol : method doStartTag()

[javac] location: class cpidemo.wpfRenderer

[javac]int _jspx_eval_cpi_wpf_0 = _jspx_th_cpi_wpf_0.doStartTag();

[javac] ^

Generated servlet error:

[javac] C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java:2064: cannot find symbol

[javac] symbol : method doEndTag()

[javac] location: class cpidemo.wpfRenderer

[javac]if (_jspx_th_cpi_wpf_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {

[javac]^

Generated servlet error:

[javac] C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java:2065: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (cpidemo.wpfRenderer)

[javac]_jspx_tagPool_cpi_wpf_ttlValue_rendered_paramList_formWidth_formScript_formName_formHeight_detID_nobody.reuse(_jspx_th_cpi_wpf_0);

[javac] ^

Generated servlet error:

[javac] C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java:2068: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (cpidemo.wpfRenderer)

[javac]_jspx_tagPool_cpi_wpf_ttlValue_rendered_paramList_formWidth_formScript_formName_formHeight_detID_nobody.reuse(_jspx_th_cpi_wpf_0);

[javac]^

Generated servlet error:

[javac] Note: C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java uses unchecked or unsafe operations.

Generated servlet error:

[javac] Note: Recompile with -Xlint:unchecked for details.

[javac] 6 errors

at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:94)

at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:384)

at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:461)

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:528)

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)

at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)

at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:850)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:697)

at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:532)

at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:465)

at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:353)

at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:413)

at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:480)

at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:125)

at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)

at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)

at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)

at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)

at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)

at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)

at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)

at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)

at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

After fighting with this for a while, I tried the following:

1) Copy code from a known-working example into the existing web app

2) Copy the code for the component et al into the known working example app

results:

1) Known working component generates the same compilation errors

2) everything work correctly

I have compared the tlds and faces-config.xml files and everything appears to be correct. In both cases, the faces-config.xml files are at version 1.2 and the tlds are at version 2.1

The only difference i can see is that the not-working web app uses far more libraries than the working example, though i'm not sure why this would be a problem.

From the not working webapp:

faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"

version="1.2">

<!-- Set default locale and add supported locales here...

<application>

<locale-config>

<default-locale>en</default-locale>

<supported-locale>de</supported-locale>

<supported-locale>fr</supported-locale>

<supported-locale>es</supported-locale>

</locale-config>

</application>

-->

<component>

<description>A wrapper for workplace forms viewer</description>

<display-name>Embedded Form Viewer</display-name>

<component-type>cpidemo.wpfRenderer</component-type>

<component-class>cpidemo.wpfRenderer</component-class>

</component>

</faces-config>

cpi.tld

<?xml version="1.0" encoding="UTF-8"?>

<taglib version="2.1" 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 web-jsptaglibrary_2_1.xsd">

<tlib-version>1.0</tlib-version>

<short-name>cpi</short-name>

<uri>http://www.etechway.com/cpi</uri>

<!-- A validator verifies that the tags are used correctly at JSP

translation time. Validator entries look like this:

<validator>

<validator-class>com.mycompany.TagLibValidator</validator-class>

<init-param>

<param-name>parameter</param-name>

<param-value>value</param-value>

</init-param>

</validator>

-->

<!-- A tag library can register Servlet Context event listeners in

case it needs to react to such events. Listener entries look

like this:

<listener>

<listener-class>com.mycompany.TagLibListener</listener-class>

</listener>

-->

<tag>

<name>wpf</name>

<tag-class>cpidemo.wpfRenderer</tag-class>

<body-content>empty</body-content>

<attribute>

<description>A value binding that points to a bean property</description>

<name>binding</name>

<deferred-value>

<type>javax.faces.component.UIComponent</type>

</deferred-value>

</attribute>

<attribute>

<name>formName</name>

<required>true</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>String</type>

</deferred-value>

</attribute>

<attribute>

<name>rendered</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>boolean</type>

</deferred-value>

</attribute>

<attribute>

<name>formScript</name>

<required>true</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>String</type>

</deferred-value>

</attribute>

<attribute>

<name>detID</name>

<required>true</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>String</type>

</deferred-value>

</attribute>

<attribute>

<name>ttlValue</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>String</type>

</deferred-value>

</attribute>

<attribute>

<name>formHeight</name>

<required>true</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>String</type>

</deferred-value>

</attribute>

<attribute>

<name>formWidth</name>

<required>true</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>String</type>

</deferred-value>

</attribute>

<attribute>

<name>paramList</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

<deferred-value>

<type>String</type>

</deferred-value>

</attribute>

</tag>

</taglib>

can anyone give me a nudge in the right direction here?

Thanks in advance!!

[13151 byte] By [losheaa] at [2007-11-27 10:45:27]
# 1

[javac] C:\Sun\SDK\domains\domain1\generated\jsp\j2ee-modules\CPIDemo\org\apache\jsp\cpiMain_jsp.java:2053: cannot find symbol

[javac] symbol : method setPageContext(javax.servlet.jsp.PageContext)

[javac] location: class cpidemo.wpfRenderer

[javac] _jspx_th_cpi_wpf_0.setPageContext(_jspx_page_context);

[javac] ^

Assuming cpidemo.wpfRenderer is your class, does it have the method referenced above?

RaymondDeCampoa at 2007-7-28 20:13:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

No, I have not implemented those methods. The examples and tutorials i'm working with make no mension of them. And, as I said, the code I wrote worked within an example downloaded from corejsf. I was able to get that example working. Unfortunatly, when i moved the example code into my project, along with tld and faces-config entries, the example code begins issuing the same errors. Not really sure what else to try.

losheaa at 2007-7-28 20:13:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

The only setPageContext() method I see that is directly relevant to JSF is in UIComponentClassicTagBase. Do your tags extend from this class directly or indirectly?

RaymondDeCampoa at 2007-7-28 20:13:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I believe they extend this indirectly. I'm using UIOutput as the base class for my own component

losheaa at 2007-7-28 20:13:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...