Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] JSP issue with embedded jetty

Hi Jan,

This setup that i described actually worked with a brand new project with just these artifacts.
tried to debug further for our application project. I was running this test on the actual project and I guess it was having resolving issues since that project had dependency on geronimo jars too.
Then in actual project, I moved jetty jsp dependencies up the order in eclipse to run it, still got same issue.
Only when I removed
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
from enclosing jsp, then everything got working on the actual project too.

.tag files internally using the 'c' taglib worked fine, just that enclosing jsp having that taglib have this NPE issue

Thanks,
Susmit

On Wed, Aug 31, 2011 at 4:20 PM, Jan Bartel <janb@xxxxxxxxxxx> wrote:
Susmit,

Does it work if you move the jsp out of WEB-INF and into a directory above it?

Jan

On 1 September 2011 05:26, Susmit Shukla <shukla.susmit@xxxxxxxxx> wrote:

Hi,

I'm trying to test JSP tags that are defined as .tag files in my application's WebContent directory. The webproject layout is as follows:
Project
---WebContent
-------WEB-INF
-----------tags
--------------tag1.tag
---------- views
--------------tagTest.jsp

Using standalone jetty, I'm trying to load test jsp. tagTest.jsp is just a wrapper over the tagfile and invokes it using tagdir attribute like:

<%@ taglib prefix="test" tagdir="/WEB-INF/tags" %>
<test:tag1 model="${cat}" />

I have setup the server like this:
        WebAppContext webCtx = new WebAppContext();
        webCtx.setContextPath("/jsptest");
        webCtx.setDescriptor("WebContent/WEB-INF/test-web.xml");

        webCtx.setResourceBase("WebContent");
       
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        contexts.setHandlers(new Handler[] { webCtx });
        server.setHandler(contexts);

I have set up a servlet that forwards the request to test jsp since I was not able to invoke jsp from subdirectory of WebContent directly:
            request.setAttribute("cat", new SomeModel());
            getServletContext().getRequestDispatcher("/WEB-INF/views/tagTest.jsp").forward(request, response);

Invoking this servlet gives following error (also same error if I copy test jsp directly under WebContent and invoke as /jsptest/tagTest.jsp)

org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:634)
    at org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:280)
    at org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:660)
    at org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:91)
    at org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:719)
...

Caused by: java.lang.NullPointerException
    at org.apache.taglibs.standard.tlv.JstlBaseTLV.validate(JstlBaseTLV.java:149)
    at org.apache.taglibs.standard.tlv.JstlCoreTLV.validate(JstlCoreTLV.java:105)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.validate(TagLibraryInfoImpl.java:949)
    at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1921)
    at org.apache.jasper.compiler.Validator.validate(Validator.java:1888)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:223)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)

How to configure JSP with embedded jetty that have tagdir tags? Do I need to have a war if tagdir's are used?
P.S. Regular jsp is getting loaded fine, tag uri is getting resolved correctly:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %> - this works


Thanks,
Susmit


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top