on 11-20-2007 1:00 PM
Hello,
I want to establishing an RFC connection using an existing destination.
My code:
private static final String USER = "Administrator";
private static final String PASSWORD = "********";
private static final String SAP_NAMING_PROVIDER_URL = "vm-sapnwce:50004";
private static final String SAP_INITIAL_CONTEXT_FACTORY_IMPL = "java.naming.factory.initial";
public List<Person> findPerson(String employeeID, String name,
Date dateOfBirth) {
/*
* JNDI service naming environment properties initialization
*/
Properties ctxProp = new Properties();
ctxProp.put(Context.INITIAL_CONTEXT_FACTORY,
SAP_INITIAL_CONTEXT_FACTORY_IMPL);
ctxProp.put(Context.PROVIDER_URL, SAP_NAMING_PROVIDER_URL);
ctxProp.put(Context.SECURITY_PRINCIPAL, USER);
ctxProp.put(Context.SECURITY_CREDENTIALS, PASSWORD);
/*
* Create a JNDI API InitialContext object.
*/
Context jndiContext = null;
try {
jndiContext = new InitialContext(ctxProp);
} catch (NamingException e) {
System.out.println("Could not create JNDI API" + "context: "
+ e.toString());
e.printStackTrace();
System.exit(1);
}
/*
* Create a JNDI API InitialContext object.
*/
DestinationService dstService = null;
RFCDestination dst = null;
try {
dstService = (DestinationService) jndiContext.lookup(DestinationService.JNDI_KEY);
if (dstService == null)
throw new NamingException("Destination Service not available");
dst = (RFCDestination) dstService.getDestination("RFC",
"TDE");
} catch (NamingException e1) {
e1.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (DestinationException e) {
e.printStackTrace();
}
Properties jcoProperties = dst.getJCoProperties();
/*
* Establishing a direct connection
*/
JCO.Client jcoClient = JCO.createClient(jcoProperties);
jcoClient.connect();
...
But if I execute the method the jstart.EXE in sapmmc go in status "Some processes running" and the AS restarts.
Error in NWDS:
Nov 20, 2007 1:46:48 PM [1195562808569]:Error : Thread[Thread-10,5,main] ...rvices.rmi_p4.Parser.newRequest(ClientConnection): The possible problem is that there is no available working correctly server node. Check your working servers
com.sap.engine.services.rmi_p4.P4ConnectionException: Error. Check your available working servers.
at com.sap.engine.services.rmi_p4.P4ObjectBrokerClientImpl.getException(P4ObjectBrokerClientImpl.java:630)
at com.sap.engine.services.rmi_p4.P4ObjectBrokerClientImpl.getException(P4ObjectBrokerClientImpl.java:612)
at com.sap.engine.services.rmi_p4.Parser.newRequest(Parser.java:143)
at com.sap.engine.services.rmi_p4.ClientConnection.run(ClientConnection.java:390)
at java.lang.Thread.run(Thread.java:595)
If I execute the methode with the following code instead of the code above I can execute the method without any problems:
JCO.Client jcoClient = JCO.createClient("011", "Restle", "********",
"en", "sma82", "01");
jcoClient.connect();
Regards,
Armin
Hi armin,
did you debugged your method and watched your jcoProperties, before creating the client?
Regards, Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.