Buongiorno volevo porre all'attenzione un problema che non riesco a risolvere: non riesco a connettermi al server CMDBuild tramite il client da me creato in java, di cui il codice sottostante:
// 1. Creazione di un'istanza della classe ConfigurationContext in cui si indica dove si trova la cartella
// repository. Nella cartella repository si trovano 2 cartelle: la cartella modules che contiene il file
// rampart.mar, e la cartella conf che contiene il file che definisce la policy di sicurezza da adottare
ConfigurationContext configContext =
ConfigurationContextFactory .createConfigurationContextFromFileSystem(
"C://Program Files//Axis//axis2-1.6.2//repository//modules",null);
// 2. Istanziazione dello stub passandogli il ConfigurationContext appena creato
$Proxy61ServiceStub stub = new $Proxy61ServiceStub(configContext);
//3. Impostazione delle credenziali di autenticazione
StAXOMBuilder builder = new StAXOMBuilder("C://Program Files//Axis//axis2-1.6.2//conf//policy.xml");
stub._getServiceClient().engageModule("rampart");
Options options = stub._getServiceClient().getOptions();
options.setUserName("admin");
options.setPassword("admin");
Policy policy= PolicyEngine.getPolicy(builder.getDocumentElement());
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,policy);
// 4. Istanziare un oggetto di tipo <TipoOggetto> ed eseguire la chiamata al server
GetCard card = new GetCard();
card.setClassName("Pippo");
GetCardE cardE = new GetCardE();
cardE.setGetCard(card);
GetCardResponseE responseE = stub.getCard(cardE);
GetCardResponse response = responseE.getGetCardResponse();
System.out.println("Nome della Card: "+response.get_return().getClassName());
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XMLStreamException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Mi viene restituito il seguente errore:
log4j:WARN No appenders could be found for logger (org.apache.axis2.deployment.FileSystemConfigurator).
log4j:WARN Please initialize the log4j system properly.
org.apache.axis2.AxisFault: Unable to engage module : rampart
at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:363)
at org.modbus.stub.Client.main(Client.java:49)