on 02-02-2009 9:39 AM
Hello,
I want do write a RFCServer with JCo3.
First I have implementet the StepByStepServer from the manual. But it did not work.
I do not understand the the using of the connetionProperties.
Why does the program uses three connections ? If I want to implemt a server I only need a server connection with GWHOSt, GWSERV, PROGID.
If I try this I will gete an error like:
Exception in thread "main" com.sap.conn.jco.JCoRuntimeException: (101) JCO_ERROR_CONFIGURATION: Unable to start the server, because of repository is null
at com.sap.conn.jco.rt.DefaultServer.checkRuntimeConfiguration(DefaultServer.java:561)
at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:580)
at StepByStepServer.step3SimpleTRfcServer(StepByStepServer.java:291)
at StepByStepServer.main(StepByStepServer.java:299)
Has somebody an example for an RFCServer implemteted with JCo3 ?
Thanks
Arnfried
hi,
check this threads
check for this book "Enterprise Java for SAP" u can download this book from net
let me know u need any further info
bvr
Edited by: bvr on Feb 2, 2009 1:16 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In my Java server code, I want to provide a function named "IncreaseOne", it gets an input integer named "i", and returns another integer with value i+1. I don't want to register this pure java method in any application server.
I think I only need to register a JCoServerRequestHandler for my "IncreaseOne". Then I can use jcorequest and jcoresponse to get and set my desired values.
public void handleRequest(JCoServerContext jcoservercontext, JCoRequest jcorequest, JCoResponse jcoresponse)
Get: int i = jcorequest.getInt("i");
Set: jcoresponse.setValue("i_output", i+1);
It should NOT ask me to link to any application server.
It's unfare to throw this exception:
Exception in thread "main" com.sap.conn.jco.JCoRuntimeException: (101) JCO_ERROR_CONFIGURATION: Unable to start the server, because of repository is null
Does anyone know how I can get it over?
Thanks!
Hello,
please read my posting above.
You need to connections to a SAP system if you want to implement a JCo Server 3.x.
The message "Unable to start the server, because of repository is null" means that your connection to get the repository information is not working or is not implemented.
Arnfried
I have successfully met my goal of no need for sap server as repository.
//Define my own JCoCustomRepository
public class MyJCoCustomRepository implements JCoCustomRepository {
protected String m_Name;
protected Hashtable<String, JCoFunctionTemplate> m_JCoFunctionTemplateCache;
protected Hashtable<String, JCoRecordMetaData> m_JCoRecordMetaDataCache;
...
}
//Use it as following:
JCoCustomRepository jcorepository = new MyJCoCustomRepository("LocalRepository");
server.setRepository(jcorepository);
String name = "STFC_CONNECTION_KEVIN";
JCoListMetaData imports = JCo.createListMetaData("aa");
imports.add("REQUTEXT", JCoMetaData.TYPE_STRING, 50, 50, JCoListMetaData.IMPORT_PARAMETER);
imports.lock();
JCoListMetaData exports = JCo.createListMetaData("bb");
exports.add("RESPTEXT", JCoMetaData.TYPE_STRING, 50, 50, JCoListMetaData.EXPORT_PARAMETER);
exports.add("ECHOTEXT", JCoMetaData.TYPE_STRING, 50, 50, JCoListMetaData.EXPORT_PARAMETER);
exports.lock();
JCoFunctionTemplate jcofunctiontemplate = JCo.createFunctionTemplate(name, imports, exports, null, null, null);
jcorepository.addFunctionTemplateToCache(jcofunctiontemplate);
JCoServerFunctionHandler stfcConnectionHandler = new StfcConnectionHandler();
DefaultServerHandlerFactory.FunctionHandlerFactory factory = new DefaultServerHandlerFactory.FunctionHandlerFactory();
factory.registerHandler(name, stfcConnectionHandler);
server.setCallHandlerFactory(factory);
server.start();
I am not sure if there is any risk or issue with this design. Can anyone confirm?
Thanks!
User | Count |
---|---|
93 | |
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.