on 09-05-2006 7:09 AM
Hello, everyone. I've encounted a problem puzzled me for a really long time.
Technical Senario:
Computer A:
Windows 2000 Server
XI 3.0
CICS Client
Computer B:
AIX UNIX
CICS Server
At first we write a plain java program (using j2sdk 1.4.2) and it does work, but after we deployed EAR project which contains code similiar to the plain java code to the J2EE engine, it threw out exception.
The program get time from a application name SAPPROG5 in CICS Server(on the Computer B) through CICS Client, which is a application installed on the Computer A.
P.S: 1. The CICS Client we installed is a windows application which may register something in the operation system level.
2. The CICS document mentions that by using the CICS Transaction Gateway, which is a component of CICS Client, JNI(Java Native Interface) technology is used.
3. CICS is product of IBM.
The plain Java code:
import easycics.*;
public class MainClass {
public static void main(String[] args) {
String l_time = new String();
try {
App oEc = new easycics.App();
App.bDebug = true;
oEc.strJGateName = "local:";
oEc.ConnectServer("CICSCTG", "SAPUSER", "SAPUSER");
oEc.CallProgramAndCommit("SAPPROG5");
l_time = oEc.GetValue("TIME");
} catch (ServerErrorException e) {
e.printStackTrace();
}
System.out.println(l_time);
}
}
The code in the EJB project:
import easycics.*;
public class MITime_PortTypeImpl
extends com.sap.aii.proxy.xiruntime.core.AbstractProxy
implements MITime_PortType {
public java.lang.String mITime(java.lang.String mTQuery)
throws
cicsJavaTestByYining.FMTTime_Message_Exception,
com.sap.aii.proxy.xiruntime.core.SystemFaultException,
com.sap.aii.proxy.xiruntime.core.ApplicationFaultException {
//throw new RuntimeException();
String l_time = new String();
try {
App oEc = new easycics.App();
App.bDebug = true;
oEc.strJGateName = "local:";
oEc.ConnectServer("CICSCTG", "SAPUSER", "SAPUSER"); //Exception is threw here
oEc.CallProgramAndCommit("SAPPROG5");
l_time = oEc.GetValue("TIME");
} catch (ServerErrorException se) {
}
return l_time;
}
}
exception:
return msg: Can not Connect to the server!
error code: -1l
ocalized msg:
Can not Connect to the server!
server error toString: easycics.ServerErrorException:
Can not Connect to the server!
stackTrace: easycics.App.ConnectServer(App.java:894)
cicsJavaTestByYining.MITime_PortTypeImpl.mITime(MITime_PortTypeImpl.java:27)
cicsJavaTestByYining.MITime_PortTypeBean.invokeMethod(MITime_PortTypeBean.java:34)
com.sap.aii.proxy.xiruntime.core.AbstractProxyInboundRemote4ObjectImpl0.invokeMethod(AbstractProxyInboundRemote4ObjectImpl0.java:119)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
com.sap.engine.services.rmi_p4.reflect.LocalInvocationHandler.invokeInternal(LocalInvocationHandler.java:74)
com.sap.engine.services.rmi_p4.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:53)
$Proxy230.invokeMethod(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
$Proxy231.invokeMethod(Unknown Source)
com.sap.aii.proxy.xiruntime.core.XmlProxyJ2EE.call(XmlProxyJ2EE.java:169)
com.sap.aii.proxy.xiruntime.core.XmlProxy$ProxyBeanCaller.call(XmlProxy.java:225)
com.sap.aii.proxy.xiruntime.core.XmlProxy.processRequest(XmlProxy.java:194)
com.sap.aii.proxy.xiruntime.core.XmlInbound.processRequestMessage(XmlInbound.java:126)
com.sap.aii.proxy.xiruntime.core.XmlInbound.processMessage(XmlInbound.java:83)
com.sap.aii.proxy.xiruntime.sbeans.JPRBean.onMessage(JPRBean.java:158)
com.sap.aii.proxy.xiruntime.sbeans.JPRLocalLocalObjectImpl0.onMessage(JPRLocalLocalObjectImpl0.java:179)
com.sap.aii.af.ra.ms.impl.ServicesImpl.deliver(ServicesImpl.java:253)
com.sap.aii.adapter.xi.ms.XIEventHandler.onDeliver(XIEventHandler.java:838)
com.sap.aii.af.ra.ms.impl.core.queue.RequestConsumer.onMessage(RequestConsumer.java:112)
com.sap.aii.af.ra.ms.impl.core.queue.Queue.run(Queue.java:795)
com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
java.security.AccessController.doPrivileged(Native Method)
com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
The exception is thrown because the program can not connect to the server. It doesn't necessarily mean that there is anything wrong with your code. Have you checked all your connection parameters to the SAP server or to the server you are connecting to (if middleware handles communication)?
SAP server requires these parameters
Host
Client
Username
Password
System number
language (en by default)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dionisios,
actually the "server" here is not a sap. It is a CICS server.
Since I can connect to the "server" normally when using a plain java in the same computer, I don't think there's anything wrong with the parameters.
I've asked an expert of CICS about this question, and he told me that maybe SAP J2EE Engine cannot find centain c++ lib in the operation level.
Later I found SAP J2EE Engine will add "path=" parameter of windows 2000 to it's lib path, so I tried to add all "lib=" parameter into "path=" parameter, but after restart the operation system and SAP instance, the problem is still here.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.