hi. i am facing one problem.i have a class named "ReportingService" and it should be singleton and is is extending "CommonService".
package MyApp.Services.ReportingService;
public class ReportingService extends CommonService {
private static ReportingService instance = null;
public static ReportingService getInstance() {
if (instance == null) {
instance = new ReportingService();
}
return instance;
}
}
and to access this class in other class i am using
package MyApp.Services.WebReportingService;
@WebMethod(operationName = "registerUDP")
public boolean registerUDP(
@WebParam(name = "Friendly Name") String friendlyName,
@WebParam(name = "Username") String username,
@WebParam(name = "Password") String password,
@WebParam(name = "Communication Protocol") CommunicationProtocol communicationProtocol,
@WebParam(name = "IP Address") String ipAddress,
@WebParam(name = "Port") int port) {
Consumer client = new Consumer(friendlyName, username, password, communicationProtocol, ipAddress, port);
ReportingService rs = ReportingService.
return true;
}
in "ReportingService rs = ReportingService." it is not showing me getInstance() method of ReportingService class. I also imported correct packages.
NOTE: both classes are in different packages.
here is the error when i compiled.
G:\mOhsan\JavaProjects\Care.AAD.SOA\Care.AAD.Java.Services.WebReportingService\src\java\Care\AAD\Java\Services\WebReportingService\WebReportingService.java:42: cannot access care.aad.Java.Common.DesignPattern.ObserverPattern.Observer class file for care.aad.Java.Common.DesignPattern.ObserverPattern.Observer not found Consumer client = new Consumer(friendlyName, username, password, communicationProtocol, ipAddress, port); G:\mOhsan\JavaProjects\Care.AAD.SOA\Care.AAD.Java.Services.WebReportingService\src\java\Care\AAD\Java\Services\WebReportingService\WebReportingService.java:44: cannot access care.aad.Java.Common.DesignPattern.ObserverPattern.Subject class file for care.aad.Java.Common.DesignPattern.ObserverPattern.Subject not found ReportingService rs = ReportingService.getInstance(); 2 errors G:\mOhsan\JavaProjects\Care.AAD.SOA\Care.AAD.Java.Services.WebReportingService\nbproject\build-impl.xml:422: The following error occurred while executing this line: G:\mOhsan\JavaProjects\Care.AAD.SOA\Care.AAD.Java.Services.WebReportingService\nbproject\build-impl.xml:225: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 1 second)