Hallo,
ich bin jetzt schon zwei Tage dran, das Problem zu lösen aber ich komme nicht auf den Fehler drauf. Ich habe davor Webservices in einer anderen Programmiersprache geschrieben. Wahrscheinlich habe ich etwas in der Java-Logik noch nicht ganz verstanden.
Der Client serialisiert das Objekt mit den ArrayLists und benutzerdefinierten Klassen und sendet das Objekt an den Server. Der Handler greift aber der Request-InputStream dürfte null sein. Was mache ich falsch?
Client-Seite:
Server:
Fehler:
java.io.EOFException
at java.ibjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.ibjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.ibjectInputStream.readStreamHeader(Unknown Source)
at java.ibjectInputStream.<init>(Unknown Source)
at Classes.HelloHandler.handle(HelloHandler.java:63)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:61)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
null
ich bin jetzt schon zwei Tage dran, das Problem zu lösen aber ich komme nicht auf den Fehler drauf. Ich habe davor Webservices in einer anderen Programmiersprache geschrieben. Wahrscheinlich habe ich etwas in der Java-Logik noch nicht ganz verstanden.
Der Client serialisiert das Objekt mit den ArrayLists und benutzerdefinierten Klassen und sendet das Objekt an den Server. Der Handler greift aber der Request-InputStream dürfte null sein. Was mache ich falsch?
Client-Seite:
Java:
public static PrimaryOutput SendPrimary(String _URL, Input INPUT, String urlParameters)
{
try
{
URLConnection connection = new URL(_URL).openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/octet-stream");
ObjectOutputStream oos = new ObjectOutputStream(connection.getOutputStream());
oos.writeObject(INPUT);
oos.close();
ObjectInputStream ois = new ObjectInputStream(connection.getInputStream());
boolean readBoolean = ois.readBoolean();
ois.close();
System.out.println(readBoolean);
}
catch (Exception ex)
{
}
// später Output zurück
return null;
}
Server:
Java:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
try
{
InputStream in = request.getInputStream();
ObjectInputStream oI = new ObjectInputStream(in);
MainInput.Input INP = (MainInput.Input)oI.readObject();
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
//Keine Ahnung warum EOF unknown source; Läuft auf dem localhost
}
Fehler:
java.io.EOFException
at java.ibjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.ibjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.ibjectInputStream.readStreamHeader(Unknown Source)
at java.ibjectInputStream.<init>(Unknown Source)
at Classes.HelloHandler.handle(HelloHandler.java:63)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:61)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
null
Zuletzt bearbeitet: