[Jetty-support] what is tagPlugins.xml for? (was Re: [newbie] making jstl to work when jetty is run programatically)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Jetty-support] what is tagPlugins.xml for? (was Re: [newbie] making jstl to work when jetty is run programatically)

MMan
I have received no answers, but I tried to dig it a little bit more on my own. Not very successful, to be honest.
 
Anyway, after activating all possible logs I have seen that jetty was looking for tagPlugins.xml, without finding it. I have added the file, taken from jsp-examples.war
 
Now I get a NullPointerException executing the jsp:

EXCEPTION
org.apache.jasper.JasperException
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
 at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:666)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
 at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
 at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
 at org.mortbay.http.HttpServer.service(HttpServer.java:954)
 at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
 at org.mortbay.http.HttpConnection.handleNext (HttpConnection.java:983)
 at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
 at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
 at org.mortbay.util.ThreadedServer.handle (ThreadedServer.java:357)
 at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
/servletspike/jsp/jstl.jsp:
java.lang.NullPointerException
 at org.apache.jsp.jsp.jstl_jsp._jspService(jstl_jsp.java:228)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java :324)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java :689)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
 at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:666)
 at org.mortbay.jetty.servlet.ServletHandler.handle( ServletHandler.java:568)
 at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
 at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
 at org.mortbay.http.HttpServer.service(HttpServer.java:954)
 at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
 at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
 at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
 at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
 at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
 at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
/servletspike/jsp/jstl.jsp:
java.lang.NullPointerException
 at org.apache.jsp.jsp.jstl_jsp._jspService(jstl_jsp.java:228)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
 at javax.servlet.http.HttpServlet.service( HttpServlet.java:689)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
 at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:236)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
 at org.mortbay.jetty.servlet.ServletHandler.dispatch (ServletHandler.java:666)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
 at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
 at org.mortbay.http.HttpContext.handle(HttpContext.java :1517)
 at org.mortbay.http.HttpServer.service(HttpServer.java:954)
 at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
 at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
 at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
 at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
 at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
 at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

The jsp is as simple as the following:

<%@ page import="java.util.*" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
       prefix="c" %>
      
<%! private List list = new ArrayList(); %>
<% list.add(1); list.add(2); list.add(3); %>

<HTML>
<HEAD><TITLE>JSTL</TITLE></HEAD>
<BODY>
    <c:forEach var="item" begin="1" end="10">
        <c:out value="${item}"/>
    </c:forEach>
   
 <UL>
 <c:out value="${1 + 2 + 3}"/>
 <c:out value="${list.size()}"/>
 <c:forEach var="elem" items="${list}">
     <LI> <c:out value="${elem}"/> </LI>
 </c:forEach>
 </UL>
</BODY>
</HTML>

The jsp is compiled.
 
I am confused. Can anybody help me, please?!?
TIA

 
On 11/28/05, Manlio Malaidini <[hidden email]> wrote:
Hi!

I'm still experimenting and I cannot understand how to make jstl to work.

I'm using Jetty 5.1.5rc2. I'm running jetty through the following main:

    public static void main(String[] args) throws Exception
    {
        HttpServer server = new HttpServer();
        server.addListener(":8080");
       
        HttpContext context = new HttpContext();
        context.setContextPath("/");
        ServletHandler servletHandler = new ServletHandler();
        servletHandler.addServlet("jsp", "*.jsp", " org.apache.jasper.servlet.JspServlet");
        servletHandler.addServlet("Invoker", "servlet/*", "org.mortbay.jetty.servlet.Invoker");
        context.addHandler(servletHandler);
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setDirAllowed(true);
        context.addHandler(resourceHandler);
        context.setResourceBase("./");
        server.addContext(context);
       
        server.start();
    }

I have jstl.jar and standard.jar in my WEB-INF.lib but if I invoke a jsp like the following:

<%@ page import="java.util.*" %>

<%@ taglib uri="<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://java.sun.com/jsp/jstl/core" target="_blank"> http://java.sun.com/jsp/jstl/core"
       prefix="c" %>
      
<%! private List list = new ArrayList(); %>
<% list.add(1); list.add(2); list.add(3); %>

<HTML>
<HEAD><TITLE>JSTL</TITLE></HEAD>
<BODY>
    <c:forEach var="item" begin="1" end="10">
        <c:out value="${item}"/>
    </c:forEach>
   
    <UL>
    <c:out value="${list.size()}"/>
    <c:forEach var="elem" items="${list}">
        <LI> <c:out value="${elem}"/> </LI>
    </c:forEach>
    </UL>
</BODY>
</HTML>
 

I get:
${item} ${item} ${item} ${item} ${item} ${item} ${item} ${item} ${item} ${item}
    ${list.size()}
  • ${elem}

It seems that it cannot evaluate variables in context, giving me their literals and not their actual values.

What am I doing wrong? It got to be stupid, I guess, but I wasn't able to solve it after browsing the archives, searching <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mortbay.org/" target="_blank">mortbay.org, etc.

Thanks a lot
MM

Reply | Threaded
Open this post in threaded view
|

Re: what is tagPlugins.xml for? (was Re: [newbie] making jstl to work when jetty is run programatically)

Greg Wilkins-5

Can you try using a webapplicationcontext and webapplication handler?
You should not use SErvletHandler directly if you are using a webapp structure
with WEB-INF etc.  There are classloader and resource expectations that JSP has
to find the tag information in WEB-INF that will be setup by a webapp handler.

in fact, can you try just using the standard jetty.xml with your webapplication
in the webapp directory.  

