Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

java RMI pravljenje cet aplikacije

[es] :: Java :: java RMI pravljenje cet aplikacije

[ Pregleda: 669 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

dzstef

Član broj: 330981
Poruke: 1
37.203.118.*



Profil

icon java RMI pravljenje cet aplikacije24.10.2015. u 17:37 - pre 44 meseci
pozdrav svima,

bio bih zahvalan ako bi mi neko pomogao da resim sledeci problem

Ono sto zelim da napravim je klijent server cet aplikacija na web-u. koristim RMI.

server interface:

public interface ChatServerIF extends Remote {
//void registerChatClient(ChatClientIF chatClient) throws RemoteException;
//void broadcastMessage(String message) throws RemoteException;
void registerClient(String ime, ChatClientIF chatKlijent) throws RemoteException;
void posaljiPoruku(String ime, String poruka) throws RemoteException;
void dodajWeb(String naziv, PrintWriter print) throws RemoteException;
void pronadjiWeb(String naziv) throws RemoteException;
}

server class:

public class ChatServer extends UnicastRemoteObject implements ChatServerIF {
public static final long serialVersionUID = 1L;
private HashMap<String, ChatClientIF> hmap = new HashMap<String, ChatClientIF>();
private Map<String, PrintWriter> web = new HashMap<String, PrintWriter>();
public List<HttpServletResponse> lista = new ArrayList<HttpServletResponse>();
public ChatServer() throws RemoteException{
//chatClients = new ArrayList<ChatClientIF>();
}
@Override
public synchronized void dodajWeb(String naziv, PrintWriter print) throws RemoteException{
web.put(naziv, print);
}
@Override
public void pronadjiWeb(String naziv) throws RemoteException {
//JspWriter pisi = web.get(naziv);
}

deo servleta:

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet IgraServlet</title>");
out.println("</head>");
out.println("<body>");
String username = request.getParameter("username");
ChatServerIF chat = (ChatServerIF) request.getSession().getAttribute("server");
ChatClient cc = (ChatClient) request.getSession().getAttribute("klijent");
//ChatServer cs = (ChatServer) request.getSession().getAttribute("cs");
PrintWriter pw = (PrintWriter) request.getSession().getAttribute("out");
chat.dodajWeb(username, pw);
cc.run();
out.println("aaa");

out.println("<h1>Servlet IgraServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}

Problem se javlja kada pozovem metodu "dodajWeb" chat server interfejsa. Greska sledeca:

java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: java.io.PrintWriter
 
Odgovor na temu

[es] :: Java :: java RMI pravljenje cet aplikacije

[ Pregleda: 669 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.