Unknown Source occurred when locksession

I tried to call bapi to create sales order in SAP thru SAPBC 46.
However, the message ‘NullPointerException’ occurred when lock session.
There is no sales Order document created in SAP but the message in
SAPBC 46 shown Sales Order is created successfully with a Sales Order
Document.

= = = = = = = = = = = = = = = = = = = = = = = = = = =
The flow service invokes the services below.

pub.sap.client:lockSession
SAPInterface.BAPI:BAPI_SALESORDER_CREATEFROMDAT2
SAPInterface.BAPI:BAPI_TRANSACTION_COMMIT
pub.sap.client:releaseSession

= = = = = = = = = = = = = = = = = = = = = = = = = = =
The SAPBC 46 information is quoted below.

Product webMethods B2B SAP Adapter
Version SAP Adapter 4.6 SP5 Release Notes
Build Number 625

Environment
JayCo Version 2.0.9 (2003-07-04)
JayCo Middleware sapjcorfc
JayCo Middleware Version 2.0.9 (2003-07-04)
jRFCLibrary Version 2.0.9 (2003-07-04)
jRFC Library Location D:\sapbc46
\Server\packages\SAP\code\libs\sapjcorfc.dll
RFC Library Version This RFC library belongs to the SAP R/3 Release ***
620,0,1237 *** MT-SL Versions of SAP internal libraries: dptr: 2 ni :
36 cpic: 3 rfc : 3
jARM Version 2.1.0
OS Version 5.0
Current User Administrator
Working Directory D:\sapbc46\Server

= = = = = = = = = = = = = = = = = = = = = = = = = = =
The error mesage is quoted below.

2004-12-31 19:41:54 CST java.lang.NullPointerException
at com.wm.pkg.sap.rfc.SessionManager.lockSession(Unknown Source)
at com.wm.pkg.sap.rfc.SessionManager.lockSession(Unknown Source)
at pub.sap.client.lockSession(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:281)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:715)
at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:140)
at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:292)
at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:559)
at com.wm.lang.flow.FlowState.step(FlowState.java:430)
at com.wm.lang.flow.FlowState.invoke(FlowState.java:400)
at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:1786)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:715)
at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:140)
at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:292)
at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:559)
at com.wm.lang.flow.FlowState.step(FlowState.java:430)
at com.wm.lang.flow.FlowState.invoke(FlowState.java:400)
at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:1786)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:715)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:472)
at com.wm.app.b2b.server.Service.doInvoke(Service.java:495)
at com.wm.app.b2b.server.Service.doInvoke(Service.java:464)
at com.wm.app.tn.route.RoutingActions.invokeWrapper
(RoutingActions.java:818)
at wm.tn.route.invokeWrapper(route.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:281)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:715)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:472)
at com.wm.app.b2b.server.ServiceThread.run(ServiceThread.java:82)
at com.wm.util.pool.PooledThread.run(C:/NT/Perforce/basis/4.1.0-
terra/module/core/source/com/wm/util/pool/PooledThread.java:103)
at java.lang.Thread.run(Thread.java:479)

Hello,

Have you fixed this issue? Would you please share your experience with me? I got the same issue when uplodate data to SAP. It worked fine when Trace the service, but got this error when Run it. Thanks a lot.

I think the problem is as follows: if this service runs inside the BC without a valid user session, it tries to attach an RFC connection to the non-existent user session, leading to the above error.
The question now is: why is there no valid user session at the time this service runs? I know that some webMethods add-ons (like Trading Networks) sometimes execute services without creating a user session first. Are you perhaps triggering your BAPI service from Trading Networks?
Ah, yes I see: “wm.tn.route.invokeWrapper”… “tn” looks like Trading Networks! So I guess, you have two options now:
a) ask webMethods to fix TN so it always does a proper user login before invoking any services
b) as a workaround write a little Java Service that creates a user session, and invoke it before the lockSession Service.

a) maybe hopeless: we brought this to webMethods’ attention already in 2000 or 2001, but nothing changed yet…
So that leaves only b). Do you know how to do it? If not, I can post the necessary code here.