Here's record from log file:
[#|2008-04-16T23:12:27.093+0200|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=14;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=5040cd17-ef00-418e-bff0-c4f1eb134f37;|java.io.IOException
at javax.microedition.lcdui.ImmutableImage.<init>(Image.java:434)
at javax.microedition.lcdui.Image.createImage(Image.java:214)
at Reklama.processRequest(Reklama.java:68)
at Reklama.doGet(Reklama.java:155)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
|#]
And here's the servlet code:
import javax.microedition.lcdui.Image;
public class Reklama extends HttpServlet
{
public Image processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String dbURL = "jdbc:derby://localhost:1527/test1;create=true;user=matjaz;password=test";
Connection conn = null;
Statement stmt = null;
conn=Auth.createConnection(dbURL);
try
{
String tip=request.getParameter("type".toString());
String mobile=request.getParameter("mobile".toString());
if(mobile!=null)
{
if(mobile.equals("yes"))
{
byte imgbyte[] = null;
String podatki="";
ResultSet results;
stmt=conn.createStatement();
String kveri="select tekst,slika,url from reklama where tip='"+tip+"' order by random()";
results=stmt.executeQuery(kveri);
results.next();
String tekst,slika,url;
tekst=results.getString(1);
slika=results.getString(2);
url=results.getString(3);
String pot=slika;
Image img = null;
img.createImage(pot);
return img;
}
}
ResultSet results;
stmt=conn.createStatement();
String kveri="select tekst,slika,url from reklama where tip='"+tip+"' order by random()";
results=stmt.executeQuery(kveri);
results.next();
String tekst,slika,url;
tekst=results.getString(1);
slika=results.getString(2);
url=results.getString(3);
out.println("<html>");
out.println("<head>");
out.println("<title>Reklama</title>");
out.println("</head>");
out.println("<body>");
out.println(tekst+"<br>");
out.println("<img src='"+"../Servlet1"+slika+"'><br>");
out.println("<a href='"+url+"'>"+url+"</a>");
out.println("</body>");
out.println("</html>");
Auth.closeConnection(conn, stmt, dbURL);
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
out.close();
}
return null;
}
I hope someone can help me solve this, it's driving me crazy. Been working on that for about 6hours today and couldn't figure it out.
[Message sent by forum member 'depy' (depy)]
http://forums.java.net/jive/thread.jspa?messageID=269585