Edited:
my apologies, delete this post if you wish. it was the webserver's fault.
i apologize if this is in the wrong forum, but i believe that it's a syntax problem for the JDBC driver that is causing my program to fail.
Code:java.lang.SecurityException: illegal URL redirect
at sun.plugin.net.protocol.http.HttpUtils.followRedirects(Unknown Source)
at sun.plugin.cache.CachedFileLoader.download(Unknown Source)
at sun.plugin.cache.CachedFileLoader.load(Unknown Source)
at sun.plugin.cache.FileCache.get(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.connectWithCache(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java is trying to access some URL, and since it isn't signed, it will not allow it. i only told it to load files in its own directory, though, so i'm confused. could it be from the sqlite.JDBC driver i'm using? here is my code (in java):
Code:package test;
import java.sql.*;
import java.util.*;
import org.sqlite.JDBC;
import processing.core.*;
public class SQLiteTest extends PApplet {
private static final long serialVersionUID = 1L;
ArrayList tiles = new ArrayList();
int map[][] = new int[9][9];
int charX, charY;
public void setup()
{
charX = charY = 4;
size(288, 288);
background(0);
fill(255);
grabTiles();
grabMap();
}
public void draw()
{
for(int a = 0; a < 9; a++)
for(int b = 0; b < 9; b++)
image((PImage) tiles.get(map[a][b]), b * 32, a * 32);
noLoop();
}
public void grabTiles()
{
try {
String fileName = "curse.s3db";
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+fileName);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from tiles__map");
while(rs.next()){
int id = rs.getInt("image_id");
String desc = rs.getString("image_desc");
String imgFile = rs.getString("image_file");
PImage tmpImage = new PImage();
tmpImage = loadImage(imgFile);
System.out.println(id + ": " + desc);
tiles.add(id, tmpImage);
}
rs.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void grabMap()
{
try {
String fileName = "curse.s3db";
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+fileName);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from map__newbie_zone"
+ " where x >= " + (charX - 4)
+ " and x <= " + (charX + 4)
+ " and y >= " + (charY - 4)
+ " and y <= " + (charY + 4)
+ " order by x asc, y asc");
while(rs.next()){
int x = rs.getInt("x");
int y = rs.getInt("y");
int tile = rs.getInt("tile");
map[x][y] = tile;
}
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
PApplet.main(new String[] { "test.SQLiteTest" });
}
}
Code:package test;
import java.awt.BorderLayout;
import java.awt.Frame;
import processing.core.*;
public class ExampleFrame extends Frame {
private static final long serialVersionUID = 1L;
public ExampleFrame() {
super("Embedded PApplet");
setLayout(new BorderLayout());
PApplet embed = new test.SQLiteTest();
add(embed, BorderLayout.CENTER);
embed.init();
}
}
should i just sign the applet, or is there a way to make sure that it knows that the sqlite db it's loading is file in the applet's directory? i've tried using "./curse.s3db" and loading images as "./"+imgFile ...
i'm just afraid that it's trying to access the s3db file from the client's computer rather than the directory that the .JAR resides in on the server side.
any help is greatly appreciated, as this error has me stumped. i don't see why it has a problem trying to load a file that resides on the server, since i've done plenty of loadImage calls that worked just fine.. that's why i think it has to be the SQLite method, but i am unsure.