enter code here
I try to acess a java class by his interface
I make a class in Ls2J instead the java interface because i don't know how i do
and i have the error :
error : LS2J Error: Java constructor failed to execute
An idea ? ^^
thanks !
my class java in lotus
Class ILogWebService
sessionJava As JAVASESSION
classJava As JAVACLASS
objectJava As JAVAOBJECT
methodJava As JAVAMETHOD
Public Sub New(logDTO As LogWSDTO)
Set sessionJava = New JAVASESSION
Set classJava = sessionJava.GetClass("com.pasquier.DAO.WS/ILogWebService")
Set objectJava = classJava.CreateObject
End Sub
Public Sub notesMain()
Set methodJava = classJava.GetMethod("notesMain","()V")
objectJava.notesMain
End Sub
End Class
my java interface:
package com.pasquier.IDAO.WS;
import com.pasquier.MesExceptions.ExceptionWS;
public interface ILogWebService {
void notesMain() throws ExceptionWS;
}
my java class :
public class LogWebService implements ILogWebService {
private Session session;
private LogWSDTO logDTO = null;
public LogWebService(LogWSDTO log) {
this.logDTO = log;
}
public void notesMain() throws ExceptionWS {
try
{
try
{
session = WebServiceBase.getCurrentSession();
ILogWSDAO ilog = FactoryWS.getInstance().createLogWSDAO(session, logDTO);
ilog.ajouterLog();
} finally
{
UtilMemoire.purgeMemoire();
}
} catch (NullPointerException e1)
{
System.out.println("ERREUR NullPointer sur NotesMain sur LogWebService");
throw new ExceptionWS("ERREUR NullPointer sur NotesMain sur LogWebService", e1, logDTO);
} catch (ExceptionWS e)
{
System.out.println( e.getMessage());
} catch (Exception e2)
{
System.out.println("ERREUR sur NotesMain sur LogWebService " + e2.getMessage());
throw new ExceptionWS("ERREUR sur NotesMain sur LogWebService " + e2.getMessage(), e2, logDTO);
}
}
my lotuscript :
Class LogGetAllDocumentsDAO
Private ilog As ILogWebService
Private logDTO As LogWSDTO
Private docDTO As LogGetAllDocumentsDTO
Private utilDt As UtilDate
Public Sub New(logWSparam As LogWSDTO, docDTOparam As LogGetAllDocumentsDTO)
Set Me.logDTO = logWSparam
Set Me.docDTO = docDTOparam
End Sub
Public Sub appelLog()
Call ajouterParam()
Set ilog = New ILogWebService(logDTO)
'Call ilog.notesMain()
End Sub
Public Sub ajouterParam()
Dim retourWS As String
Dim paramWS As String
'paramètres d'envoi de web services
paramWS = "dbserver=" + docDTO.getDbServer
paramWS = paramWS + "dbpath=" + docDTO.getDbPath
paramWS = paramWS + "nomVue=" + docDTO.getNomVue
paramWS = paramWS + "key=" + docDTO.getKey
paramWS = paramWS + "sep=" + docDTO.getSep
logDTO.setParamWS(paramWS)
'paramètres de retour de web services
retourWS = "Nombre d'Identifiants : ...."
logDTO.setRetourWS(retourWS)
'logDTO.setDateHeureDebutWS(utilDt.dateTimeDuJour(session, logDTO))
End Sub
End Class
thanks for your help !!
i come back because it didn't work i try this to call my class as if the interface doesn't exist but it says error : "LS2J Error : Java constructor failed to execute"
Sub Click(Source As Button)
Dim mySession As JAVASESSION
Dim myClass As JAVACLASS
Dim myObjet As JAVAOBJECT
Dim toto As String
Dim toto2 As String
Dim myCollection As JavaMethodCollection
Dim myMethod As JavaMethod
Dim myMethod2 As JavaMethod
toto2 = "test"
Set mySession = New JAVASESSION
Set myClass = mySession.GetClass("com.pasquier.launcher/LogWebService")
Set myObjet = myClass.CreateObject("(Lcom/pasquier/DTO/WS/LogWSDTO;)V")
Messagebox (toto2)
Set myCollection = myClass.getClassMethods()
Set myMethod = myCollection.getFirst()
Do
If myCollection.count <> 0 Then
toto2 = myMethod.MethodName & " " & myMethod.signature
Messagebox (toto2)
End If
Set myMethod = myCollection.getNext()
Loop While myCollection.current <> 1
End Sub
could you help me ?