hmmm - langsam weiß ich nicht mehr, was ich machen soll.....
Ich habe eine Java-Klasse SprachServer und einen Thread namens SprachServerThread.
Diese sind in den .java-Dateien SprachServer.java und SprachServerThread.java gespeichert.
Die SprachServer.java-Datei sieht so aus:
Die SprachServerThread-Datei sieht wie folgt aus:Code:import java.net.*; import java.io.*; public class SprachServer { private ServerSocket serverSocket = null; private int localPort; private Socket socket = null; private SprachServerThread[] threads = null; static int[] threadsStatus; static Socket[] sockets = null; // main-Methode public static void main(String[] args) throws IOException { //public static void main(String args[]) throws IOException { System.out.println("SprachServer: main() erreicht"); SprachServer ss = null; int locPort = Integer.parseInt(args[0]); ss = new SprachServer(); ss.run(locPort); } // End method main() public void run(int localPort) { SprachServerThread sst = null; boolean listening = true; InetAddress localIPAddress; String localHostName; this.localPort = localPort; threads = new SprachServerThread[25]; threadsStatus = new int[25]; sockets = new Socket[25]; // Tabelle mit Threads initialisieren for (int i = 0; i < 25; i++) { threadsStatus[i] = 0; threads[i] = null; sockets[i] = null; } try { serverSocket = new ServerSocket(localPort); } catch (IOException e) { System.err.println("Could not listen on port: " + localPort); System.exit(-1); } while (listening) { try { socket = serverSocket.accept(); // Suchen freien Thread for (int i = 0; i < 25; i++) { if (threadsStatus[i] == 0) { System.out.println("SprachServer: Versuche neuen Thread zu erstellen (Lfd. Nr.: " + i + ")"); threads[i] = new SprachServerThread(i); System.out.println("SprachServer: Neuen Thread erstellt (Lfd. Nr.: " + i + ")"); threadsStatus[i] = 2; sockets[i] = socket; sst = threads[i]; sst.start(); System.out.println("SprachServer: Thread" + i + " gestartet"); break; } else if (threadsStatus[i] == 1) { threadsStatus[i] = 2; sockets[i] = socket; sst = threads[i]; synchronized(sst) { sst.notify(); } break; } else { } } } catch (IOException e) { System.err.println("Could not listen on port: " + localPort); System.exit(-1); } } // while (listening) try { serverSocket.close(); } catch (IOException e) { System.err.println("Could not close ServerSocket"); System.exit(-1); } }// End run() }
Beim umwandeln und aufrufen auf der QShellCode:import java.net.*; import java.io.*; import java.sql.*; import com.ibm.as400.access.*; public class SprachServerThread extends Thread { private int idx; private Socket socket2 = null; BufferedReader bfrIn = null; private AS400 as400 = null; private String systemName = "System"; private String userid = "User"; private String password = "Password"; // Variablen für Aufruf StoredProcedures private Connection as400Connection = null; // Variablen für Aufruf StoredProcedure LIB/RPGPGM CallableStatement cstmt1 = null; java.sql.ResultSet resultSet = null; private String messageID; private String inputLine, outputLine; private String outputLine39; // Konstruktor public SprachServerThread(int i) { super("SprachServerThread"); as400 = new AS400(systemName, userid, password); idx = i; // Verbindung zur AS/400 für Aufruf StoredProcedures über JDBC-Treiber initialisieren if (as400Connection == null) { // noch keine Verbindung zur AS/400 try { String driver = "com.ibm.as400.access.AS400JDBCDriver"; String connectionURL = "jdbc:as400://systemname"; Class.forName(driver).newInstance(); as400Connection = DriverManager.getConnection(connectionURL, userid, password); } ...
....kommt diese Fehler-MeldungCode:javac SprachServer.java SprachServerThread.java system "CRTJVAPGM CLSF('/home/java/PickByVoice/SprachServer.class') OPTIMIZE(20)" system "CRTJVAPGM CLSF('/home/java/PickByVoice/SprachServerThread.class') OPTIMIZE(20)" java -cp . SprachServer 15010
Irgendwo muß wohl noch der CLASSPATH=/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar gesetzt werden, aber wo?? Ich brauche den ja nur für die SprachServerThread.java-Datei.....Code:SprachServer: main() erreicht SprachServer: Versuche neuen Thread zu erstellen (Lfd. Nr.: 0) java.lang.NoClassDefFoundError: com/ibm/as400/access/AS400 at java.lang.Throwable.<init>(Throwable.java:195) at java.lang.Error.<init>(Error.java:49) at java.lang.NoClassDefFoundError.<init>(NoClassDefFoundError.java:40) at SprachServerThread.<init>(SprachServerThread.java:37) at SprachServer.run(SprachServer.java:67) at SprachServer.main(SprachServer.java:28)
![[NEWSboard IBMi Forum]](images/duke/nblogo.gif)



Mit Zitat antworten
Bookmarks