S
Steve R. Burrus
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)
java.lang.NullPointerException
at com.steven.burris.LaundryGirl.doGet(LaundryGirl.java: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.internalDoFilter(Appl
icationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:214)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
..........."<<
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();
}"<<
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)
java.lang.NullPointerException
at com.steven.burris.LaundryGirl.doGet(LaundryGirl.java: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.internalDoFilter(Appl
icationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:214)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
..........."<<
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();
}"<<