Quantcast
Channel: SCN : Popular Discussions - ABAP和Java开发 (ABAP & Java Development)
Viewing all articles
Browse latest Browse all 4604

JCO 连接SAP POOL有毛病

$
0
0

各位好:

     我在使用JCO连接SAP系统时,用直连的方式是可以正常连接。

连接池:

     private static final String SAPHR_POOL_NAME = "pool";

 

     public static JCO.Client getSAPHRPoolConnection() {

           

          JCO.Pool pool = JCO.getClientPoolManager().getPool(SAPHR_POOL_NAME);

          if (pool == null) {

               Properties logonProperties = new Properties();

               logonProperties.put("jco.client.ashost", "10.1.3.8");

               logonProperties.put("jco.client.client", "001");

               logonProperties.put("jco.client.passwd", "123456");

               logonProperties.put("jco.client.sysnr", "02");

               logonProperties.put("jco.client.user", "ibm-pengjx");

               logonProperties.put("jco.client.toupper", "0");

                

               JCO.addClientPool(SAPHR_POOL_NAME, 1000, logonProperties); // properties

      

          }

           

          JCO.Client mConnection = JCO.getClient(SAPHR_POOL_NAME);

           

          return mConnection;

     }

 

运行连接池时就报错:

Exception in thread "main" java.lang.NullPointerException

     at com.sap.mw.jco.JCO$Client.connect(JCO.java:3108)

     at com.sap.mw.jco.JCO$Repository.getRepositoryClient(JCO.java:19331)

     at com.sap.mw.jco.JCO$Repository.queryStructureDefinition(JCO.java:19420)

     at com.sap.mw.jco.JCO$Repository.getStructureDefinition(JCO.java:19570)

     at com.sap.mw.jco.JCO$BasicRepository.getTableDefinition(JCO.java:18662)

     at com.sap.mw.jco.JCO$BasicRepository.getFunctionTemplate(JCO.java:18601)

     at com.util.detail.getGSJ(detail.java:53)

     at com.util.detail.main(detail.java:116)

 

//这行是53行

IFunctionTemplate ft = myRepository.getFunctionTemplate(strFunc.toUpperCase());

 

 

我想请问各位的是:用直连的方式,53行是不会出错的。。为什么用连接池就报这一行错误,那说明错误是出现在连接池上面。。

  在群里问了一个前辈,说是我 的private static final String SAPHR_POOL_NAME = "pool";没在SAP系统内定义。。但他不知道在哪定义,,我想请问这个pool name是否需要在SAP内定义,或者调用的SAP的pool????

希望各位前辈给我一个思路。。。


Viewing all articles
Browse latest Browse all 4604

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>