See if you can get it working normally before trying to configure programatically.

regards



Manlio Malaidini wrote:

> I have received no answers, but I tried to dig it a little bit more on
> my own. Not very successful, to be honest.
>  
> Anyway, after activating all possible logs I have seen that jetty was
> looking for tagPlugins.xml, without finding it. I have added the file,
> taken from jsp-examples.war
>  
> Now I get a NullPointerException executing the jsp:
>
>     EXCEPTION
>     org.apache.jasper.JasperException
>      at
>     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
>      at
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>      at
>     org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
>      at
>     org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:666)
>      at
>     org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
>      at org.mortbay.http.HttpServer.service(HttpServer.java:954)
>      at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
>      at org.mortbay.http.HttpConnection.handleNext (HttpConnection.java:983)
>      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
>      at
>     org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
>      at org.mortbay.util.ThreadedServer.handle (ThreadedServer.java:357)
>      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>     /servletspike/jsp/jstl.jsp:
>     java.lang.NullPointerException
>      at org.apache.jsp.jsp.jstl_jsp._jspService(jstl_jsp.java:228)
>      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>      at
>     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
>     :324)
>      at
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java :689)
>      at
>     org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
>      at
>     org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:666)
>      at org.mortbay.jetty.servlet.ServletHandler.handle(
>     ServletHandler.java:568)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
>      at org.mortbay.http.HttpServer.service(HttpServer..java:954)
>      at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
>      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
>      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
>      at
>     org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
>      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>     /servletspike/jsp/jstl.jsp:
>     java.lang.NullPointerException
>      at org.apache.jsp.jsp.jstl_jsp._jspService(jstl_jsp.java:228)
>      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>      at javax.servlet.http.HttpServlet.service( HttpServlet.java:689)
>      at
>     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
>      at
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>      at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:236)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>      at
>     org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
>      at org.mortbay.jetty.servlet.ServletHandler.dispatch
>     (ServletHandler.java:666)
>      at
>     org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java :1517)
>      at org.mortbay.http.HttpServer.service(HttpServer.java:954)
>      at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
>      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
>      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
>      at
>     org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
>      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>
> The jsp is as simple as the following:
>
>     <%@ page import="java.util.*" %>
>
>     <%@ taglib uri="http://java.sun.com/jsp/jstl/core"
>            prefix="c" %>
>          
>     <%! private List list = new ArrayList(); %>
>     <% list.add(1); list.add(2); list.add(3); %>
>
>     <HTML>
>     <HEAD><TITLE>JSTL</TITLE></HEAD>
>     <BODY>
>         <c:forEach var="item" begin="1" end="10">
>             <c:out value="${item}"/>
>         </c:forEach>
>        
>      <UL>
>      <c:out value="${1 + 2 + 3}"/>
>      <c:out value="${list.size()}"/>
>      <c:forEach var="elem" items="${list}">
>          <LI> <c:out value="${elem}"/> </LI>
>      </c:forEach>
>      </UL>
>     </BODY>
>     </HTML>
>
> The jsp is compiled.
>  
> I am confused. Can anybody help me, please?!?
> TIA
>
>  
> On 11/28/05, *Manlio Malaidini* <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi!
>
>     I'm still experimenting and I cannot understand how to make jstl to
>     work.
>
>     I'm using Jetty 5.1.5rc2. I'm running jetty through the following main:
>
>         public static void main(String[] args) throws Exception
>         {
>             HttpServer server = new HttpServer();
>             server..addListener(":8080");
>            
>             HttpContext context = new HttpContext();
>             context.setContextPath("/");
>             ServletHandler servletHandler = new ServletHandler();
>             servletHandler.addServlet("jsp", "*.jsp", "
>     org.apache.jasper.servlet.JspServlet");
>             servletHandler.addServlet("Invoker", "servlet/*",
>     "org.mortbay.jetty.servlet.Invoker");
>             context.addHandler(servletHandler);
>             ResourceHandler resourceHandler = new ResourceHandler();
>             resourceHandler.setDirAllowed(true);
>             context.addHandler(resourceHandler);
>             context.setResourceBase("./");
>             server.addContext(context);
>            
>             server.start();
>         }
>
>     I have jstl.jar and standard.jar in my WEB-INF.lib but if I invoke a
>     jsp like the following:
>
>     <%@ page import="java.util.*" %>
>
>     <%@ taglib uri=" http://java.sun.com/jsp/jstl/core"
>            prefix="c" %>
>          
>     <%! private List list = new ArrayList(); %>
>     <% list.add(1); list.add(2); list.add(3); %>
>
>     <HTML>
>     <HEAD><TITLE>JSTL</TITLE></HEAD>
>     <BODY>
>         <c:forEach var="item" begin="1" end="10">
>             <c:out value="${item}"/>
>         </c:forEach>
>        
>         <UL>
>         <c:out value="${list.size()}"/>
>         <c:forEach var="elem" items="${list}">
>             <LI> <c:out value="${elem}"/> </LI>
>         </c:forEach>
>         </UL>
>     </BODY>
>     </HTML>
>      
>
>     I get:
>     ${item} ${item} ${item} ${item} ${item} ${item} ${item} ${item}
>     ${item} ${item}
>
>         * ${list.size()} ${elem}
>
>
>     It seems that it cannot evaluate variables in context, giving me
>     their literals and not their actual values.
>
>     What am I doing wrong? It got to be stupid, I guess, but I wasn't
>     able to solve it after browsing the archives, searching mortbay.org
>     <http://mortbay.org/>, etc.
>
>     Thanks a lot
>     MM
>
>



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support