Yes, I need some help/assistance with always getting this particular
servlet error exception when I try to execute an image servlet! Can
someone help me? (And look below the error msg. for the file itself)
>>"SEVERE: Servlet.service() for servlet MyLuciousGirl threw exception
java.lang.NullPointerException
at com.steven.burris.LaundryGirl.doGet(LaundryGirl.ja va:24)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(Appl
icationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationF
ilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperV
alve.java:214)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextV
alve.java:17

at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.j
ava:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.j
..........."<<
>>"package com.steven.burris;
import java.io.*;
import java.awt.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class LaundryGirl extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException {
resp.setContentType("image/jpeg");
ServletContext sc = getServletContext ();
InputStream is = sc.getResourceAsStream("/MyBeautifulGirl.jpg");
int read = 0;
byte[] bytes = new byte[1024];
OutputStream os = resp.getOutputStream();
while( ( read = is.read(bytes)) != -1){
os.write(bytes, 0, read);
}
os.flush();
os.close();
}"<<