For Programmers: Free Programming Magazines  


Home > Archive > Java Help > June 2005 > Constructor doesnt work









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Constructor doesnt work
Irlan agous

2005-06-11, 8:57 am

Hello, I want to put rmi in my application. When i make the server i have
this construction:

Patient patient = new Patient();
System.out.println("Binding...");

Naming.bind("PatientServer", patient);
System.out.println("PatientServer is ready...");

Then i get this error message: And Patient.class exist!!!!


sapa1/PatientServer.java [26:1] cannot resolve symbol
symbol : constructor Patient ()
location: class sapa1.Patient
Patient patient = new Patient();
^
sapa1/PatientServer.java [29:1] bind(java.lang.String,java.rmi.Remote) in
java.rmi.Naming cannot be applied to (java.lang.String,sapa1.Patient)
Naming.bind("PatientServer", patient);
^
2 errors


Can anyone help me pls


Bjorn Abelli

2005-06-11, 8:57 am


"Irlan agous" wrote...

> Hello, I want to put rmi in my application.
> When i make the server i have this construction:
>
> Patient patient = new Patient();
> System.out.println("Binding...");
>
> Naming.bind("PatientServer", patient);
> System.out.println("PatientServer is ready...");
>
> Then i get this error message: And Patient.class exist!!!!
>
>
> sapa1/PatientServer.java [26:1] cannot resolve symbol
> symbol : constructor Patient ()
> location: class sapa1.Patient
> Patient patient = new Patient();


Read the error again:

cannot resolve symbol :
constructor Patient ()


That is that you don't have an *empty* constructor in Patient, which means
you can't instantiate it that way. Look up in your Patient class with which
arguments you need for instantiating a Patient.

And it also seems that your "Patient" doesn't implement the interface
Remote.

bind(java.lang.String,java.rmi.Remote)
cannot be applied to (java.lang.String,sapa1.Patient)


// Bjorn A



Irlan agous

2005-06-11, 3:58 pm


Thanks, but it didnt work.

The Patient(the impl) already extends UnicastRemoteObject, teh problem is
also that i cant expend also DataModel that makes the database connection. I
am a newbie in this case, I will show you the files:

Patient.java

import java.rmi.*;
import java.rmi.server.*;

public class Patient extends UnicastRemoteObject implements PatientInterface
{

:
}

PatientServer.java
import java.rmi.*;


public class PatientServer
{

public static void main(String[] args)
{
try
{
if (System.getSecurityManager() == null)
{
System.setSecurityManager ( new RMISecurityManager());
}
Patient patientImpl = new Patient();
System.out.println("Binding...");

Naming.bind("PatientServer", patientImpl);
System.out.println("PatientServer is ready...");

}
catch (Exception e)
{
e.printStackTrace();
}
}

}


I would appriciate if i can send you the files, and you can take a look, i
would even be willing to pay, becouse i really need to unerstand this

Thanks in advance

Irlan
>
> "Irlan agous" wrote...
>
>
> Read the error again:
>
> cannot resolve symbol :
> constructor Patient ()
>
>
> That is that you don't have an *empty* constructor in Patient, which means
> you can't instantiate it that way. Look up in your Patient class with
> which arguments you need for instantiating a Patient.
>
> And it also seems that your "Patient" doesn't implement the interface
> Remote.
>
> bind(java.lang.String,java.rmi.Remote)
> cannot be applied to (java.lang.String,sapa1.Patient)
>
>
> // Bjorn A
>
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com